diff --git a/Source/Editor/GUI/MainMenu.cs b/Source/Editor/GUI/MainMenu.cs index f0f9458e7..081854046 100644 --- a/Source/Editor/GUI/MainMenu.cs +++ b/Source/Editor/GUI/MainMenu.cs @@ -186,14 +186,14 @@ namespace FlaxEditor.GUI private WindowHitCodes OnHitTest(ref Vector2 mouse) { var dpiScale = _window.DpiScale; - var pos = _window.ScreenToClient(mouse * dpiScale); if (_window.IsMinimized) return WindowHitCodes.NoWhere; if (!_window.IsMaximized) { - var winSize = RootWindow.Size * dpiScale; + var pos = _window.ScreenToClient(mouse * dpiScale); // pos is not DPI adjusted + var winSize = _window.Size; // Distance from which the mouse is considered to be on the border/corner float distance = 5.0f * dpiScale; @@ -223,11 +223,11 @@ namespace FlaxEditor.GUI return WindowHitCodes.Bottom; } - var menuPos = PointFromWindow(pos); - var controlUnderMouse = GetChildAt(menuPos); + var mousePos = PointFromScreen(mouse * dpiScale); + var controlUnderMouse = GetChildAt(mousePos); var isMouseOverSth = controlUnderMouse != null && controlUnderMouse != _title; var rb = GetRightButton(); - if (rb != null && _minimizeButton != null && new Rectangle(rb.UpperRight * dpiScale, (_minimizeButton.BottomLeft - rb.UpperRight) * dpiScale).Contains(ref menuPos) && !isMouseOverSth) + if (rb != null && _minimizeButton != null && new Rectangle(rb.UpperRight, _minimizeButton.BottomLeft - rb.UpperRight).Contains(ref mousePos) && !isMouseOverSth) return WindowHitCodes.Caption; return WindowHitCodes.Client;