From d22acb2a9a2be8e033121400999b63a87b474800 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Fri, 11 Jul 2025 15:34:50 +0100 Subject: [PATCH] Added `scrollbar_size` field to `ComputedNode`. Added `scrollbar_width` field to `Node`. --- 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 7aed57931c..6ffedfb45f 100644 --- a/crates/bevy_ui/src/ui_node.rs +++ b/crates/bevy_ui/src/ui_node.rs @@ -42,6 +42,10 @@ pub struct ComputedNode { /// /// Automatically calculated by [`super::layout::ui_layout_system`]. pub content_size: Vec2, + /// Space allocated for scrollbars. + /// + /// Automatically calculated by [`super::layout::ui_layout_system`]. + pub scrollbar_size: Vec2, /// The width of this node's outline. /// If this value is `Auto`, negative or `0.` then no outline will be rendered. /// Outline updates bypass change detection. @@ -305,6 +309,7 @@ impl ComputedNode { stack_index: 0, size: Vec2::ZERO, content_size: Vec2::ZERO, + scrollbar_size: Vec2::ZERO, outline_width: 0., outline_offset: 0., unrounded_size: Vec2::ZERO, @@ -419,6 +424,9 @@ pub struct Node { /// pub overflow: Overflow, + /// How much space in logical pixels should be reserved for scrollbars when overflow is set to scroll or auto on an axis. + pub scrollbar_width: f32, + /// How the bounds of clipped content should be determined /// /// @@ -703,6 +711,7 @@ impl Node { aspect_ratio: None, overflow: Overflow::DEFAULT, overflow_clip_margin: OverflowClipMargin::DEFAULT, + scrollbar_width: 0., row_gap: Val::ZERO, column_gap: Val::ZERO, grid_auto_flow: GridAutoFlow::DEFAULT,