Parcourir la source

Windows: Scrollbar visibility decision uses current size when both size and contents size are submitted by API. (#7252)

ocornut il y a 1 an
Parent
commit
0573513d6d
3 fichiers modifiés avec 9 ajouts et 1 suppressions
  1. 2 0
      docs/CHANGELOG.txt
  2. 6 0
      imgui.cpp
  3. 1 1
      imgui.h

+ 2 - 0
docs/CHANGELOG.txt

@@ -41,6 +41,8 @@ HOW TO UPDATE?
 
 Other changes:
 
+- Windows: Scrollbar visibility decision uses current size when both size and contents
+  size are submitted by API. (#7252)
 - Menus, Popups: Fixed an issue where sibling menu popups re-opening in successive
   frames would erroneously close the window. While it is technically a popup issue
   it would generally manifest when fast moving the mouse bottom to top in a sub-menu.

+ 6 - 0
imgui.cpp

@@ -6610,8 +6610,14 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
         window->DC.MenuBarOffset.x = ImMax(ImMax(window->WindowPadding.x, style.ItemSpacing.x), g.NextWindowData.MenuBarOffsetMinVal.x);
         window->DC.MenuBarOffset.y = g.NextWindowData.MenuBarOffsetMinVal.y;
 
+        // Depending on condition we use previous or current window size to compare against contents size to decide if a scrollbar should be visible.
+        // Those flags will be altered further down in the function depending on more conditions.
         bool use_current_size_for_scrollbar_x = window_just_created;
         bool use_current_size_for_scrollbar_y = window_just_created;
+        if (window_size_x_set_by_api && window->ContentSizeExplicit.x != 0.0f)
+            use_current_size_for_scrollbar_x = true;
+        if (window_size_y_set_by_api && window->ContentSizeExplicit.y != 0.0f) // #7252
+            use_current_size_for_scrollbar_y = true;
 
         // Collapse window by double-clicking on title bar
         // At this point we don't have a clipping rectangle setup yet, so we can use the title bar area for hit detection and drawing

+ 1 - 1
imgui.h

@@ -24,7 +24,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.5 WIP"
-#define IMGUI_VERSION_NUM   19042
+#define IMGUI_VERSION_NUM   19043
 #define IMGUI_HAS_TABLE
 
 /*