Skip to content

Commit 7e549aa

Browse files
committed
Fix rtl on follow focus
Change right_margin to side_margin
1 parent e25f3c0 commit 7e549aa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scene/gui/scroll_container.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,10 @@ void ScrollContainer::ensure_control_visible(Control *p_control) {
279279

280280
Rect2 global_rect = get_global_rect();
281281
Rect2 other_rect = p_control->get_global_rect();
282-
float right_margin = v_scroll->is_visible() ? v_scroll->get_size().x : 0.0f;
282+
float side_margin = v_scroll->is_visible() ? v_scroll->get_size().x : 0.0f;
283283
float bottom_margin = h_scroll->is_visible() ? h_scroll->get_size().y : 0.0f;
284284

285-
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)),
285+
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)),
286286
MAX(MIN(other_rect.position.y, global_rect.position.y), other_rect.position.y + other_rect.size.y - global_rect.size.y + bottom_margin));
287287

288288
set_h_scroll(get_h_scroll() + (diff.x - global_rect.position.x));

0 commit comments

Comments
 (0)