mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Internals: added IsWindowAbove() for use for modal/viewport bugfix.
This commit is contained in:
parent
cecf6b4209
commit
3dcbcd8bf0
26
imgui.cpp
26
imgui.cpp
@ -3571,17 +3571,7 @@ void ImGui::UpdateMouseMovingWindowEndFrame()
|
||||
// Find the top-most window between HoveredWindow and the top-most Modal Window.
|
||||
// This is where we can trim the popup stack.
|
||||
ImGuiWindow* modal = GetTopMostPopupModal();
|
||||
bool hovered_window_above_modal = false;
|
||||
if (modal == NULL)
|
||||
hovered_window_above_modal = true;
|
||||
for (int i = g.Windows.Size - 1; i >= 0 && hovered_window_above_modal == false; i--)
|
||||
{
|
||||
ImGuiWindow* window = g.Windows[i];
|
||||
if (window == modal)
|
||||
break;
|
||||
if (window == g.HoveredWindow)
|
||||
hovered_window_above_modal = true;
|
||||
}
|
||||
bool hovered_window_above_modal = g.HoveredWindow && IsWindowAbove(g.HoveredWindow, modal);
|
||||
ClosePopupsOverWindow(hovered_window_above_modal ? g.HoveredWindow : modal, true);
|
||||
}
|
||||
}
|
||||
@ -6956,6 +6946,20 @@ bool ImGui::IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ImGui::IsWindowAbove(ImGuiWindow* potential_above, ImGuiWindow* potential_below)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
for (int i = g.Windows.Size - 1; i >= 0; i--)
|
||||
{
|
||||
ImGuiWindow* candidate_window = g.Windows[i];
|
||||
if (candidate_window == potential_above)
|
||||
return true;
|
||||
if (candidate_window == potential_below)
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ImGui::IsWindowHovered(ImGuiHoveredFlags flags)
|
||||
{
|
||||
IM_ASSERT((flags & ImGuiHoveredFlags_AllowWhenOverlapped) == 0); // Flags not supported by this function
|
||||
|
@ -2026,6 +2026,7 @@ namespace ImGui
|
||||
IMGUI_API void UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window);
|
||||
IMGUI_API ImVec2 CalcWindowExpectedSize(ImGuiWindow* window);
|
||||
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent);
|
||||
IMGUI_API bool IsWindowAbove(ImGuiWindow* potential_above, ImGuiWindow* potential_below);
|
||||
IMGUI_API bool IsWindowNavFocusable(ImGuiWindow* window);
|
||||
IMGUI_API ImRect GetWindowAllowedExtentRect(ImGuiWindow* window);
|
||||
IMGUI_API void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond = 0);
|
||||
|
Loading…
Reference in New Issue
Block a user