aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/handlers/qquickpinchhandler.cpp
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@qt.io>2017-03-08 16:16:36 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2017-03-14 12:09:52 +0000
commit0ff3093e32b2534b29d296b5733a6c2849e5b2ac (patch)
treed96e02ea0d880b1499912e26c8683690e10152ac /src/quick/handlers/qquickpinchhandler.cpp
parentfee26bb6f83bfb79845f8da889090b33e2b8fb4d (diff)
PinchHandler: Do not grab immediately
Do not grab until at least one of the points have moved beyond the drag threshold Change-Id: I30de6332cc8e2b0238cacf5c4f0f70efbdc4d41d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/handlers/qquickpinchhandler.cpp')
-rw-r--r--src/quick/handlers/qquickpinchhandler.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/quick/handlers/qquickpinchhandler.cpp b/src/quick/handlers/qquickpinchhandler.cpp
index 4832d300c2..5469df206c 100644
--- a/src/quick/handlers/qquickpinchhandler.cpp
+++ b/src/quick/handlers/qquickpinchhandler.cpp
@@ -214,7 +214,6 @@ void QQuickPinchHandler::onActiveChanged()
m_activeRotation = 0;
m_activeTranslation = QPointF(0,0);
qCInfo(lcPinchHandler) << "activated with starting scale" << m_startScale << "rotation" << m_startRotation;
- grabPoints(m_currentPoints);
}
} else {
qCInfo(lcPinchHandler) << "deactivated with scale" << m_activeScale << "rotation" << m_activeRotation;
@@ -224,16 +223,23 @@ void QQuickPinchHandler::onActiveChanged()
void QQuickPinchHandler::handlePointerEventImpl(QQuickPointerEvent *event)
{
Q_UNUSED(event)
- // TODO wait for the drag threshold before setting active
- // but the old behavior was that whenever we "want" all the points, we're active
- // so that behavior is retained here temporarily
- setActive(m_currentPoints.count() > 0 && m_currentPoints.at(0)->state() != QQuickEventPoint::Released);
-
if (Q_UNLIKELY(lcPinchHandler().isDebugEnabled())) {
for (QQuickEventPoint *point : qAsConst(m_currentPoints))
qCDebug(lcPinchHandler) << point->state() << point->sceneGrabPos() << "->" << point->scenePos();
}
+ if (!active()) {
+ // Verify that least one of the points have moved beyond threshold needed to activate the handler
+ for (QQuickEventPoint *point : qAsConst(m_currentPoints)) {
+ if (QQuickWindowPrivate::dragOverThreshold(point)) {
+ grabPoints(m_currentPoints);
+ setActive(true);
+ break;
+ }
+ }
+ if (!active())
+ return;
+ }
// TODO check m_pinchOrigin: right now it acts like it's set to PinchCenter
m_centroid = touchPointCentroid();
QRectF bounds(m_minimumX, m_minimumY, m_maximumX, m_maximumY);