mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 13:11:05 +01:00 
			
		
		
		
	Begin: Fixed auto-fit calculation code that predict the presence of ascrollbar so it works in the case size constraints are used. I actually don't need this fix now, but earlier experiment with BeginCombo() required this fix.
This commit is contained in:
		| @@ -3925,12 +3925,13 @@ static ImVec2 CalcSizeAutoFit(ImGuiWindow* window) | |||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
|         // Handling case of auto fit window not fitting in screen on one axis, we are growing auto fit size on the other axis to compensate for expected scrollbar. FIXME: Might turn bigger than DisplaySize-WindowPadding. |         // Handling case of auto fit window not fitting on the screen (on either axis): we are growing the size on the other axis to compensate for expected scrollbar. FIXME: Might turn bigger than DisplaySize-WindowPadding. | ||||||
|         size_auto_fit = ImClamp(window->SizeContents + window->WindowPadding, style.WindowMinSize, ImMax(style.WindowMinSize, g.IO.DisplaySize - g.Style.DisplaySafeAreaPadding)); |         size_auto_fit = ImClamp(window->SizeContents + window->WindowPadding, style.WindowMinSize, ImMax(style.WindowMinSize, g.IO.DisplaySize - g.Style.DisplaySafeAreaPadding)); | ||||||
|         if (size_auto_fit.x < window->SizeContents.x && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar)) |         ImVec2 size_auto_fit_after_constraint = CalcSizeFullWithConstraint(window, size_auto_fit); | ||||||
|  |         if (size_auto_fit_after_constraint.x < window->SizeContents.x && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar)) | ||||||
|             size_auto_fit.y += style.ScrollbarSize; |             size_auto_fit.y += style.ScrollbarSize; | ||||||
|         if (size_auto_fit.y < window->SizeContents.y && !(flags & ImGuiWindowFlags_NoScrollbar)) |         if (size_auto_fit_after_constraint.y < window->SizeContents.y && !(flags & ImGuiWindowFlags_NoScrollbar)) | ||||||
|             size_auto_fit.x += style.ScrollbarSize; |             size_auto_fit.x += style.ScrollbarSize * 2.0f; | ||||||
|         size_auto_fit.y = ImMax(size_auto_fit.y - style.ItemSpacing.y, 0.0f); |         size_auto_fit.y = ImMax(size_auto_fit.y - style.ItemSpacing.y, 0.0f); | ||||||
|     } |     } | ||||||
|     return size_auto_fit; |     return size_auto_fit; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user