diff Framework/Viewport/WebAssemblyViewport.h @ 1331:ab81ee8fce1f broker

- Viewport is not passed and stored as a shared_ptr instead of raw reference. - ViewportController can now be injected with an undo stack (not a ctor param anymore, as a preparation for the move of the undo stack to an interactor) - Added (temp) flag to disable emscripten events registration in the WebAssemblyViewport (because legacy client code deals with them directly) - Added emscripten_clear_timeout in ~WebGLViewportsRegistry - Removed GenericToolbox::HoldingRef whose responsibility is better served with proper callback un-registration.
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 30 Mar 2020 14:23:46 +0200
parents fd616c4a5904
children 5b731e176236
line wrap: on
line diff
--- a/Framework/Viewport/WebAssemblyViewport.h	Mon Mar 30 08:47:30 2020 +0200
+++ b/Framework/Viewport/WebAssemblyViewport.h	Mon Mar 30 14:23:46 2020 +0200
@@ -43,11 +43,12 @@
   private:
     class WasmLock;
     
-    std::string                            shortCanvasId_;
-    std::string                            fullCanvasId_;
-    std::unique_ptr<ICompositor>             compositor_;
-    boost::shared_ptr<ViewportController>  controller_;
-    std::unique_ptr<IViewportInteractor>     interactor_;
+    std::string                           shortCanvasId_;
+    std::string                           fullCanvasId_;
+    std::unique_ptr<ICompositor>          compositor_;
+    std::unique_ptr<ViewportController>   controller_;
+    std::unique_ptr<IViewportInteractor>  interactor_;
+    bool                                  enableEmscriptenEvents_;
 
     static EM_BOOL OnRequestAnimationFrame(double time, void *userData);
     
@@ -79,12 +80,20 @@
 
     virtual void UpdateSize(ICompositor& compositor) = 0;
 
+    /**
+    The second argument is temporary and should be deleted once the migration 
+    to interactors is finished.
+    */
+    WebAssemblyViewport(const std::string& canvasId, 
+                        bool enableEmscriptenEvents = true);
+
+    void PostConstructor();
+
   public:
-    WebAssemblyViewport(const std::string& canvasId,
-                        const Scene2D* scene,
-                        boost::weak_ptr<UndoStack> undoStackW);
+    virtual ILock* Lock() ORTHANC_OVERRIDE;
 
-    virtual ILock* Lock() ORTHANC_OVERRIDE;
+    ~WebAssemblyViewport();
+
 
     /**
     This method takes ownership