Fix camera move control in qmlfrontend
authorunC0Rr
Tue, 15 Nov 2022 15:26:00 +0100
changeset 15923 9b8d4f34e0f3
parent 15922 ebc50f21e849
child 15925 d2dafe1b25f5
Fix camera move control in qmlfrontend
qmlfrontend/game_view.cpp
--- a/qmlfrontend/game_view.cpp	Tue Nov 15 15:25:37 2022 +0100
+++ b/qmlfrontend/game_view.cpp	Tue Nov 15 15:26:00 2022 +0100
@@ -72,9 +72,11 @@
   }
 
   if (m_engineInstance) {
-    QPoint mousePos = mapFromGlobal(QCursor::pos()).toPoint();
-    m_engineInstance->moveCamera(mousePos - m_centerPoint);
-    QCursor::setPos(mapToGlobal(m_centerPoint).toPoint());
+    const auto delta = mapFromGlobal(QCursor::pos()).toPoint() - m_centerPoint;
+
+    m_engineInstance->moveCamera(delta);
+
+    QCursor::setPos(window()->screen(), mapToGlobal(m_centerPoint).toPoint());
   }
 
   if (m_renderer) {