forked from qt-creator/qt-creator
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:
@@ -358,6 +358,11 @@ qreal QmlDesigner::Internal::MouseArea3D::getNewRotationAngle(
|
|||||||
QQuick3DNode *node, const QVector3D &pressPos, const QVector3D ¤tPos,
|
QQuick3DNode *node, const QVector3D &pressPos, const QVector3D ¤tPos,
|
||||||
const QVector3D &nodePos, qreal prevAngle, bool trackBall)
|
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
|
// Get camera to node direction in node orientation
|
||||||
QVector3D cameraToNodeDir = getCameraToNodeDir(node);
|
QVector3D cameraToNodeDir = getCameraToNodeDir(node);
|
||||||
if (trackBall) {
|
if (trackBall) {
|
||||||
|
Reference in New Issue
Block a user