Skip to content

Commit 21b62d6

Browse files
authored
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
1 parent 3631a64 commit 21b62d6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

crates/bevy_ui/src/ui_node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ pub struct OverflowClipMargin {
11781178

11791179
impl OverflowClipMargin {
11801180
pub const DEFAULT: Self = Self {
1181-
visual_box: OverflowClipBox::ContentBox,
1181+
visual_box: OverflowClipBox::PaddingBox,
11821182
margin: 0.,
11831183
};
11841184

@@ -1224,9 +1224,9 @@ impl OverflowClipMargin {
12241224
)]
12251225
pub enum OverflowClipBox {
12261226
/// Clip any content that overflows outside the content box
1227-
#[default]
12281227
ContentBox,
12291228
/// Clip any content that overflows outside the padding box
1229+
#[default]
12301230
PaddingBox,
12311231
/// Clip any content that overflows outside the border box
12321232
BorderBox,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: OverflowClipBox's default is now Paddingbox
3+
pull_requests: [18935]
4+
---
5+
6+
The default variant for `OverflowClipBox` is now `PaddingBox`.
7+
The default value for `OverflowClipMargin::visual_box` is now `OverflowClipBox::PaddingBox`.

0 commit comments

Comments
 (0)