changeset 1218:6f3f1ef347a3 broker

fix OneGesturePointerTracker if mouse release is outside the canvas
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 06 Dec 2019 17:05:57 +0100
parents c04d0aa40f73
children 21c2b0eee53c
files Framework/Scene2DViewport/OneGesturePointerTracker.cpp Framework/Scene2DViewport/ViewportController.h
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Scene2DViewport/OneGesturePointerTracker.cpp	Thu Dec 05 18:34:56 2019 +0100
+++ b/Framework/Scene2DViewport/OneGesturePointerTracker.cpp	Fri Dec 06 17:05:57 2019 +0100
@@ -55,6 +55,15 @@
     // the number of active touches
     currentTouchCount_++;
     LOG(INFO) << "currentTouchCount_ becomes: " << currentTouchCount_;
+
+    /**
+     * 2019-12-06 (SJO): Patch to have consistent behavior when mouse
+     * leaves the canvas while the tracker is still active, then
+     * button is released while out-of-canvas. Such an event is not
+     * catched (at least in WebAssembly), so we delete the tracker on
+     * the next click inside the canvas.
+     **/
+    alive_ = false;
   }
 
   bool OneGesturePointerTracker::IsAlive() const
--- a/Framework/Scene2DViewport/ViewportController.h	Thu Dec 05 18:34:56 2019 +0100
+++ b/Framework/Scene2DViewport/ViewportController.h	Fri Dec 06 17:05:57 2019 +0100
@@ -218,6 +218,11 @@
       return scene_;
     }
 
+    bool HasActiveTracker() const
+    {
+      return activeTracker_.get() != NULL;
+    }
+
   private:
     double GetCanvasToSceneFactor() const;