From 6801a3f18073af49fa24a3fe2d5510585f94c415 Mon Sep 17 00:00:00 2001 From: dlyr Date: Fri, 16 Jul 2021 13:57:49 +0200 Subject: [PATCH] [gui] fix bad last mouse values. Introduced since mapping context has been fixed... --- src/Gui/Viewer/RotateAroundCameraManipulator.cpp | 11 ++++------- src/Gui/Viewer/RotateAroundCameraManipulator.hpp | 2 -- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Gui/Viewer/RotateAroundCameraManipulator.cpp b/src/Gui/Viewer/RotateAroundCameraManipulator.cpp index a0908f28197..690e8e79b9c 100644 --- a/src/Gui/Viewer/RotateAroundCameraManipulator.cpp +++ b/src/Gui/Viewer/RotateAroundCameraManipulator.cpp @@ -62,9 +62,6 @@ bool RotateAroundCameraManipulator::handleMouseMoveEvent( Scalar dx = ( event->pos().x() - m_lastMouseX ) / m_camera->getWidth(); Scalar dy = ( event->pos().y() - m_lastMouseY ) / m_camera->getHeight(); - m_lastMouseX = event->pos().x(); - m_lastMouseY = event->pos().y(); - if ( m_currentAction == TRACKBALLCAMERA_ROTATE ) handleCameraRotate( event->pos().x(), event->pos().y() ); else if ( m_currentAction == TRACKBALLCAMERA_PAN ) @@ -74,8 +71,8 @@ bool RotateAroundCameraManipulator::handleMouseMoveEvent( else if ( m_currentAction == TRACKBALLCAMERA_MOVE_FORWARD ) handleCameraMoveForward( dx, dy ); - m_prevMouseX = m_lastMouseX; - m_prevMouseY = m_lastMouseY; + m_lastMouseX = event->pos().x(); + m_lastMouseY = event->pos().y(); if ( m_light != nullptr ) { @@ -184,8 +181,8 @@ Scalar RotateAroundCameraManipulator::projectOnBall( Scalar x, Scalar y ) { Ra::Core::Quaternion RotateAroundCameraManipulator::deformedBallQuaternion( Scalar x, Scalar y, Scalar cx, Scalar cy ) { // Points on the deformed ball - Scalar px = m_cameraSensitivity * ( m_prevMouseX - cx ) / m_camera->getWidth(); - Scalar py = m_cameraSensitivity * ( cy - m_prevMouseY ) / m_camera->getHeight(); + Scalar px = m_cameraSensitivity * ( m_lastMouseX - cx ) / m_camera->getWidth(); + Scalar py = m_cameraSensitivity * ( cy - m_lastMouseY ) / m_camera->getHeight(); Scalar dx = m_cameraSensitivity * ( x - cx ) / m_camera->getWidth(); Scalar dy = m_cameraSensitivity * ( cy - y ) / m_camera->getHeight(); diff --git a/src/Gui/Viewer/RotateAroundCameraManipulator.hpp b/src/Gui/Viewer/RotateAroundCameraManipulator.hpp index 3d8f431e5fd..d0ca660237e 100644 --- a/src/Gui/Viewer/RotateAroundCameraManipulator.hpp +++ b/src/Gui/Viewer/RotateAroundCameraManipulator.hpp @@ -44,8 +44,6 @@ class RA_GUI_API RotateAroundCameraManipulator Scalar projectOnBall( Scalar x, Scalar y ); private: - Scalar m_prevMouseX {0.0_ra}; - Scalar m_prevMouseY {0.0_ra}; Ra::Core::Vector3 m_pivot {0.0_ra, 0.0_ra, 0.0_ra}; Ra::Gui::Viewer* m_viewer;