mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-23 04:17:00 +00:00
Allow popup from ignoring the style.WindowMinSize values so short menus are not padded. (#1909) Wider generalization of b16603745c
.
This commit is contained in:
parent
93950b8c32
commit
d11d211e5d
@ -5831,8 +5831,10 @@ static ImVec2 CalcSizeAutoFit(ImGuiWindow* window, const ImVec2& size_contents)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// When the window cannot fit all contents (either because of constraints, either because screen is too small): we are growing the size on the other axis to compensate for expected scrollbar. FIXME: Might turn bigger than DisplaySize-WindowPadding.
|
// When the window cannot fit all contents (either because of constraints, either because screen is too small): we are growing the size on the other axis to compensate for expected scrollbar. FIXME: Might turn bigger than DisplaySize-WindowPadding.
|
||||||
ImVec2 size_min(0.0f, 0.0f);
|
const bool is_popup = (window->Flags & ImGuiWindowFlags_Popup) != 0 && (window->Flags & ImGuiWindowFlags_AlwaysAutoResize) != 0;
|
||||||
if (!(window->Flags & ImGuiWindowFlags_ChildMenu))
|
const bool is_menu = (window->Flags & ImGuiWindowFlags_ChildMenu) != 0;
|
||||||
|
ImVec2 size_min(1.0f, 1.0f);
|
||||||
|
if (!is_popup && !is_menu)
|
||||||
size_min = style.WindowMinSize;
|
size_min = style.WindowMinSize;
|
||||||
ImVec2 size_auto_fit = ImClamp(size_contents, size_min, ImMax(size_min, g.IO.DisplaySize - style.DisplaySafeAreaPadding * 2.0f));
|
ImVec2 size_auto_fit = ImClamp(size_contents, size_min, ImMax(size_min, g.IO.DisplaySize - style.DisplaySafeAreaPadding * 2.0f));
|
||||||
ImVec2 size_auto_fit_after_constraint = CalcSizeAfterConstraint(window, size_auto_fit);
|
ImVec2 size_auto_fit_after_constraint = CalcSizeAfterConstraint(window, size_auto_fit);
|
||||||
|
Loading…
Reference in New Issue
Block a user