mirror of
https://github.com/ocornut/imgui.git
synced 2025-12-20 13:25:39 +00:00
Windows: move auto-fit block into braces for clarify. (no-op)
This commit is contained in:
58
imgui.cpp
58
imgui.cpp
@@ -7573,36 +7573,38 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
// - Using SetNextWindowSize() overrides ImGuiWindowFlags_AlwaysAutoResize, so it can be used on tooltips/popups, etc.
|
// - Using SetNextWindowSize() overrides ImGuiWindowFlags_AlwaysAutoResize, so it can be used on tooltips/popups, etc.
|
||||||
// - We still process initial auto-fit on collapsed windows to get a window width, but otherwise don't honor ImGuiWindowFlags_AlwaysAutoResize when collapsed.
|
// - We still process initial auto-fit on collapsed windows to get a window width, but otherwise don't honor ImGuiWindowFlags_AlwaysAutoResize when collapsed.
|
||||||
// - Auto-fit may only grow window during the first few frames.
|
// - Auto-fit may only grow window during the first few frames.
|
||||||
const bool size_auto_fit_x_always = !window_size_x_set_by_api && (flags & ImGuiWindowFlags_AlwaysAutoResize) && !window->Collapsed;
|
{
|
||||||
const bool size_auto_fit_y_always = !window_size_y_set_by_api && (flags & ImGuiWindowFlags_AlwaysAutoResize) && !window->Collapsed;
|
const bool size_auto_fit_x_always = !window_size_x_set_by_api && (flags & ImGuiWindowFlags_AlwaysAutoResize) && !window->Collapsed;
|
||||||
const bool size_auto_fit_x_current = !window_size_x_set_by_api && (window->AutoFitFramesX > 0);
|
const bool size_auto_fit_y_always = !window_size_y_set_by_api && (flags & ImGuiWindowFlags_AlwaysAutoResize) && !window->Collapsed;
|
||||||
const bool size_auto_fit_y_current = !window_size_y_set_by_api && (window->AutoFitFramesY > 0);
|
const bool size_auto_fit_x_current = !window_size_x_set_by_api && (window->AutoFitFramesX > 0);
|
||||||
int size_auto_fit_mask = 0;
|
const bool size_auto_fit_y_current = !window_size_y_set_by_api && (window->AutoFitFramesY > 0);
|
||||||
if (size_auto_fit_x_always || size_auto_fit_x_current)
|
int size_auto_fit_mask = 0;
|
||||||
size_auto_fit_mask |= (1 << ImGuiAxis_X);
|
if (size_auto_fit_x_always || size_auto_fit_x_current)
|
||||||
if (size_auto_fit_y_always || size_auto_fit_y_current)
|
size_auto_fit_mask |= (1 << ImGuiAxis_X);
|
||||||
size_auto_fit_mask |= (1 << ImGuiAxis_Y);
|
if (size_auto_fit_y_always || size_auto_fit_y_current)
|
||||||
const ImVec2 size_auto_fit = CalcWindowAutoFitSize(window, window->ContentSizeIdeal, size_auto_fit_mask);
|
size_auto_fit_mask |= (1 << ImGuiAxis_Y);
|
||||||
|
const ImVec2 size_auto_fit = CalcWindowAutoFitSize(window, window->ContentSizeIdeal, size_auto_fit_mask);
|
||||||
|
|
||||||
const ImVec2 old_size = window->SizeFull;
|
const ImVec2 old_size = window->SizeFull;
|
||||||
if (size_auto_fit_x_always || size_auto_fit_x_current)
|
if (size_auto_fit_x_always || size_auto_fit_x_current)
|
||||||
{
|
{
|
||||||
if (size_auto_fit_x_always)
|
if (size_auto_fit_x_always)
|
||||||
window->SizeFull.x = size_auto_fit.x;
|
window->SizeFull.x = size_auto_fit.x;
|
||||||
else
|
else
|
||||||
window->SizeFull.x = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.x, size_auto_fit.x) : size_auto_fit.x;
|
window->SizeFull.x = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.x, size_auto_fit.x) : size_auto_fit.x;
|
||||||
use_current_size_for_scrollbar_x = true;
|
use_current_size_for_scrollbar_x = true;
|
||||||
|
}
|
||||||
|
if (size_auto_fit_y_always || size_auto_fit_y_current)
|
||||||
|
{
|
||||||
|
if (size_auto_fit_y_always)
|
||||||
|
window->SizeFull.y = size_auto_fit.y;
|
||||||
|
else
|
||||||
|
window->SizeFull.y = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.y, size_auto_fit.y) : size_auto_fit.y;
|
||||||
|
use_current_size_for_scrollbar_y = true;
|
||||||
|
}
|
||||||
|
if (old_size.x != window->SizeFull.x || old_size.y != window->SizeFull.y)
|
||||||
|
MarkIniSettingsDirty(window);
|
||||||
}
|
}
|
||||||
if (size_auto_fit_y_always || size_auto_fit_y_current)
|
|
||||||
{
|
|
||||||
if (size_auto_fit_y_always)
|
|
||||||
window->SizeFull.y = size_auto_fit.y;
|
|
||||||
else
|
|
||||||
window->SizeFull.y = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.y, size_auto_fit.y) : size_auto_fit.y;
|
|
||||||
use_current_size_for_scrollbar_y = true;
|
|
||||||
}
|
|
||||||
if (old_size.x != window->SizeFull.x || old_size.y != window->SizeFull.y)
|
|
||||||
MarkIniSettingsDirty(window);
|
|
||||||
|
|
||||||
// Apply minimum/maximum window size constraints and final size
|
// Apply minimum/maximum window size constraints and final size
|
||||||
window->SizeFull = CalcWindowSizeAfterConstraint(window, window->SizeFull);
|
window->SizeFull = CalcWindowSizeAfterConstraint(window, window->SizeFull);
|
||||||
|
|||||||
Reference in New Issue
Block a user