diff Framework/Toolbox/ViewportGeometry.cpp @ 457:3b4df9925db6 am-touch-events

added support for 'touch' in mouse trackers. This is still a bit hacky and we need to refactor it to make it clean. Thanks to that, Pan and zoom are available together with 2 touches
author Alain Mazy <alain@mazy.be>
date Thu, 24 Jan 2019 16:42:27 +0100
parents b70e9be013e4
children 9a474e90e832
line wrap: on
line diff
--- a/Framework/Toolbox/ViewportGeometry.cpp	Wed Jan 23 13:58:51 2019 +0100
+++ b/Framework/Toolbox/ViewportGeometry.cpp	Thu Jan 24 16:42:27 2019 +0100
@@ -121,6 +121,18 @@
   }
 
 
+  void ViewportGeometry::MapPixelCenterToScene(std::vector<Touch>& sceneTouches /* out */,
+                                               const std::vector<Touch>& displayTouches) const
+  {
+    double sceneX, sceneY;
+    sceneTouches.clear();
+    for (size_t t = 0; t < displayTouches.size(); t++)
+    {
+      MapPixelCenterToScene(sceneX, sceneY, displayTouches[t].x, displayTouches[t].y);
+      sceneTouches.push_back(Touch((float)sceneX, (float)sceneY));
+    }
+  }
+
   void ViewportGeometry::MapPixelCenterToScene(double& sceneX,
                                                double& sceneY,
                                                int x,