mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-12 02:00:58 +01:00
Popups: Fixed resizable popup minimum size being too small. Standardized CalcWindowMinSize() logic a bit more. (#73290
Amende2035a514
,623bff23ce
,923535240
, etc.
This commit is contained in:
parent
014e0ac8c9
commit
e78ce72eb6
@ -45,6 +45,8 @@ Other changes:
|
||||
|
||||
- Menus, Popups: Fixed an issue where hovering a parent-menu upward would
|
||||
erroneously close the window. (#7325, #7287, #7063)
|
||||
- Popups: Fixed resizable popup minimum size being too small. Standardized minimum
|
||||
size logic. (#7329).
|
||||
- Tables: Angled headers: fixed support for multi-line labels. (#6917)
|
||||
- Tables: Angled headers: various fixes to accurately handle CellPadding changes. (#6917)
|
||||
- Tables: Angled headers: properly registers horizontal component of angled headers
|
||||
|
14
imgui.cpp
14
imgui.cpp
@ -5676,22 +5676,25 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags)
|
||||
|
||||
static inline ImVec2 CalcWindowMinSize(ImGuiWindow* window)
|
||||
{
|
||||
// Popups, menus and childs bypass style.WindowMinSize by default, but we give then a non-zero minimum size to facilitate understanding problematic cases (e.g. empty popups)
|
||||
// FIXME: the if/else could probably be removed, "reduce artifacts" section for all windows.
|
||||
// We give windows non-zero minimum size to facilitate understanding problematic cases (e.g. empty popups)
|
||||
// FIXME: Essentially we want to restrict manual resizing to WindowMinSize+Decoration, and allow api resizing to be smaller.
|
||||
// Perhaps should tend further a neater test for this.
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImVec2 size_min;
|
||||
if (window->Flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_ChildWindow))
|
||||
if ((window->Flags & ImGuiWindowFlags_ChildWindow) && !(window->Flags & ImGuiWindowFlags_Popup))
|
||||
{
|
||||
size_min.x = (window->ChildFlags & ImGuiChildFlags_ResizeX) ? g.Style.WindowMinSize.x : 4.0f;
|
||||
size_min.y = (window->ChildFlags & ImGuiChildFlags_ResizeY) ? g.Style.WindowMinSize.y : 4.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGuiWindow* window_for_height = window;
|
||||
size_min.x = ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) == 0) ? g.Style.WindowMinSize.x : 4.0f;
|
||||
size_min.y = ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) == 0) ? g.Style.WindowMinSize.y : 4.0f;
|
||||
size_min.y = ImMax(size_min.y, window_for_height->TitleBarHeight() + window_for_height->MenuBarHeight() + ImMax(0.0f, g.Style.WindowRounding - 1.0f)); // Reduce artifacts with very small windows
|
||||
}
|
||||
|
||||
// Reduce artifacts with very small windows
|
||||
ImGuiWindow* window_for_height = window;
|
||||
size_min.y = ImMax(size_min.y, window_for_height->TitleBarHeight() + window_for_height->MenuBarHeight() + ImMax(0.0f, g.Style.WindowRounding - 1.0f));
|
||||
return size_min;
|
||||
}
|
||||
|
||||
@ -6755,6 +6758,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
#endif
|
||||
|
||||
// Handle manual resize: Resize Grips, Borders, Gamepad
|
||||
// FIXME: _ChildWindow + _Popup windows may want resize grips.
|
||||
int border_hovered = -1, border_held = -1;
|
||||
ImU32 resize_grip_col[4] = {};
|
||||
const int resize_grip_count = (window->Flags & ImGuiWindowFlags_ChildWindow) ? 0 : g.IO.ConfigWindowsResizeFromEdges ? 2 : 1; // Allow resize from lower-left if we have the mouse cursor feedback for it.
|
||||
|
Loading…
Reference in New Issue
Block a user