Skip to content

Commit 9553861

Browse files
committed
Fix camera move control in qmlfrontend
1 parent 7418188 commit 9553861

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

qmlfrontend/game_view.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ void GameView::sync() {
7272
}
7373

7474
if (m_engineInstance) {
75-
QPoint mousePos = mapFromGlobal(QCursor::pos()).toPoint();
76-
m_engineInstance->moveCamera(mousePos - m_centerPoint);
77-
QCursor::setPos(mapToGlobal(m_centerPoint).toPoint());
75+
const auto delta = mapFromGlobal(QCursor::pos()).toPoint() - m_centerPoint;
76+
77+
m_engineInstance->moveCamera(delta);
78+
79+
QCursor::setPos(window()->screen(), mapToGlobal(m_centerPoint).toPoint());
7880
}
7981

8082
if (m_renderer) {

0 commit comments

Comments
 (0)