From 0ea4408fd462366cb2f1977064af869fb826f0b3 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 14 Jan 2021 15:56:23 +0100 Subject: [PATCH] Tab Bar: Requested ideal content size (for auto-fit) doesn't affect horizontal scrolling. Followup to afa01d8. (#3414) + minor Table rename --- docs/CHANGELOG.txt | 3 ++- imgui_widgets.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 6b1616c3..8452078b 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -81,6 +81,7 @@ Other Changes: - Tab Bar: Fixed using more than 128 tabs in a tab bar (scrolling policy recommended). - Tab Bar: Do not display a tooltip if the name already fits over a given tab. (#3521) - Tab Bar: Fixed minor/unlikely bug skipping over a button when scrolling left with arrows. +- Tab Bar: Requested ideal content size (for auto-fit) doesn't affect horizontal scrolling. (#3414) - Drag and Drop: Fix losing drop source ActiveID (and often source tooltip) when opening a TreeNode() or CollapsingHeader() while dragging. (#1738) - Drag and Drop: Fix drag and drop to tie same-size drop targets by choosen the later one. Fixes dragging @@ -90,7 +91,7 @@ Other Changes: - InputText: Fixed updating cursor/selection position when a callback altered the buffer in a way where the byte count is unchanged but the decoded character count changes. (#3587) [@gqw] - InputText: Fixed swiching from single to multi-line while preserving same ID. -- Fixed using IsItemEdited() after Combo() not matching the return value from Combo(). (#2034) +- Combo: Fixed using IsItemEdited() after Combo() not matching the return value from Combo(). (#2034) - Nav: Fixed IsItemFocused() from returning false when Nav highlight is hidden because mouse has moved. It's essentially been always the case but it doesn't make much sense. Instead we will aim at exposing feedback and control of keyboard/gamepad navigation highlight and mouse hover disable flag. (#787, #2048) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 80fed60a..40618ecd 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -7241,7 +7241,8 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) // Actual layout in host window (we don't do it in BeginTabBar() so as not to waste an extra frame) ImGuiWindow* window = g.CurrentWindow; window->DC.CursorPos = tab_bar->BarRect.Min; - ItemSize(ImVec2(tab_bar->WidthAllTabsIdeal, tab_bar->BarRect.GetHeight()), tab_bar->FramePadding.y); + ItemSize(tab_bar->BarRect.GetSize(), tab_bar->FramePadding.y); + window->DC.IdealMaxPos.x = ImMax(window->DC.IdealMaxPos.x, tab_bar->BarRect.Min.x + tab_bar->WidthAllTabsIdeal); } // Dockables uses Name/ID in the global namespace. Non-dockable items use the ID stack.