Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix jumpy first mouse movement in capture mouse mode
- Loading branch information
Showing
with
14 additions
and
0 deletions.
-
+13
−0
src/3d/qgscameracontroller.cpp
-
+1
−0
src/3d/qgscameracontroller.h
|
@@ -436,9 +436,15 @@ void QgsCameraController::onKeyPressed( Qt3DInput::QKeyEvent *event ) |
|
|
{ |
|
|
mCaptureFpsMouseMovements = !mCaptureFpsMouseMovements; |
|
|
if ( mCaptureFpsMouseMovements ) |
|
|
{ |
|
|
mIgnoreNextMouseMove = true; |
|
|
qApp->setOverrideCursor( QCursor( Qt::BlankCursor ) ); |
|
|
} |
|
|
else |
|
|
{ |
|
|
mIgnoreNextMouseMove = false; |
|
|
qApp->restoreOverrideCursor(); |
|
|
} |
|
|
return; |
|
|
} |
|
|
} |
|
@@ -566,6 +572,13 @@ void QgsCameraController::onPositionChangedFlyNavigation( Qt3DInput::QMouseEvent |
|
|
if ( !mMousePressed && !mCaptureFpsMouseMovements ) |
|
|
return; |
|
|
|
|
|
if ( mIgnoreNextMouseMove ) |
|
|
{ |
|
|
mMousePos = QPoint( mouse->x(), mouse->y() ); |
|
|
mIgnoreNextMouseMove = false; |
|
|
return; |
|
|
} |
|
|
|
|
|
double dx = mouse->x() - mMousePos.x(); |
|
|
double dy = mouse->y() - mMousePos.y(); |
|
|
if ( mPressedButton == Qt3DInput::QMouseEvent::LeftButton || mPressedButton == Qt3DInput::QMouseEvent::MiddleButton || ( mCaptureFpsMouseMovements && mPressedButton != Qt3DInput::QMouseEvent::RightButton ) ) |
|
|
|
@@ -235,6 +235,7 @@ class _3D_EXPORT QgsCameraController : public Qt3DCore::QEntity |
|
|
|
|
|
QSet< int > mDepressedKeys; |
|
|
bool mCaptureFpsMouseMovements = false; |
|
|
bool mIgnoreNextMouseMove = false; |
|
|
QTimer *mFpsNavTimer = nullptr; |
|
|
}; |
|
|
|
|
|