@@ -2800,11 +2800,15 @@ impl<'w, 's> DefaultUiCamera<'w, 's> {
2800
2800
}
2801
2801
2802
2802
/// 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)
2803
2805
#[ derive( Component , Clone , Copy , Debug , Reflect , PartialEq ) ]
2804
2806
#[ reflect( Component , Default , PartialEq , Clone ) ]
2805
2807
pub struct ComputedUiTargetCamera {
2806
2808
pub ( crate ) camera : Entity ,
2809
+ /// The scale factor of the target camera's render target.
2807
2810
pub ( crate ) scale_factor : f32 ,
2811
+ /// The size of the target camera's viewport in physical pixels.
2808
2812
pub ( crate ) physical_size : UVec2 ,
2809
2813
}
2810
2814
@@ -2819,18 +2823,22 @@ impl Default for ComputedUiTargetCamera {
2819
2823
}
2820
2824
2821
2825
impl ComputedUiTargetCamera {
2826
+ /// Returns the id of the target camera for this UI node.
2822
2827
pub fn camera ( & self ) -> Option < Entity > {
2823
2828
Some ( self . camera ) . filter ( |& entity| entity != Entity :: PLACEHOLDER )
2824
2829
}
2825
2830
2831
+ /// Returns the scale factor of the target camera's render target.
2826
2832
pub const fn scale_factor ( & self ) -> f32 {
2827
2833
self . scale_factor
2828
2834
}
2829
2835
2836
+ /// Returns the size of the target camera's viewport in physical pixels.
2830
2837
pub const fn physical_size ( & self ) -> UVec2 {
2831
2838
self . physical_size
2832
2839
}
2833
2840
2841
+ /// Returns the size of the target camera's viewport in logical pixels.
2834
2842
pub fn logical_size ( & self ) -> Vec2 {
2835
2843
self . physical_size . as_vec2 ( ) / self . scale_factor
2836
2844
}
0 commit comments