summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2013-09-13 09:18:49 +0300
committerTomi Korpipää <tomi.korpipaa@digia.com>2013-09-13 09:33:30 +0300
commitdbacb74d0c66e959f2486d16d0115ec60c73542e (patch)
treef92ab04947bd079012e7280b08682c9dbc19450f
parentbf50e48feddf827b387f5ae3de2199ea284157a7 (diff)
Rotation in slice view issue fixed
Task-number: QTRD-2264 Change-Id: I4bc51367f33f2c0855e6e7e9380b3798b4ad3a61 Change-Id: I4bc51367f33f2c0855e6e7e9380b3798b4ad3a61 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
-rw-r--r--src/datavisualization/engine/abstract3dcontroller.cpp4
-rw-r--r--src/datavisualization/input/q3dinputhandler.cpp7
-rw-r--r--src/datavisualization/input/qtouch3dinputhandler.cpp4
3 files changed, 9 insertions, 6 deletions
diff --git a/src/datavisualization/engine/abstract3dcontroller.cpp b/src/datavisualization/engine/abstract3dcontroller.cpp
index 03a0f416..bcccf833 100644
--- a/src/datavisualization/engine/abstract3dcontroller.cpp
+++ b/src/datavisualization/engine/abstract3dcontroller.cpp
@@ -669,6 +669,10 @@ QDataVis::CameraPreset Abstract3DController::cameraPreset() const
void Abstract3DController::setCameraPosition(GLfloat horizontal, GLfloat vertical, GLint distance)
{
+ // disable camera movement if in slice view
+ if (scene()->isSlicingActivated())
+ return;
+
m_horizontalRotation = qBound(-180.0f, horizontal, 180.0f);
m_verticalRotation = qBound(0.0f, vertical, 90.0f);
m_scene->camera()->setZoomLevel(qBound(10, distance, 500));
diff --git a/src/datavisualization/input/q3dinputhandler.cpp b/src/datavisualization/input/q3dinputhandler.cpp
index f721a375..51f0670a 100644
--- a/src/datavisualization/input/q3dinputhandler.cpp
+++ b/src/datavisualization/input/q3dinputhandler.cpp
@@ -59,12 +59,11 @@ void Q3DInputHandler::mousePressEvent(QMouseEvent *event, const QPoint &mousePos
setInputPosition(QPoint(0, 0));
} else if (Qt::RightButton == event->button()) {
// disable rotating when in slice view
- setInputState(QDataVis::InputRotating);
+ if (!scene()->isSlicingActivated())
+ setInputState(QDataVis::InputRotating);
// update mouse positions to prevent jumping when releasing or repressing a button
setInputPosition(mousePos);
}
- // TODO: Call actual camera class when it's been written.
- //m_cameraHelper->updateMousePos(m_mousePos);}
}
void Q3DInputHandler::mouseReleaseEvent(QMouseEvent *event, const QPoint &mousePos)
@@ -80,8 +79,8 @@ void Q3DInputHandler::mouseReleaseEvent(QMouseEvent *event, const QPoint &mouseP
void Q3DInputHandler::mouseMoveEvent(QMouseEvent *event, const QPoint &mousePos)
{
Q_UNUSED(event);
- if (QDataVis::InputRotating == inputState()) {
+ if (QDataVis::InputRotating == inputState()) {
// Calculate mouse movement since last frame
QPointF rotations = scene()->camera()->rotations();
GLfloat xRotation = rotations.x();
diff --git a/src/datavisualization/input/qtouch3dinputhandler.cpp b/src/datavisualization/input/qtouch3dinputhandler.cpp
index 4df735a2..75ef0d0c 100644
--- a/src/datavisualization/input/qtouch3dinputhandler.cpp
+++ b/src/datavisualization/input/qtouch3dinputhandler.cpp
@@ -33,7 +33,7 @@ QTouch3DInputHandler::~QTouch3DInputHandler()
void QTouch3DInputHandler::mouseDoubleClickEvent(QMouseEvent *event)
{
if (!scene()->isSlicingActivated()) {
- setInputState( QDataVis::InputOnScene );
+ setInputState(QDataVis::InputOnScene);
// update mouse positions to prevent jumping when releasing or repressing a button
setInputPosition( event->pos() );
}
@@ -45,7 +45,7 @@ void QTouch3DInputHandler::touchEvent(QTouchEvent *event)
points = event->touchPoints();
if (!scene()->isSlicingActivated() && points.count() == 2) {
- setInputState( QDataVis::InputOnPinch );
+ setInputState(QDataVis::InputOnPinch);
QPointF distance = points.at(0).pos() - points.at(1).pos();
int newDistance = distance.manhattanLength();