-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenA-UIGraphical user interfaces, styles, layouts, and widgetsGraphical user interfaces, styles, layouts, and widgetsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorS-Needs-DesignThis issue requires design work to think about how it would best be accomplishedThis issue requires design work to think about how it would best be accomplished
Description
Bevy version and features
0.17.2
What you did
spawn a parent node with a BorderRadius and Overflow::hidden or clip. the child sides are still shown outside the parent node sides.
What you expected
the child red node borders would be clipped since its parent has overflow hidden, so that none of the child goes outside o the parent
use bevy::{color::palettes::css, prelude::*};
fn main() -> AppExit {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup_ui)
.run()
}
fn setup_ui(mut commands: Commands) {
commands.spawn(Camera2d);
commands.spawn((
Node {
width: Val::Percent(100.0),
height: Val::Percent(100.0),
display: Display::Flex,
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
..default()
},
children![(
Node {
width: Val::Percent(50.),
height: Val::Percent(50.),
overflow: Overflow::hidden(),
..default()
},
BackgroundColor(Color::WHITE),
BorderRadius::all(Val::Percent(25.0)),
children![(
Node {
width: Val::Percent(100.0),
height: Val::Percent(100.0),
..default()
},
BackgroundColor(css::RED.with_alpha(0.5).into()),
)]
)],
));
}

Metadata
Metadata
Assignees
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenA-UIGraphical user interfaces, styles, layouts, and widgetsGraphical user interfaces, styles, layouts, and widgetsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorS-Needs-DesignThis issue requires design work to think about how it would best be accomplishedThis issue requires design work to think about how it would best be accomplished