Fix editor tabs control size for tab header when scroll bar is visible

#1135
This commit is contained in:
Wojtek Figat
2023-10-13 11:16:34 +02:00
parent 6cd45a58f8
commit d0fbf12b92

View File

@@ -191,6 +191,8 @@ namespace FlaxEditor.GUI.Tabs
get => _autoTabsSizeAuto; get => _autoTabsSizeAuto;
set set
{ {
if (_autoTabsSizeAuto == value)
return;
_autoTabsSizeAuto = value; _autoTabsSizeAuto = value;
PerformLayout(); PerformLayout();
} }
@@ -204,11 +206,11 @@ namespace FlaxEditor.GUI.Tabs
get => _orientation; get => _orientation;
set set
{ {
if (_orientation == value)
return;
_orientation = value; _orientation = value;
if (UseScroll) if (UseScroll)
TabsPanel.ScrollBars = _orientation == Orientation.Horizontal ? ScrollBars.Horizontal : ScrollBars.Vertical; TabsPanel.ScrollBars = _orientation == Orientation.Horizontal ? ScrollBars.Horizontal : ScrollBars.Vertical;
PerformLayout(); PerformLayout();
} }
} }
@@ -402,6 +404,14 @@ namespace FlaxEditor.GUI.Tabs
tabHeader.Size = tabsSize; tabHeader.Size = tabsSize;
} }
} }
else if (UseScroll)
{
// If scroll bar is visible it covers part of the tab header so include this in tab size to improve usability
if (_orientation == Orientation.Horizontal && TabsPanel.HScrollBar.Visible)
tabsSize.Y += TabsPanel.HScrollBar.Height;
else if (_orientation == Orientation.Vertical && TabsPanel.VScrollBar.Visible)
tabsSize.X += TabsPanel.VScrollBar.Width;
}
// Fit the tabs panel // Fit the tabs panel
TabsPanel.Size = _orientation == Orientation.Horizontal TabsPanel.Size = _orientation == Orientation.Horizontal