Skip to content

Commit 25c4caa

Browse files
committed
Merge pull request godotengine#97209 from kitbdev/fix-tab-container-ensure-visible-offset
Fix TabContainer tab offset moving when not needed
2 parents 5070db2 + 3d6814e commit 25c4caa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

scene/gui/tab_container.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,14 @@ void TabContainer::_repaint() {
267267
Vector<Control *> controls = _get_tab_controls();
268268
int current = get_current_tab();
269269

270+
// Move the TabBar to the top or bottom.
271+
// Don't change the left and right offsets since the TabBar will resize and may change tab offset.
270272
if (tabs_position == POSITION_BOTTOM) {
271-
tab_bar->set_anchors_and_offsets_preset(PRESET_BOTTOM_WIDE);
273+
tab_bar->set_anchor_and_offset(SIDE_BOTTOM, 1.0, 0.0);
274+
tab_bar->set_anchor_and_offset(SIDE_TOP, 1.0, -_get_tab_height());
272275
} else {
273-
tab_bar->set_anchors_and_offsets_preset(PRESET_TOP_WIDE);
276+
tab_bar->set_anchor_and_offset(SIDE_BOTTOM, 0.0, _get_tab_height());
277+
tab_bar->set_anchor_and_offset(SIDE_TOP, 0.0, 0.0);
274278
}
275279

276280
updating_visibility = true;
@@ -299,7 +303,6 @@ void TabContainer::_repaint() {
299303
}
300304
updating_visibility = false;
301305

302-
_update_margins();
303306
update_minimum_size();
304307
}
305308

0 commit comments

Comments
 (0)