Fix TabBar minimum size with clip_tabs on

This commit is contained in:
Logan Detrick 2025-07-13 15:48:22 -07:00
parent c6d130abd9
commit 88280a6b2a
3 changed files with 17 additions and 11 deletions

View file

@ -44,6 +44,7 @@ Size2 TabBar::get_minimum_size() const {
}
int y_margin = MAX(MAX(MAX(theme_cache.tab_unselected_style->get_minimum_size().height, theme_cache.tab_hovered_style->get_minimum_size().height), theme_cache.tab_selected_style->get_minimum_size().height), theme_cache.tab_disabled_style->get_minimum_size().height);
int max_tab_width = 0;
for (int i = 0; i < tabs.size(); i++) {
if (tabs[i].hidden) {
@ -102,10 +103,14 @@ Size2 TabBar::get_minimum_size() const {
if (i < tabs.size() - 1) {
ms.width += theme_cache.tab_separation;
}
if (ms.width - ofs > max_tab_width) {
max_tab_width = ms.width - ofs;
}
}
if (clip_tabs) {
ms.width = 0;
ms.width = max_tab_width + (get_tab_count() > 1 ? theme_cache.decrement_icon->get_width() + theme_cache.increment_icon->get_width() : 0);
}
return ms;