multi-touch: improved re-touch decision for touch point
authorGiWoong Kim <giwoong.kim@samsung.com>
Thu, 15 Oct 2015 09:47:07 +0000 (18:47 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 19 Oct 2015 05:44:31 +0000 (14:44 +0900)
To get more precise distincion for re-touch points,
shape of decision region need to change to circular from rectangle.
It makes reduce a gap between mouse event area(decision region)
and point appearance.

Change-Id: I6e47a0d3a8c1bd45ba0df124cf744573fffe41dd
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/ui/input/multitouchtracker.cpp

index edb6ce8d7a6bb23bd1e4ff5ec20a40d78c39bbfa..690424e83b47e7ce17fdfcf83ee6bac3c2e7bdb5 100644 (file)
  *
  */
 
-#include <QWidget>
-#include <QPainter>
-#include <QImage>
-#include <QDebug>
+#include <QtWidgets>
 
 #include "qt5_supplement.h"
 #include "multitouchtracker.h"
@@ -166,7 +163,14 @@ TouchPoint *MultiTouchTracker::searchTouchPoint(QPoint targetPos)
                 targetPos.x() < point->getHostPos().x() + pointRadius &&
                 targetPos.y() >= point->getHostPos().y() - pointRadius &&
                 targetPos.y() < point->getHostPos().y() + pointRadius) {
-                return point;
+
+                /* more precise distinction with circular region */
+                qreal distance = qSqrt(
+                    qPow(targetPos.x() - point->getHostPos().x(), 2) +
+                    qPow(targetPos.y() - point->getHostPos().y(), 2));
+                if (distance <= pointRadius) {
+                    return point;
+                }
             }
         }
     }