TabBar: Fixed single tab shrinking reducing the tab to 0.0f size. Broken by a856c670c1.

This commit is contained in:
omar 2019-09-22 22:16:05 +02:00
parent f47a0a85cc
commit 80b3ab7d3e

View File

@ -1366,7 +1366,7 @@ void ImGui::ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_exc
{
if (count == 1)
{
items[0].Width -= width_excess;
items[0].Width = ImMax(items[0].Width - width_excess, 1.0f);
return;
}
ImQsort(items, (size_t)count, sizeof(ImGuiShrinkWidthItem), ShrinkWidthItemComparer);
@ -6562,6 +6562,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
{
ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
tab->Width = ImMin(tab->WidthContents, tab_max_width);
IM_ASSERT(tab->Width > 0.0f);
}
}