summaryrefslogtreecommitdiffstats
path: root/scene/gui
diff options
context:
space:
mode:
authorGiganzo <158825920+Giganzo@users.noreply.github.com>2024-07-22 14:25:53 +0200
committerGiganzo <158825920+Giganzo@users.noreply.github.com>2024-07-23 10:29:55 +0200
commit7e549aa52e2d5c2f4a893907937a052d57cb33b0 (patch)
tree744eaec24c8f250af497a2e1f052f49d3bd35409 /scene/gui
parente25f3c0d38d457b15a63720240736f564ce0501b (diff)
downloadredot-engine-7e549aa52e2d5c2f4a893907937a052d57cb33b0.tar.gz
Fix rtl on follow focus
Change right_margin to side_margin
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/scroll_container.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index 66f18f1c14..d96809b67a 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -279,10 +279,10 @@ void ScrollContainer::ensure_control_visible(Control *p_control) {
Rect2 global_rect = get_global_rect();
Rect2 other_rect = p_control->get_global_rect();
- float right_margin = v_scroll->is_visible() ? v_scroll->get_size().x : 0.0f;
+ float side_margin = v_scroll->is_visible() ? v_scroll->get_size().x : 0.0f;
float bottom_margin = h_scroll->is_visible() ? h_scroll->get_size().y : 0.0f;
- Vector2 diff = Vector2(MAX(MIN(other_rect.position.x, global_rect.position.x), other_rect.position.x + other_rect.size.x - global_rect.size.x + (!is_layout_rtl() ? right_margin : 0.0f)),
+ Vector2 diff = Vector2(MAX(MIN(other_rect.position.x - (is_layout_rtl() ? side_margin : 0.0f), global_rect.position.x), other_rect.position.x + other_rect.size.x - global_rect.size.x + (!is_layout_rtl() ? side_margin : 0.0f)),
MAX(MIN(other_rect.position.y, global_rect.position.y), other_rect.position.y + other_rect.size.y - global_rect.size.y + bottom_margin));
set_h_scroll(get_h_scroll() + (diff.x - global_rect.position.x));