diff Framework/Viewport/WebAssemblyViewport.cpp @ 1318:cbfdba08e039 broker

removed SDL code in wasm + added undostack CTOR in Wasm viewport + build fix + ORTHANC_OVERRIDE
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 17 Mar 2020 08:40:13 +0100
parents 1a08b779be64
children fd616c4a5904
line wrap: on
line diff
--- a/Framework/Viewport/WebAssemblyViewport.cpp	Tue Mar 17 08:37:12 2020 +0100
+++ b/Framework/Viewport/WebAssemblyViewport.cpp	Tue Mar 17 08:40:13 2020 +0100
@@ -203,14 +203,19 @@
     }
   }
 
-
-  WebAssemblyViewport::WebAssemblyViewport(const std::string& canvasId,
-                                           const Scene2D* scene) :
+  WebAssemblyViewport::WebAssemblyViewport(
+    const std::string& canvasId,
+    const Scene2D* scene,
+    boost::weak_ptr<UndoStack> undoStackW) :
     shortCanvasId_(canvasId),
-    fullCanvasId_("#" + canvasId),
+    fullCanvasId_(canvasId),
     interactor_(new DefaultViewportInteractor)
   {
-    if (scene == NULL)
+    if(undoStackW.lock() != NULL)
+    {
+      controller_ = boost::make_shared<ViewportController>(*this,undoStackW);
+    }
+    else if (scene == NULL)
     {
       controller_ = boost::make_shared<ViewportController>(*this);
     }
@@ -237,6 +242,10 @@
       canvasId.c_str()   // $0
       );
 
+    LOG(TRACE) << "2020-03-16-16h23 About to call emscripten_set_XXXX_callback on \"" 
+      << fullCanvasId_.c_str() << "\" from WebAssemblyViewport::WebAssemblyViewport";
+
+#if 1
     // It is not possible to monitor the resizing of individual
     // canvas, so we track the full window of the browser
     emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, this, false, OnResize);
@@ -244,6 +253,9 @@
     emscripten_set_mousedown_callback(fullCanvasId_.c_str(), this, false, OnMouseDown);
     emscripten_set_mousemove_callback(fullCanvasId_.c_str(), this, false, OnMouseMove);
     emscripten_set_mouseup_callback(fullCanvasId_.c_str(), this, false, OnMouseUp);
+#endif
+    LOG(TRACE) << "2020-03-16-16h23 DONE calling emscripten_set_XXXX_callback on \"" 
+      << fullCanvasId_.c_str() << "\" from WebAssemblyViewport::WebAssemblyViewport";
   }