QmlDesigner: Fix planar scaling randomly setting the third axis to zero

All the math before checking if the scaling axis is zero can cause
enough rounding errors to make qFuzzyIsNull to not think the value is
zero anymore, so check increase the check range.

Change-Id: I776d44886f061be6c1fd91c09eb8efcfb29e0936
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-03 17:22:11 +02:00
parent 4ce7f39e4e
commit 0758b58ceb

View File

@@ -322,11 +322,11 @@ QVector3D MouseArea3D::getNewScale(QQuick3DNode *node, const QVector3D &startSca
scaleVec *= magnitude;
// Zero axes on scale vector indicate directions we don't want scaling to affect
if (qFuzzyIsNull(scaleVec.x()))
if (scaleDirVector.x() < 0.0001f)
scaleVec.setX(1.f);
if (qFuzzyIsNull(scaleVec.y()))
if (scaleDirVector.y() < 0.0001f)
scaleVec.setY(1.f);
if (qFuzzyIsNull(scaleVec.z()))
if (scaleDirVector.z() < 0.0001f)
scaleVec.setZ(1.f);
scaleVec *= startScale;