# HG changeset patch # User Sebastien Jodogne # Date 1600959074 -7200 # Node ID e8a120dd05bd0eb4c8984dd46c40cefb25603b60 # Parent 92fca2b3ba3dc6be72972fc9d68c692cdd6c052e cont diff -r 92fca2b3ba3d -r e8a120dd05bd OrthancStone/Sources/Viewport/IViewport.h --- a/OrthancStone/Sources/Viewport/IViewport.h Thu Sep 24 16:40:30 2020 +0200 +++ b/OrthancStone/Sources/Viewport/IViewport.h Thu Sep 24 16:51:14 2020 +0200 @@ -66,8 +66,11 @@ /** * This function must be called when the layout has changed, and - * thus the size of the canvas must be re-computed. Avoid - * calling this method too often for performance. + * thus the size of the canvas must be re-computed. After a call + * to this method, the canvas size can be accessed through + * "GetCompositor().GetCanvasWidth()" and + * "GetCompositor().GetCanvasHeight()". Avoid calling this + * method too often for performance. **/ virtual void RefreshCanvasSize() = 0; }; diff -r 92fca2b3ba3d -r e8a120dd05bd OrthancStone/Sources/Viewport/WebAssemblyViewport.cpp --- a/OrthancStone/Sources/Viewport/WebAssemblyViewport.cpp Thu Sep 24 16:40:30 2020 +0200 +++ b/OrthancStone/Sources/Viewport/WebAssemblyViewport.cpp Thu Sep 24 16:51:14 2020 +0200 @@ -318,11 +318,6 @@ } } - void WebAssemblyViewport::UpdateCanvasSize() - { - RefreshCanvasSize(); - } - WebAssemblyViewport::~WebAssemblyViewport() { emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, diff -r 92fca2b3ba3d -r e8a120dd05bd OrthancStone/Sources/Viewport/WebAssemblyViewport.h --- a/OrthancStone/Sources/Viewport/WebAssemblyViewport.h Thu Sep 24 16:40:30 2020 +0200 +++ b/OrthancStone/Sources/Viewport/WebAssemblyViewport.h Thu Sep 24 16:51:14 2020 +0200 @@ -98,13 +98,23 @@ void PostConstructor(); + void RefreshCanvasSize(); + + unsigned int GetCanvasWidth() const + { + return canvasWidth_; + } + + unsigned int GetCanvasHeight() + { + return canvasHeight_; + } + public: virtual ILock* Lock() ORTHANC_OVERRIDE; ~WebAssemblyViewport(); - virtual void UpdateCanvasSize(); - /** This method takes ownership */ @@ -124,19 +134,6 @@ return canvasCssSelector_; } - - void RefreshCanvasSize(); - - unsigned int GetCanvasWidth() const - { - return canvasWidth_; - } - - unsigned int GetCanvasHeight() - { - return canvasHeight_; - } - void FitForPrint(); // TODO - REMOVE }; }