From 21b62d640b0291ddc92fb3b9216a361c5cd08e06 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Wed, 30 Apr 2025 22:00:42 +0100 Subject: [PATCH] Change the default visual box for `OverflowClipMargin` to `PaddingBox` (#18935) # Objective The default should be `OverflowClipBox::PaddingBox` not `OverflowClipBox::ContentBox` `padding-box` is the default in CSS. ## Solution Set the default to `PaddingBox`. ## Testing Compare the `overflow` UI example on main vs with this PR. You should see that on main the outline around the inner node gets clipped. With this PR by default clipping starts at the inner edge of the border (the `padding-box`) and the outlines are visible. Fixes #18934 --- crates/bevy_ui/src/ui_node.rs | 4 ++-- .../overflowclipbox_default_is_now_paddingbox.md | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 release-content/migration-guides/overflowclipbox_default_is_now_paddingbox.md diff --git a/crates/bevy_ui/src/ui_node.rs b/crates/bevy_ui/src/ui_node.rs index 2486296bac..55ce3eb6a2 100644 --- a/crates/bevy_ui/src/ui_node.rs +++ b/crates/bevy_ui/src/ui_node.rs @@ -1178,7 +1178,7 @@ pub struct OverflowClipMargin { impl OverflowClipMargin { pub const DEFAULT: Self = Self { - visual_box: OverflowClipBox::ContentBox, + visual_box: OverflowClipBox::PaddingBox, margin: 0., }; @@ -1224,9 +1224,9 @@ impl OverflowClipMargin { )] pub enum OverflowClipBox { /// Clip any content that overflows outside the content box - #[default] ContentBox, /// Clip any content that overflows outside the padding box + #[default] PaddingBox, /// Clip any content that overflows outside the border box BorderBox, diff --git a/release-content/migration-guides/overflowclipbox_default_is_now_paddingbox.md b/release-content/migration-guides/overflowclipbox_default_is_now_paddingbox.md new file mode 100644 index 0000000000..a733f7f775 --- /dev/null +++ b/release-content/migration-guides/overflowclipbox_default_is_now_paddingbox.md @@ -0,0 +1,7 @@ +--- +title: OverflowClipBox's default is now Paddingbox +pull_requests: [18935] +--- + +The default variant for `OverflowClipBox` is now `PaddingBox`. +The default value for `OverflowClipMargin::visual_box` is now `OverflowClipBox::PaddingBox`.