Fix rotation resulting in NaN angle sometimes

Change-Id: I88f866c6649f7ec25bc96a7393d0930685e5382b
Fixes: QDS-1341
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Miikka Heikkinen
2019-12-12 15:46:22 +02:00
parent eb09e814db
commit 49da199b10

View File

@@ -358,6 +358,11 @@ qreal QmlDesigner::Internal::MouseArea3D::getNewRotationAngle(
QQuick3DNode *node, const QVector3D &pressPos, const QVector3D &currentPos,
const QVector3D &nodePos, qreal prevAngle, bool trackBall)
{
const QVector3D dragVector = currentPos - pressPos;
if (dragVector.length() < 0.001f)
return prevAngle;
// Get camera to node direction in node orientation
QVector3D cameraToNodeDir = getCameraToNodeDir(node);
if (trackBall) {