From 6cefd4fd88c47884933c828e3ad725f7675c52f7 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 3 Jun 2024 16:41:19 +0200 Subject: [PATCH] Scrollbar: fixed miscalculation of vertical scrollbar visibility when required solely by the presence of an horizontal scrollbar. (#1574) Initially fixed by 2d9d7a10c, and broken back by a0994d74c2 (v1.71, wow). --- docs/CHANGELOG.txt | 2 ++ imgui.cpp | 2 +- imgui.h | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 3b4ff8238..0c5550f99 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -47,6 +47,8 @@ Other changes: responsible for honoring io.ConfigWindowsMoveFromTitleBarOnly. (#7576, #899) - Scrollbar: made scrolling logic more standard: clicking above or below the grab scrolls by one page, holding mouse button repeats scrolling. (#7328, #150) +- Scrollbar: fixed miscalculation of vertical scrollbar visibility when required + solely by the presence of an horizontal scrollbar. (#1574) - Combo: simplified Combo() API uses a list clipper (due to its api it wasn't previously trivial before we added clipper.IncludeItemByIndex() function). - Disabled: nested tooltips or other non-child window within a BeginDisabled() diff --git a/imgui.cpp b/imgui.cpp index a4a578c6f..96a0ca118 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -6926,7 +6926,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->ScrollbarY = (flags & ImGuiWindowFlags_AlwaysVerticalScrollbar) || ((needed_size_from_last_frame.y > size_y_for_scrollbars) && !(flags & ImGuiWindowFlags_NoScrollbar)); window->ScrollbarX = (flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar) || ((needed_size_from_last_frame.x > size_x_for_scrollbars - (window->ScrollbarY ? style.ScrollbarSize : 0.0f)) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar)); if (window->ScrollbarX && !window->ScrollbarY) - window->ScrollbarY = (needed_size_from_last_frame.y > size_y_for_scrollbars) && !(flags & ImGuiWindowFlags_NoScrollbar); + window->ScrollbarY = (needed_size_from_last_frame.y > size_y_for_scrollbars - style.ScrollbarSize) && !(flags & ImGuiWindowFlags_NoScrollbar); window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f); // Amend the partially filled window->DecorationXXX values. diff --git a/imgui.h b/imgui.h index 689604ba4..477cf4b5f 100644 --- a/imgui.h +++ b/imgui.h @@ -28,7 +28,7 @@ // Library Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345') #define IMGUI_VERSION "1.90.8 WIP" -#define IMGUI_VERSION_NUM 19073 +#define IMGUI_VERSION_NUM 19074 #define IMGUI_HAS_TABLE /*