mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-04 07:01:04 +01:00 
			
		
		
		
	Window: fixed auto-fit calculation mismatch of whether a scrollbar will be added by maximum height clamping.
Also honor NoScrollBar in the case of height clamping, not adding extra horizontal space.
This commit is contained in:
		@@ -3425,15 +3425,16 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        // Calculate auto-fit size
 | 
					        // Calculate auto-fit size
 | 
				
			||||||
        ImVec2 size_auto_fit;
 | 
					        ImVec2 size_auto_fit;
 | 
				
			||||||
 | 
					        ImVec2 window_padding = window->WindowPadding();
 | 
				
			||||||
        if ((flags & ImGuiWindowFlags_Tooltip) != 0)
 | 
					        if ((flags & ImGuiWindowFlags_Tooltip) != 0)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            // Tooltip always resize. We keep the spacing symmetric on both axises for aesthetic purpose.
 | 
					            // Tooltip always resize. We keep the spacing symmetric on both axises for aesthetic purpose.
 | 
				
			||||||
            size_auto_fit = window->SizeContents + style.WindowPadding - ImVec2(0.0f, style.ItemSpacing.y);
 | 
					            size_auto_fit = window->SizeContents + window_padding - ImVec2(0.0f, style.ItemSpacing.y);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            size_auto_fit = ImClamp(window->SizeContents + style.WindowPadding, style.WindowMinSize, ImMax(style.WindowMinSize, g.IO.DisplaySize - style.WindowPadding));
 | 
					            size_auto_fit = ImClamp(window->SizeContents + window_padding, style.WindowMinSize, ImMax(style.WindowMinSize, g.IO.DisplaySize - window_padding));
 | 
				
			||||||
            if (size_auto_fit.y < window->SizeContents.y + style.WindowPadding.y)
 | 
					            if (size_auto_fit.y < window->SizeContents.y && !(flags & ImGuiWindowFlags_NoScrollbar))
 | 
				
			||||||
                size_auto_fit.x += style.ScrollbarWidth;
 | 
					                size_auto_fit.x += style.ScrollbarWidth;
 | 
				
			||||||
            size_auto_fit.y -= style.ItemSpacing.y;
 | 
					            size_auto_fit.y -= style.ItemSpacing.y;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user