Commit 1a605d11 authored by Oliver Bock's avatar Oliver Bock

Improved camera movement

* Flipped rotation direction
* Added missing rotation angle capping (0-359 deg)
* Removed superfluous "mouse sensitivity" factor
* Removed superfluous camera update
parent 817406f3
......@@ -423,12 +423,12 @@ void PulsarAnimationWidget::mouseMoveEvent(QMouseEvent *event)
Qt::MouseButtons buttons = event->buttons();
if((buttons & Qt::LeftButton) == Qt::LeftButton) {
if(m_mouseLastX != 0) {
m_mouseAngleH -= (m_mouseLastX - event->x()) * 0.5 ;
m_mouseAngleH += (m_mouseLastX - event->x());
m_mouseAngleH = m_mouseAngleH < 360 ? m_mouseAngleH : 0;
m_mouseAngleH = m_mouseAngleH >= 0 ? m_mouseAngleH : 359;
}
if(m_mouseLastY != 0) {
m_mouseAngleV -= (m_mouseLastY - event->y()) * 0.5;
m_mouseAngleV -= (m_mouseLastY - event->y());
m_mouseAngleV = m_mouseAngleV < 90 ? m_mouseAngleV : 90;
m_mouseAngleV = m_mouseAngleV > -90 ? m_mouseAngleV : -90;
}
......@@ -438,9 +438,8 @@ void PulsarAnimationWidget::mouseMoveEvent(QMouseEvent *event)
}
else if((buttons & Qt::RightButton) == Qt::RightButton) {
if(m_mouseLastY != 0) {
m_cameraZoom -= (m_mouseLastY - event->y()) * 0.5;
m_cameraZoom -= (m_mouseLastY - event->y());
m_cameraZoom = m_cameraZoom >= m_cameraZoomLBound ? m_cameraZoom : m_cameraZoomLBound;
updateCameraPosition(m_mouseAngleH, m_mouseAngleV, m_cameraZoom);
}
m_mouseLastY = event->y();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment