comparison 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
comparison
equal deleted inserted replaced
1329:8d3e669f01a2 1331:ab81ee8fce1f
41 41
42 { 42 {
43 private: 43 private:
44 class WasmLock; 44 class WasmLock;
45 45
46 std::string shortCanvasId_; 46 std::string shortCanvasId_;
47 std::string fullCanvasId_; 47 std::string fullCanvasId_;
48 std::unique_ptr<ICompositor> compositor_; 48 std::unique_ptr<ICompositor> compositor_;
49 boost::shared_ptr<ViewportController> controller_; 49 std::unique_ptr<ViewportController> controller_;
50 std::unique_ptr<IViewportInteractor> interactor_; 50 std::unique_ptr<IViewportInteractor> interactor_;
51 bool enableEmscriptenEvents_;
51 52
52 static EM_BOOL OnRequestAnimationFrame(double time, void *userData); 53 static EM_BOOL OnRequestAnimationFrame(double time, void *userData);
53 54
54 static EM_BOOL OnResize(int eventType, const EmscriptenUiEvent *uiEvent, void *userData); 55 static EM_BOOL OnResize(int eventType, const EmscriptenUiEvent *uiEvent, void *userData);
55 56
77 virtual void Paint(ICompositor& compositor, 78 virtual void Paint(ICompositor& compositor,
78 ViewportController& controller) = 0; 79 ViewportController& controller) = 0;
79 80
80 virtual void UpdateSize(ICompositor& compositor) = 0; 81 virtual void UpdateSize(ICompositor& compositor) = 0;
81 82
83 /**
84 The second argument is temporary and should be deleted once the migration
85 to interactors is finished.
86 */
87 WebAssemblyViewport(const std::string& canvasId,
88 bool enableEmscriptenEvents = true);
89
90 void PostConstructor();
91
82 public: 92 public:
83 WebAssemblyViewport(const std::string& canvasId, 93 virtual ILock* Lock() ORTHANC_OVERRIDE;
84 const Scene2D* scene,
85 boost::weak_ptr<UndoStack> undoStackW);
86 94
87 virtual ILock* Lock() ORTHANC_OVERRIDE; 95 ~WebAssemblyViewport();
96
88 97
89 /** 98 /**
90 This method takes ownership 99 This method takes ownership
91 */ 100 */
92 void AcquireInteractor(IViewportInteractor* interactor); 101 void AcquireInteractor(IViewportInteractor* interactor);