on xenial help sign in
Fix regression making pan not possible in Zoomable Image
7d0dbe5Albert Astals Cid
qml/Components/ZoomableImage.qml+14−14
@@ -107,6 +107,20 @@ Item {
107 }
107 }
108 }
108 }
109
109
110+ PinchArea {
111+ id: pinchArea
112+ objectName: "pinchArea"
113+ property real minScale: 1.0
114+ anchors.fill: parent
115+ enabled: zoomable ? zoomable : false
116+
117+ pinch.target: image
118+ pinch.minimumScale: minScale
119+ pinch.maximumScale: 10
120+
121+ onPinchFinished: flickable.returnToBounds()
122+ }
123+
110 MouseArea {
124 MouseArea {
111 id: mouseArea
125 id: mouseArea
112 objectName: "mouseArea"
126 objectName: "mouseArea"
@@ -139,18 +153,4 @@ Item {
139 }
153 }
140 }
154 }
141 }
155 }
142−
143− PinchArea {
144− id: pinchArea
145− objectName: "pinchArea"
146− property real minScale: 1.0
147− anchors.fill: flickable
148− enabled: zoomable ? zoomable : false
149−
150− pinch.target: image
151− pinch.minimumScale: minScale
152− pinch.maximumScale: 10
153−
154− onPinchFinished: flickable.returnToBounds()
155− }
156}
156}
tests/qmltests/Components/tst_ZoomableImage.qml+7
@@ -182,6 +182,13 @@ Rectangle {
182 compare(flickable.contentWidth, Math.max(imageRenderer.width * image.scale, flickable.width));
182 compare(flickable.contentWidth, Math.max(imageRenderer.width * image.scale, flickable.width));
183 compare(flickable.contentHeight, Math.max(imageRenderer.height * image.scale, flickable.height));
183 compare(flickable.contentHeight, Math.max(imageRenderer.height * image.scale, flickable.height));
184
184
185+ // try pan it a bit
186+ var contentX = flickable.contentX;
187+ var contentY = flickable.contentY;
188+ touchFlick(zoomableImage, units.gu(1), units.gu(1), units.gu(10), units.gu(10));
189+ tryCompare(flickable, "moving", false)
190+ tryCompareFunction(function() { return flickable.contentX != contentX && flickable.contentY != contentY; }, zoomableImage.zoomable)
191+
185 wait(3000); // have to delay between two consequent pinch event.
192 wait(3000); // have to delay between two consequent pinch event.
186 // pinch zoom-out
193 // pinch zoom-out
187 touchPinch(zoomableImage, x1End, y1End, x1Start, y1Start, x2End, y2End, x2Start, y2Start);
194 touchPinch(zoomableImage, x1End, y1End, x1Start, y1Start, x2End, y2End, x2Start, y2Start);
tests/utils/modules/Unity/Test/UnityTestCase.qml+1−1
@@ -315,7 +315,7 @@ TestCase {
315 event1.press(0, x1Start, y1Start);
315 event1.press(0, x1Start, y1Start);
316 event1.commit();
316 event1.commit();
317 // second finger
317 // second finger
318− event1.stationary(0);
318+ event1.move(0, x1Start, y1Start);
319 event1.press(1, x2Start, y2Start);
319 event1.press(1, x2Start, y2Start);
320 event1.commit();
320 event1.commit();
321
321