Skip to content

Commit ed13d9b

Browse files
authored
Add documentation for ComputedUiTargetCamera (#20520)
# Objective Add doc comments for the fields and methods belonging to `ComputedUiTargetCamera`. ## Solution Add the doc comments.
1 parent 1ec9804 commit ed13d9b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

crates/bevy_ui/src/ui_node.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2800,11 +2800,15 @@ impl<'w, 's> DefaultUiCamera<'w, 's> {
28002800
}
28012801

28022802
/// Derived information about the camera target for this UI node.
2803+
///
2804+
/// Updated in [`UiSystems::Prepare`](crate::UiSystems::Prepare) by [`propagate_ui_target_cameras`](crate::update::propagate_ui_target_cameras)
28032805
#[derive(Component, Clone, Copy, Debug, Reflect, PartialEq)]
28042806
#[reflect(Component, Default, PartialEq, Clone)]
28052807
pub struct ComputedUiTargetCamera {
28062808
pub(crate) camera: Entity,
2809+
/// The scale factor of the target camera's render target.
28072810
pub(crate) scale_factor: f32,
2811+
/// The size of the target camera's viewport in physical pixels.
28082812
pub(crate) physical_size: UVec2,
28092813
}
28102814

@@ -2819,18 +2823,22 @@ impl Default for ComputedUiTargetCamera {
28192823
}
28202824

28212825
impl ComputedUiTargetCamera {
2826+
/// Returns the id of the target camera for this UI node.
28222827
pub fn camera(&self) -> Option<Entity> {
28232828
Some(self.camera).filter(|&entity| entity != Entity::PLACEHOLDER)
28242829
}
28252830

2831+
/// Returns the scale factor of the target camera's render target.
28262832
pub const fn scale_factor(&self) -> f32 {
28272833
self.scale_factor
28282834
}
28292835

2836+
/// Returns the size of the target camera's viewport in physical pixels.
28302837
pub const fn physical_size(&self) -> UVec2 {
28312838
self.physical_size
28322839
}
28332840

2841+
/// Returns the size of the target camera's viewport in logical pixels.
28342842
pub fn logical_size(&self) -> Vec2 {
28352843
self.physical_size.as_vec2() / self.scale_factor
28362844
}

0 commit comments

Comments
 (0)