mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-29 23:06:35 +00: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:
parent
4b2781fe87
commit
c0547d358d
@ -3925,12 +3925,13 @@ static ImVec2 CalcSizeAutoFit(ImGuiWindow* window)
|
||||
}
|
||||
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));
|
||||
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;
|
||||
if (size_auto_fit.y < window->SizeContents.y && !(flags & ImGuiWindowFlags_NoScrollbar))
|
||||
size_auto_fit.x += style.ScrollbarSize;
|
||||
if (size_auto_fit_after_constraint.y < window->SizeContents.y && !(flags & ImGuiWindowFlags_NoScrollbar))
|
||||
size_auto_fit.x += style.ScrollbarSize * 2.0f;
|
||||
size_auto_fit.y = ImMax(size_auto_fit.y - style.ItemSpacing.y, 0.0f);
|
||||
}
|
||||
return size_auto_fit;
|
||||
|
Loading…
Reference in New Issue
Block a user