From 3808a23bc781c3b2b4b73081ed0bdbe971a09703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Tue, 14 Mar 2023 22:19:36 +0100 Subject: [PATCH] Always enable editor panning and zooming when GUI is hidden The `UI()->MouseInside(&View)` check does work when the mouse is all the way at the right or bottom side. Changing the `MouseInside` functions introduces other problems due to UI element and mouse positions being floating point numbers and not corresponding to exact pixels. As a workaround to enable unlimited editor panning in all direction when the GUI is hidden the check is omitted, as the map editor encompasses the entire view and so the check is not necessary in this case. Closes #4553. --- src/game/editor/editor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index c1f00e164..c1a346ddd 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -2325,7 +2325,7 @@ void CEditor::DoMapEditor(CUIRect View) } static void *s_pEditorID = (void *)&s_pEditorID; - const bool Inside = UI()->MouseInside(&View); + const bool Inside = !m_GuiActive || UI()->MouseInside(&View); // fetch mouse position float wx = UI()->MouseWorldX(); @@ -6071,7 +6071,7 @@ void CEditor::Render() UiDoPopupMenu(); - if(m_Dialog == DIALOG_NONE && !m_MouseInsidePopup && UI()->MouseInside(&View)) + if(m_Dialog == DIALOG_NONE && !m_MouseInsidePopup && (!m_GuiActive || UI()->MouseInside(&View))) { if(Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN)) ChangeZoom(20.0f);