From 888e191ec80a9df2c1ad5eea7fab25692e3a33fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Arve=20S=C3=A6ther?= Date: Wed, 18 Jul 2018 17:03:03 +0200 Subject: 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 --- tests/manual/pointer/map.qml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'tests/manual') 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 -- cgit v1.2.3