Tabs: fixed tab bar underline not drawing below scroll buttons. (#6820, #4859, #5022, #5239)

Fix ef8ff1b5d8 which accidentally meant we are using BarRect after it may have been modified by TabBarScrollingButtons().
This commit is contained in:
ocornut
2025-07-31 22:04:01 +09:00
parent a0cdac48e0
commit 046a8eae0f
2 changed files with 5 additions and 3 deletions

View File

@@ -51,6 +51,8 @@ Other Changes:
often more convenient to use index in caller-code, whereas TableGetRowIndex() often more convenient to use index in caller-code, whereas TableGetRowIndex()
includes header rows). includes header rows).
- Tables: fixed imgui_internal.h's TableGetHoveredRow() the same way. (#7350, #6588, #6250) - Tables: fixed imgui_internal.h's TableGetHoveredRow() the same way. (#7350, #6588, #6250)
- Tabs: fixed tab bar underline not drawing below scroll buttons, when
they are enabled (minor regression from 1.90). (#6820, #4859, #5022, #5239)
- Error Handling: minor improvements to error handling for TableGetSortSpecs() - Error Handling: minor improvements to error handling for TableGetSortSpecs()
and TableSetBgColor() calls. (#1651, #8499) and TableSetBgColor() calls. (#1651, #8499)
- Misc: fixed building with IMGUI_DISABLE_DEBUG_TOOLS only. (#8796) - Misc: fixed building with IMGUI_DISABLE_DEBUG_TOOLS only. (#8796)

View File

@@ -9429,8 +9429,8 @@ bool ImGui::BeginTabBar(const char* str_id, ImGuiTabBarFlags flags)
ImGuiTabBar* tab_bar = g.TabBars.GetOrAddByKey(id); ImGuiTabBar* tab_bar = g.TabBars.GetOrAddByKey(id);
ImRect tab_bar_bb = ImRect(window->DC.CursorPos.x, window->DC.CursorPos.y, window->WorkRect.Max.x, window->DC.CursorPos.y + g.FontSize + g.Style.FramePadding.y * 2); ImRect tab_bar_bb = ImRect(window->DC.CursorPos.x, window->DC.CursorPos.y, window->WorkRect.Max.x, window->DC.CursorPos.y + g.FontSize + g.Style.FramePadding.y * 2);
tab_bar->ID = id; tab_bar->ID = id;
tab_bar->SeparatorMinX = tab_bar->BarRect.Min.x - IM_TRUNC(window->WindowPadding.x * 0.5f); tab_bar->SeparatorMinX = tab_bar_bb.x - IM_TRUNC(window->WindowPadding.x * 0.5f);
tab_bar->SeparatorMaxX = tab_bar->BarRect.Max.x + IM_TRUNC(window->WindowPadding.x * 0.5f); tab_bar->SeparatorMaxX = tab_bar_bb.x + IM_TRUNC(window->WindowPadding.x * 0.5f);
//if (g.NavWindow && IsWindowChildOf(g.NavWindow, window, false, false)) //if (g.NavWindow && IsWindowChildOf(g.NavWindow, window, false, false))
flags |= ImGuiTabBarFlags_IsFocused; flags |= ImGuiTabBarFlags_IsFocused;
return BeginTabBarEx(tab_bar, tab_bar_bb, flags); return BeginTabBarEx(tab_bar, tab_bar_bb, flags);
@@ -9668,7 +9668,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
tab_bar->WidthAllTabsIdeal += sections[section_n].Width + sections[section_n].Spacing; tab_bar->WidthAllTabsIdeal += sections[section_n].Width + sections[section_n].Spacing;
// Horizontal scrolling buttons // Horizontal scrolling buttons
// (note that TabBarScrollButtons() will alter BarRect.Max.x) // Important: note that TabBarScrollButtons() will alter BarRect.Max.x.
if ((tab_bar->WidthAllTabsIdeal > tab_bar->BarRect.GetWidth() && tab_bar->Tabs.Size > 1) && !(tab_bar->Flags & ImGuiTabBarFlags_NoTabListScrollingButtons) && (tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyScroll)) if ((tab_bar->WidthAllTabsIdeal > tab_bar->BarRect.GetWidth() && tab_bar->Tabs.Size > 1) && !(tab_bar->Flags & ImGuiTabBarFlags_NoTabListScrollingButtons) && (tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyScroll))
if (ImGuiTabItem* scroll_and_select_tab = TabBarScrollingButtons(tab_bar)) if (ImGuiTabItem* scroll_and_select_tab = TabBarScrollingButtons(tab_bar))
{ {