diff options
author | kit <kitbdev@gmail.com> | 2024-09-19 19:19:34 -0400 |
---|---|---|
committer | kit <kitbdev@gmail.com> | 2024-09-19 19:26:35 -0400 |
commit | 3d6814e5d2c9e7dc88d7f2ff3611236a1298fd8f (patch) | |
tree | 35d110d5b809a63a1ccb554ea95c3ee70bce843b /scene/gui/tab_container.cpp | |
parent | 0a4aedb36065f66fc7e99cb2e6de3e55242f9dfb (diff) | |
download | redot-engine-3d6814e5d2c9e7dc88d7f2ff3611236a1298fd8f.tar.gz |
Fix TabContainer tab offset moving when not needed
Diffstat (limited to 'scene/gui/tab_container.cpp')
-rw-r--r-- | scene/gui/tab_container.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 6e533aa5ab..eb9616c939 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -267,10 +267,14 @@ void TabContainer::_repaint() { Vector<Control *> controls = _get_tab_controls(); int current = get_current_tab(); + // Move the TabBar to the top or bottom. + // Don't change the left and right offsets since the TabBar will resize and may change tab offset. if (tabs_position == POSITION_BOTTOM) { - tab_bar->set_anchors_and_offsets_preset(PRESET_BOTTOM_WIDE); + tab_bar->set_anchor_and_offset(SIDE_BOTTOM, 1.0, 0.0); + tab_bar->set_anchor_and_offset(SIDE_TOP, 1.0, -_get_tab_height()); } else { - tab_bar->set_anchors_and_offsets_preset(PRESET_TOP_WIDE); + tab_bar->set_anchor_and_offset(SIDE_BOTTOM, 0.0, _get_tab_height()); + tab_bar->set_anchor_and_offset(SIDE_TOP, 0.0, 0.0); } updating_visibility = true; @@ -299,7 +303,6 @@ void TabContainer::_repaint() { } updating_visibility = false; - _update_margins(); update_minimum_size(); } |