diff options
author | Vladimir Belyavsky <[email protected]> | 2024-10-24 16:22:18 +0300 |
---|---|---|
committer | Shawn Rutledge <[email protected]> | 2024-10-26 10:52:39 +0200 |
commit | 49fbf2f86afa62b8c1c2be330620a0b310584a34 (patch) | |
tree | e8ea2d10a9c5f8d8c69337cc1c744d2d526246ec /src/quick | |
parent | 27ee3aa4403c7e3f3d189220228876690eb4308b (diff) |
PinchHandler: Set target properties only if respective axis enabled
If the user has disabled the rotation or scale axis, the target item's
rotation or scale property must not be set at all, to avoid breaking
bindings that were set differently.
Fixes: QTBUG-130517
Pick-to: 6.8 6.5
Change-Id: I8f84f6845532f748bbdcc3af91a398d6659156ca
Reviewed-by: Richard Moe Gustavsen <[email protected]>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/handlers/qquickpinchhandler.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/quick/handlers/qquickpinchhandler.cpp b/src/quick/handlers/qquickpinchhandler.cpp index 64a571a999..fa790ecfa5 100644 --- a/src/quick/handlers/qquickpinchhandler.cpp +++ b/src/quick/handlers/qquickpinchhandler.cpp @@ -697,9 +697,17 @@ void QQuickPinchHandler::handlePointerEventImpl(QPointerEvent *event) m_xAxis.updateValue(activeTranslation.x(), m_xAxis.persistentValue() + delta.x(), delta.x()); m_yAxis.updateValue(activeTranslation.y(), m_yAxis.persistentValue() + delta.y(), delta.y()); emit translationChanged(delta); + // xAxis or yAxis may be disabled; nevertheless, we use setPosition() to compensate for + // other aspects of the transform. So it should not be skipped. Above, we've already + // subtracted activeTranslation if necessary. t->setPosition(pos); - t->setRotation(m_rotationAxis.persistentValue()); - t->setScale(m_scaleAxis.persistentValue()); + // Set rotation and scale properties only if the respective axes are enabled. + // We've already checked above, so we don't expect activeScale or activeRotation to change + // if the axis is disabled; but then don't call the setter at all, to avoid breaking bindings. + if (m_rotationAxis.enabled()) + t->setRotation(m_rotationAxis.persistentValue()); + if (m_scaleAxis.enabled()) + t->setScale(m_scaleAxis.persistentValue()); } else { auto activeTranslation = centroid().scenePosition() - centroid().scenePressPosition(); auto accumulated = QPointF(m_xAxis.m_startValue, m_yAxis.m_startValue) + activeTranslation; |