mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-30 20:51:06 +01:00 
			
		
		
		
	Window: Fixed one case where auto-resize by double-clicking the resize grip would make either scrollbar appear for a single frame after the resize. Moved Scrollbar visibility block.
This commit is contained in:
		| @@ -42,6 +42,8 @@ Other Changes: | ||||
|   will always allow submitting a 100x100 item without creating a scrollbar, regarding of WindowPadding. | ||||
|   The exact meaning of ContentSize for decorated windows was previously ill-defined. | ||||
| - Window: Fixed auto-resize with AlwaysVerticalScrollbar or AlwaysHorizontalScrollbar flags. | ||||
| - Window: Fixed one case where auto-resize by double-clicking the resize grip would make either scrollbar | ||||
|   appear for a single frame after the resize. | ||||
| - Columns: Fixed Separator from creating an extraneous draw command. (#125) | ||||
| - Columns: Fixed Selectable with SpanAllColumns flag from creating an extraneous draw command. (#125) | ||||
| - Separator: Revert 1.70 "Declare its thickness (1.0f) to the layout" change. It's not incorrect | ||||
|   | ||||
							
								
								
									
										20
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								imgui.cpp
									
									
									
									
									
								
							| @@ -1077,7 +1077,7 @@ static int              FindWindowFocusIndex(ImGuiWindow* window); | ||||
| // Misc | ||||
| static void             UpdateMouseInputs(); | ||||
| static void             UpdateMouseWheel(); | ||||
| static void             UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4]); | ||||
| static bool             UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4]); | ||||
| static void             RenderWindowOuterBorders(ImGuiWindow* window); | ||||
| static void             RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size); | ||||
| static void             RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& title_bar_rect, const char* name, bool* p_open); | ||||
| @@ -4829,15 +4829,18 @@ static ImRect GetResizeBorderRect(ImGuiWindow* window, int border_n, float perp_ | ||||
| } | ||||
|  | ||||
| // Handle resize for: Resize Grips, Borders, Gamepad | ||||
| static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4]) | ||||
| // Return true when using auto-fit (double click on resize grip) | ||||
| static bool ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4]) | ||||
| { | ||||
|     ImGuiContext& g = *GImGui; | ||||
|     ImGuiWindowFlags flags = window->Flags; | ||||
|     if ((flags & ImGuiWindowFlags_NoResize) || (flags & ImGuiWindowFlags_AlwaysAutoResize) || window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0) | ||||
|         return; | ||||
|     if (window->WasActive == false) // Early out to avoid running this code for e.g. an hidden implicit/fallback Debug window. | ||||
|         return; | ||||
|  | ||||
|     if ((flags & ImGuiWindowFlags_NoResize) || (flags & ImGuiWindowFlags_AlwaysAutoResize) || window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0) | ||||
|         return false; | ||||
|     if (window->WasActive == false) // Early out to avoid running this code for e.g. an hidden implicit/fallback Debug window. | ||||
|         return false; | ||||
|  | ||||
|     bool ret_auto_fit = false; | ||||
|     const int resize_border_count = g.IO.ConfigWindowsResizeFromEdges ? 4 : 0; | ||||
|     const float grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f); | ||||
|     const float grip_hover_inner_size = (float)(int)(grip_draw_size * 0.75f); | ||||
| @@ -4871,6 +4874,7 @@ static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_au | ||||
|         { | ||||
|             // Manual auto-fit when double-clicking | ||||
|             size_target = CalcSizeAfterConstraint(window, size_auto_fit); | ||||
|             ret_auto_fit = true; | ||||
|             ClearActiveID(); | ||||
|         } | ||||
|         else if (held) | ||||
| @@ -4945,6 +4949,7 @@ static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_au | ||||
|     window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main); | ||||
|  | ||||
|     window->Size = window->SizeFull; | ||||
|     return ret_auto_fit; | ||||
| } | ||||
|  | ||||
| static inline void ClampWindowRect(ImGuiWindow* window, const ImRect& rect, const ImVec2& padding) | ||||
| @@ -5478,7 +5483,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) | ||||
|         const int resize_grip_count = g.IO.ConfigWindowsResizeFromEdges ? 2 : 1; // 4 | ||||
|         const float resize_grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f); | ||||
|         if (!window->Collapsed) | ||||
|             UpdateManualResize(window, size_auto_fit, &border_held, resize_grip_count, &resize_grip_col[0]); | ||||
|             if (UpdateManualResize(window, size_auto_fit, &border_held, resize_grip_count, &resize_grip_col[0])) | ||||
|                 use_current_size_for_scrollbar_x = use_current_size_for_scrollbar_y = true; | ||||
|         window->ResizeBorderHeld = (signed char)border_held; | ||||
|  | ||||
|         // SCROLLBAR VISIBILITY | ||||
|   | ||||
		Reference in New Issue
	
	Block a user