mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 14:36:34 +00:00
Viewport: Fixes moving child menu viewport (fix 379733a
).
This commit is contained in:
parent
ddc3f8f069
commit
1e7b50aeae
10
imgui.cpp
10
imgui.cpp
@ -7728,14 +7728,17 @@ static void ImGui::UpdateSelectWindowViewport(ImGuiWindow* window)
|
|||||||
window->Viewport = main_viewport;
|
window->Viewport = main_viewport;
|
||||||
|
|
||||||
// Mark window as allowed to protrude outside of its viewport and into the current monitor
|
// Mark window as allowed to protrude outside of its viewport and into the current monitor
|
||||||
// We need to take account of the possibility that mouse may become invalid.
|
|
||||||
if (flags & (ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup))
|
if (flags & (ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup))
|
||||||
{
|
{
|
||||||
|
// We need to take account of the possibility that mouse may become invalid.
|
||||||
|
// Popups/Tooltip always set ViewportAllowPlatformMonitorExtend so GetWindowAllowedExtentRect() will return full monitor bounds.
|
||||||
ImVec2 mouse_ref = (flags & ImGuiWindowFlags_Tooltip) ? g.IO.MousePos : g.CurrentPopupStack.back().OpenMousePos;
|
ImVec2 mouse_ref = (flags & ImGuiWindowFlags_Tooltip) ? g.IO.MousePos : g.CurrentPopupStack.back().OpenMousePos;
|
||||||
bool use_mouse_ref = (g.NavDisableHighlight || !g.NavDisableMouseHover || !g.NavWindow);
|
bool use_mouse_ref = (g.NavDisableHighlight || !g.NavDisableMouseHover || !g.NavWindow);
|
||||||
bool mouse_valid = IsMousePosValid(&mouse_ref);
|
bool mouse_valid = IsMousePosValid(&mouse_ref);
|
||||||
if ((window->Appearing || (flags & ImGuiWindowFlags_Tooltip)) && (!use_mouse_ref || mouse_valid))
|
if ((window->Appearing || (flags & ImGuiWindowFlags_Tooltip)) && (!use_mouse_ref || mouse_valid))
|
||||||
window->ViewportAllowPlatformMonitorExtend = FindPlatformMonitorForPos((use_mouse_ref && mouse_valid) ? mouse_ref : NavCalcPreferredRefPos());
|
window->ViewportAllowPlatformMonitorExtend = FindPlatformMonitorForPos((use_mouse_ref && mouse_valid) ? mouse_ref : NavCalcPreferredRefPos());
|
||||||
|
else
|
||||||
|
window->ViewportAllowPlatformMonitorExtend = window->Viewport->PlatformMonitor;
|
||||||
}
|
}
|
||||||
else if (window->Viewport && window != window->Viewport->Window && window->Viewport->Window && !(flags & ImGuiWindowFlags_ChildWindow))
|
else if (window->Viewport && window != window->Viewport->Window && window->Viewport->Window && !(flags & ImGuiWindowFlags_ChildWindow))
|
||||||
{
|
{
|
||||||
@ -7755,8 +7758,9 @@ static void ImGui::UpdateSelectWindowViewport(ImGuiWindow* window)
|
|||||||
window->Viewport = AddUpdateViewport(window, window->ID, window->Pos, window->Size, ImGuiViewportFlags_NoFocusOnAppearing);
|
window->Viewport = AddUpdateViewport(window, window->ID, window->Pos, window->Size, ImGuiViewportFlags_NoFocusOnAppearing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Regular (non-child, non-popup) windows by default are also allowed to protrude
|
||||||
if (window->ViewportAllowPlatformMonitorExtend < 0 && (flags & ImGuiWindowFlags_ChildWindow) == 0)
|
// Child windows are kept contained within their parent.
|
||||||
|
else if (window->ViewportAllowPlatformMonitorExtend < 0 && (flags & ImGuiWindowFlags_ChildWindow) == 0)
|
||||||
window->ViewportAllowPlatformMonitorExtend = window->Viewport->PlatformMonitor;
|
window->ViewportAllowPlatformMonitorExtend = window->Viewport->PlatformMonitor;
|
||||||
|
|
||||||
// Update flags
|
// Update flags
|
||||||
|
Loading…
Reference in New Issue
Block a user