qmlfrontend/game_view.cpp
changeset 15923 9b8d4f34e0f3
parent 15922 ebc50f21e849
child 16039 a73b9770467a
--- 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) {