diff --git a/crates/bevy_ui/src/ui_node.rs b/crates/bevy_ui/src/ui_node.rs index ac086d02a5556..aeaf8e3b1f380 100644 --- a/crates/bevy_ui/src/ui_node.rs +++ b/crates/bevy_ui/src/ui_node.rs @@ -222,7 +222,10 @@ impl ComputedNode { /// Returns the combined inset on each edge including both padding and border thickness in physical pixels. #[inline] pub fn content_inset(&self) -> BorderRect { - self.border + self.padding + let mut content_inset = self.border + self.padding; + content_inset.right += self.scrollbar_size.x; + content_inset.bottom += self.scrollbar_size.y; + content_inset } /// Returns the inverse of the scale factor for this node. diff --git a/crates/bevy_ui/src/update.rs b/crates/bevy_ui/src/update.rs index 77659effabcf1..e038a53b645fe 100644 --- a/crates/bevy_ui/src/update.rs +++ b/crates/bevy_ui/src/update.rs @@ -111,8 +111,8 @@ fn update_clipping( clip_rect.min.x += clip_inset.left; clip_rect.min.y += clip_inset.top; - clip_rect.max.x -= clip_inset.right + computed_node.scrollbar_size.x; - clip_rect.max.y -= clip_inset.bottom + computed_node.scrollbar_size.y; + clip_rect.max.x -= clip_inset.right; + clip_rect.max.y -= clip_inset.bottom; clip_rect = clip_rect .inflate(node.overflow_clip_margin.margin.max(0.) / computed_node.inverse_scale_factor);