Fixed scroll offset clamping to include scrollbar size.
This commit is contained in:
parent
931b8e29e0
commit
3e02fd4160
@ -327,20 +327,11 @@ with UI components as a child of an entity without UI components, your UI layout
|
|||||||
})
|
})
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
let max_possible_offset = (content_size - layout_size).max(Vec2::ZERO);
|
let max_possible_offset =
|
||||||
let clamped_scroll_position = scroll_position.clamp(
|
(content_size - layout_size + node.scrollbar_size).max(Vec2::ZERO);
|
||||||
Vec2::ZERO,
|
let clamped_scroll_position = scroll_position.clamp(Vec2::ZERO, max_possible_offset);
|
||||||
max_possible_offset * inverse_target_scale_factor,
|
|
||||||
);
|
|
||||||
|
|
||||||
if clamped_scroll_position != scroll_position {
|
let physical_scroll_position = clamped_scroll_position.floor();
|
||||||
commands
|
|
||||||
.entity(entity)
|
|
||||||
.insert(ScrollPosition(clamped_scroll_position));
|
|
||||||
}
|
|
||||||
|
|
||||||
let physical_scroll_position =
|
|
||||||
(clamped_scroll_position / inverse_target_scale_factor).round();
|
|
||||||
|
|
||||||
for child_uinode in ui_children.iter_ui_children(entity) {
|
for child_uinode in ui_children.iter_ui_children(entity) {
|
||||||
update_uinode_geometry_recursive(
|
update_uinode_geometry_recursive(
|
||||||
|
Loading…
Reference in New Issue
Block a user