bevy
bevy copied to clipboard
Wrong Ui Node Position when using Val::Percent with bigger UiScale
Bevy version
What you did
Spawned a NodeBundle with some values based on Percent.
commands.spawn(NodeBundle {
style: Style {
position_type: PositionType::Absolute,
height: Val::Percent(50.),
width: Val::Percent(50.),
right: Val::Percent(0.),
..Default::default()
},
background_color: BackgroundColor(Color::WHITE),
..Default::default()
});
What went wrong
The size is not as expected, for example, if I have Style::right as Val::Percent(0.), I expect that the Node were in the border of the window
Result images with different `UiScale` (The number at the bottom is the actual scale)
Additional information
This is related to how the ui_layout_system round the Positions, together with the fact that the Camera is also transformed by the scale, causes a situation where the rounding causes big gaps.
Also related to #11207