Viewport: Fixed an assert on loss of valid mouse position while dragging a tooltip (would happen often when using debugger breakpoint). Not totally sure about best solution, may not be important.

This commit is contained in:
omar 2018-07-31 13:38:24 +02:00
parent 9824bf1ba1
commit c031ea088a

View File

@ -6923,8 +6923,9 @@ static void ImGui::UpdateSelectWindowViewport(ImGuiWindow* window)
if (flags & (ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup)) if (flags & (ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup))
{ {
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;
if (window->Appearing || (flags & ImGuiWindowFlags_Tooltip)) bool mouse_valid = IsMousePosValid(&mouse_ref);
window->ViewportAllowPlatformMonitorExtend = FindPlatformMonitorForPos((use_mouse_ref && IsMousePosValid(&mouse_ref)) ? mouse_ref : NavCalcPreferredRefPos()); if ((window->Appearing || (flags & ImGuiWindowFlags_Tooltip)) && (!use_mouse_ref || mouse_valid))
window->ViewportAllowPlatformMonitorExtend = FindPlatformMonitorForPos((use_mouse_ref && mouse_valid) ? mouse_ref : NavCalcPreferredRefPos());
else else
window->ViewportAllowPlatformMonitorExtend = window->Viewport->PlatformMonitor; window->ViewportAllowPlatformMonitorExtend = window->Viewport->PlatformMonitor;
} }