mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 11:57:00 +00:00
Internals: added IsWindowAbove() for use for modal/viewport bugfix.
This commit is contained in:
parent
9712bff0bb
commit
97265602c4
26
imgui.cpp
26
imgui.cpp
@ -3436,17 +3436,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);
|
||||
}
|
||||
}
|
||||
@ -6334,6 +6324,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
|
||||
|
@ -1827,6 +1827,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