diff OrthancStone/Sources/Viewport/WebAssemblyViewport.h @ 1576:92fca2b3ba3d

sanitizing the handling of canvas size
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 24 Sep 2020 16:40:30 +0200
parents e4a52cbbdd70
children e8a120dd05bd
line wrap: on
line diff
--- a/OrthancStone/Sources/Viewport/WebAssemblyViewport.h	Wed Sep 23 17:25:25 2020 +0200
+++ b/OrthancStone/Sources/Viewport/WebAssemblyViewport.h	Thu Sep 24 16:40:30 2020 +0200
@@ -58,6 +58,8 @@
     std::unique_ptr<ViewportController>   controller_;
     std::unique_ptr<IViewportInteractor>  interactor_;
     bool                                  enableEmscriptenMouseEvents_;
+    unsigned int                          canvasWidth_;
+    unsigned int                          canvasHeight_;
 
     static EM_BOOL OnRequestAnimationFrame(double time, void *userData);
     
@@ -87,8 +89,6 @@
     virtual void Paint(ICompositor& compositor,
                        ViewportController& controller) = 0;
 
-    virtual void UpdateSize(ICompositor& compositor) = 0;
-
     /**
     The second argument is temporary and should be deleted once the migration 
     to interactors is finished. It should be set to "true" for new applications.
@@ -124,6 +124,19 @@
       return canvasCssSelector_;
     }
 
+
+    void RefreshCanvasSize();
+
+    unsigned int GetCanvasWidth() const
+    {
+      return canvasWidth_;
+    }
+    
+    unsigned int GetCanvasHeight()
+    {
+      return canvasHeight_;
+    }
+    
     void FitForPrint();  // TODO - REMOVE
   };
 }