bevyengine / bevyengine/bevy

UI Node children overflow with BorderRadius

Open
#21,449 3 comments 2 reactions 0 assignees View on GitHub
A-Rendering A-UI C-Bug S-Needs-Design
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

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

```rust
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()),
)]
)],
));
}

```

Image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.