From 1fcc56f1ee5a5e63e435bd582e82521307d01274 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Mon, 11 Aug 2025 20:52:30 +0100 Subject: [PATCH 1/3] Added doc comments for the fields and methods of `ComputedNodeTarget` --- crates/bevy_ui/src/ui_node.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/bevy_ui/src/ui_node.rs b/crates/bevy_ui/src/ui_node.rs index 7c55265691233..af256ec0d85b6 100644 --- a/crates/bevy_ui/src/ui_node.rs +++ b/crates/bevy_ui/src/ui_node.rs @@ -2800,11 +2800,16 @@ impl<'w, 's> DefaultUiCamera<'w, 's> { } /// Derived information about the camera target for this UI node. +/// +/// Updated in [`UiSystems::Prepare`] by `update_ui_context_system`. #[derive(Component, Clone, Copy, Debug, Reflect, PartialEq)] #[reflect(Component, Default, PartialEq, Clone)] pub struct ComputedNodeTarget { + /// The id of the target camera for this UI node. pub(crate) camera: Entity, + /// The scale factor of the target camera's render target. pub(crate) scale_factor: f32, + /// The size of the target camera's viewport in physical pixels. pub(crate) physical_size: UVec2, } @@ -2819,18 +2824,22 @@ impl Default for ComputedNodeTarget { } impl ComputedNodeTarget { + /// Returns the id of the target camera for this UI node. pub fn camera(&self) -> Option { Some(self.camera).filter(|&entity| entity != Entity::PLACEHOLDER) } + /// Returns the scale factor of the target camera's render target. pub const fn scale_factor(&self) -> f32 { self.scale_factor } + /// Returns the size of the target camera's viewport in physical pixels. pub const fn physical_size(&self) -> UVec2 { self.physical_size } + /// Returns the size of the target camera's viewport in logical pixels. pub fn logical_size(&self) -> Vec2 { self.physical_size.as_vec2() / self.scale_factor } From 007fb9e18fd7a95b10bf43d5e2e5b46e8a432fff Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Mon, 11 Aug 2025 21:35:05 +0100 Subject: [PATCH 2/3] Fixed doc hyperlinks --- crates/bevy_ui/src/ui_node.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_ui/src/ui_node.rs b/crates/bevy_ui/src/ui_node.rs index af256ec0d85b6..ec04854396a9d 100644 --- a/crates/bevy_ui/src/ui_node.rs +++ b/crates/bevy_ui/src/ui_node.rs @@ -2801,7 +2801,7 @@ impl<'w, 's> DefaultUiCamera<'w, 's> { /// Derived information about the camera target for this UI node. /// -/// Updated in [`UiSystems::Prepare`] by `update_ui_context_system`. +/// Updated in [`UiSystems::Prepare`](crate::UiSystems::Prepare) by [`update_ui_context_system`](crate::update::update_ui_context_system) #[derive(Component, Clone, Copy, Debug, Reflect, PartialEq)] #[reflect(Component, Default, PartialEq, Clone)] pub struct ComputedNodeTarget { From 547d8b7b76dfef4ef6e9e50f7940aad2a211d442 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Tue, 12 Aug 2025 22:22:36 +0100 Subject: [PATCH 3/3] Fixed broken hyperlink --- crates/bevy_ui/src/ui_node.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_ui/src/ui_node.rs b/crates/bevy_ui/src/ui_node.rs index ba56a562ac27f..8c5b2212dadda 100644 --- a/crates/bevy_ui/src/ui_node.rs +++ b/crates/bevy_ui/src/ui_node.rs @@ -2801,7 +2801,7 @@ impl<'w, 's> DefaultUiCamera<'w, 's> { /// Derived information about the camera target for this UI node. /// -/// Updated in [`UiSystems::Prepare`](crate::UiSystems::Prepare) by [`update_ui_context_system`](crate::update::update_ui_context_system) +/// Updated in [`UiSystems::Prepare`](crate::UiSystems::Prepare) by [`propagate_ui_target_cameras`](crate::update::propagate_ui_target_cameras) #[derive(Component, Clone, Copy, Debug, Reflect, PartialEq)] #[reflect(Component, Default, PartialEq, Clone)] pub struct ComputedUiTargetCamera {