diff options
author | Jan Arve Sæther <jan-arve.saether@qt.io> | 2018-07-18 17:03:03 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-07-19 10:56:15 +0000 |
commit | 888e191ec80a9df2c1ad5eea7fab25692e3a33fa (patch) | |
tree | 0e1bb6a3a13ed99b81cec51296c439f30a6ddc38 /tests/manual | |
parent | ca7cdd71ee33f0d77eb6bf1367d2532e26155cb2 (diff) |
Call clearGrabbers each time we get a press event
This is important in order for passive grabbers to be in the same order
as if the points were pressed at the same time.
In our case, the problem occurred when we had a single-point DragHandler
together with a two-finger PinchHandler:
* One finger was pressed and moved
=> DragHandler called setPassiveGrab()
=> point0->passiveGrabbers: [DragHandler]
* A second finger was pressed and moved
=> PinchHandler called setPassiveGrab() for both points
=> point0->passiveGrabbers: [DragHandler,PinchHandler]
=> point1->passiveGrabbers: [PinchHandler]
So then as one keeps on dragging the *two* fingers, the DragHandler will
get the chance to do an exclusive grab first, (since its the first listed
passive grabber of point0), and the PinchHandler won't get the opportunity
to grab. This is not expected since their declaration order implies that
the PinchHandler should get a chance to grab first.
Change-Id: I4e82ed186eeb5bf1dae1679d393e5563072175d1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/pointer/map.qml | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/manual/pointer/map.qml b/tests/manual/pointer/map.qml index 3ed732b523..d5de9eaa39 100644 --- a/tests/manual/pointer/map.qml +++ b/tests/manual/pointer/map.qml @@ -56,16 +56,6 @@ Item { } } - PinchHandler { - id: pinch - objectName: "two-point pinch" - target: map - minimumScale: 0.1 - maximumScale: 10 - onActiveChanged: if (!active) reRenderIfNecessary() - grabPermissions: PinchHandler.TakeOverForbidden // don't allow takeover if pinch has started - } - DragHandler { objectName: "single-point drag" target: map @@ -81,6 +71,16 @@ Item { onTranslationChanged: tilt.angle = translation.y / -2 } + PinchHandler { + id: pinch + objectName: "two-point pinch" + target: map + minimumScale: 0.1 + maximumScale: 10 + onActiveChanged: if (!active) reRenderIfNecessary() + grabPermissions: PinchHandler.TakeOverForbidden // don't allow takeover if pinch has started + } + function reRenderIfNecessary() { var newSourceWidth = image.sourceSize.width * pinch.scale var ratio = newSourceWidth / image.sourceSize.width |