From 0624390ef163f352903029f24c51b66f31aced46 Mon Sep 17 00:00:00 2001
From: Frederik Gladhorn <frederik.gladhorn@qt.io>
Date: Thu, 29 Sep 2016 19:46:32 +0200
Subject: [PATCH] Fix panActive state when last touch point is released

When a touch interaction ends, the map would only consider the number of
points, not their state. Thus when pan was active, it would always stay
active, because in the release event, the number of points is still at
least one.

This also requires a reset of the synthetic mouse point, since otherwise the mouse
point will be copied into the list of touch points, preventing the
number of points to ever go down to zero.

Change-Id: I9821d09d75f883d01eb38b741e2b5658036be334
Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
---
 src/imports/location/qquickgeomapgesturearea.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/imports/location/qquickgeomapgesturearea.cpp b/src/imports/location/qquickgeomapgesturearea.cpp
index 9541355cd..ccf360aad 100644
--- a/src/imports/location/qquickgeomapgesturearea.cpp
+++ b/src/imports/location/qquickgeomapgesturearea.cpp
@@ -672,8 +672,13 @@ void QQuickGeoMapGestureArea::handleTouchUngrabEvent()
 void QQuickGeoMapGestureArea::handleTouchEvent(QTouchEvent *event)
 {
     m_touchPoints.clear();
-    for (int i = 0; i < event->touchPoints().count(); ++i)
-        m_touchPoints << event->touchPoints().at(i);
+    m_mousePoint.reset();
+
+    for (int i = 0; i < event->touchPoints().count(); ++i) {
+        auto point = event->touchPoints().at(i);
+        if (point.state() != Qt::TouchPointReleased)
+            m_touchPoints << point;
+    }
     if (event->touchPoints().count() >= 2)
         event->accept();
     else
-- 
GitLab