mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 09:27:00 +00:00
Viewports: Improve menu positioning in multi-monitor setups.
This change uses mouse position for initial positioning of popup menus. It ensures that menu appears in expected location on monitor mouse is currently hovering. This change fixes incorrect menu positioning (permanent or on the first frame) when menu item spans multiple monitors.
This commit is contained in:
parent
7d80a8f4f5
commit
3ff13edad9
@ -10986,7 +10986,7 @@ static void ImGui::UpdateSelectWindowViewport(ImGuiWindow* window)
|
|||||||
ImVec2 mouse_ref = (flags & ImGuiWindowFlags_Tooltip) ? g.IO.MousePos : g.BeginPopupStack.back().OpenMousePos;
|
ImVec2 mouse_ref = (flags & ImGuiWindowFlags_Tooltip) ? g.IO.MousePos : g.BeginPopupStack.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 | ImGuiWindowFlags_ChildMenu))) && (!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
|
else
|
||||||
window->ViewportAllowPlatformMonitorExtend = window->Viewport->PlatformMonitor;
|
window->ViewportAllowPlatformMonitorExtend = window->Viewport->PlatformMonitor;
|
||||||
|
Loading…
Reference in New Issue
Block a user