diff Applications/Platforms/WebAssembly/WebAssemblyViewport.cpp @ 1811:fdc6a8089eb9

hovering of annotations in Stone Web viewer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 May 2021 11:29:53 +0200
parents 9ac2a65d4172
children 3889ae96d2e9
line wrap: on
line diff
--- a/Applications/Platforms/WebAssembly/WebAssemblyViewport.cpp	Thu May 20 19:11:44 2021 +0200
+++ b/Applications/Platforms/WebAssembly/WebAssemblyViewport.cpp	Tue May 25 11:29:53 2021 +0200
@@ -174,8 +174,8 @@
       ConvertMouseEvent(pointer, *mouseEvent, *that->compositor_);
 
       that->controller_->HandleMousePress(*that->interactor_, pointer,
-                                         that->compositor_->GetCanvasWidth(),
-                                         that->compositor_->GetCanvasHeight());        
+                                          that->compositor_->GetCanvasWidth(),
+                                          that->compositor_->GetCanvasHeight());        
       that->Invalidate();
     }
 
@@ -188,14 +188,25 @@
   {
     WebAssemblyViewport* that = reinterpret_cast<WebAssemblyViewport*>(userData);
 
-    if (that->compositor_.get() != NULL &&
-        that->controller_->HasActiveTracker())
+    if (that->compositor_.get() != NULL)
     {
-      PointerEvent pointer;
-      ConvertMouseEvent(pointer, *mouseEvent, *that->compositor_);
-      if (that->controller_->HandleMouseMove(pointer))
+      if (that->controller_->HasActiveTracker())
       {
-        that->Invalidate();
+        PointerEvent pointer;
+        ConvertMouseEvent(pointer, *mouseEvent, *that->compositor_);
+      
+        if (that->controller_->HandleMouseMove(pointer))
+        {
+          that->Invalidate();
+        }
+      }
+      else if (that->interactor_.get() != NULL &&
+               that->interactor_->HasMouseHover())
+      {
+        // New in Stone Web viewer 2.0
+        PointerEvent pointer;
+        ConvertMouseEvent(pointer, *mouseEvent, *that->compositor_);      
+        that->interactor_->HandleMouseHover(*that, pointer);
       }
     }