Skip to content

Commit 9edfd73

Browse files
Accept commit suggestion
Co-authored-by: A Thousand Ships <[email protected]>
1 parent 3630b97 commit 9edfd73

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

scene/gui/tab_bar.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -532,21 +532,19 @@ void TabBar::_notification(int p_what) {
532532
x = tab_rect.position.x;
533533
}
534534
}
535+
} else if (get_local_mouse_position().x > tab_rect.position.x + tab_rect.size.width / 2) {
536+
if (closest_tab < max_drawn_tab) { // On right side of closest_tab and not last tab.
537+
Rect2 next_tab_rect = get_tab_rect(closest_tab + 1);
538+
x = (tab_rect.position.x + tab_rect.size.width + next_tab_rect.position.x) / 2;
539+
} else { // Last tab, will appear on right edge.
540+
x = tab_rect.position.x + tab_rect.size.width;
541+
}
535542
} else {
536-
if (get_local_mouse_position().x > tab_rect.position.x + tab_rect.size.width / 2) {
537-
if (closest_tab < max_drawn_tab) { // On right side of closest_tab and not last tab
538-
Rect2 next_tab_rect = get_tab_rect(closest_tab + 1);
539-
x = (tab_rect.position.x + tab_rect.size.width + next_tab_rect.position.x) / 2;
540-
} else { // Last tab, will appear on right edge
541-
x = tab_rect.position.x + tab_rect.size.width;
542-
}
543-
} else {
544-
if (closest_tab > 0) { // On left side of closest_tab and not first tab
545-
Rect2 prev_tab_rect = get_tab_rect(closest_tab - 1);
546-
x = (tab_rect.position.x + prev_tab_rect.position.x + prev_tab_rect.size.width) / 2;
547-
} else { // First tab, will appear on left edge
548-
x = tab_rect.position.x;
549-
}
543+
if (closest_tab > 0) { // On left side of closest_tab and not first tab.
544+
Rect2 prev_tab_rect = get_tab_rect(closest_tab - 1);
545+
x = (tab_rect.position.x + prev_tab_rect.position.x + prev_tab_rect.size.width) / 2;
546+
} else { // First tab, will appear on left edge.
547+
x = tab_rect.position.x;
550548
}
551549
}
552550
} else {

0 commit comments

Comments
 (0)