changeset 314:97f16214dc5e am-2

cleanup
author am@osimis.io
date Wed, 03 Oct 2018 17:14:17 +0200
parents 8bdc6112bc2e
children aad37d0b6407
files Platforms/Wasm/wasm-application-runner.ts Platforms/Wasm/wasm-viewport.ts
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Platforms/Wasm/wasm-application-runner.ts	Wed Oct 03 17:01:05 2018 +0200
+++ b/Platforms/Wasm/wasm-application-runner.ts	Wed Oct 03 17:14:17 2018 +0200
@@ -55,7 +55,7 @@
 //   console.log(statusUpdateMessage);
 // }
 
-function _InitializeWasmApplication(canvasIds: string[], orthancBaseUrl: string): void {
+function _InitializeWasmApplication(orthancBaseUrl: string): void {
 
   CreateWasmApplication();
   WasmWebService_SetBaseUri(orthancBaseUrl);
@@ -73,14 +73,12 @@
   StartWasmApplication();
 
   // trigger a first resize of the canvas that have just been initialized
-  for (let canvasId of canvasIds) {
-    Stone.WasmViewport.GetFromCanvasId(canvasId).Resize();
-  }
+  Stone.WasmViewport.ResizeAll();
 
   UpdateContentThread();
 }
 
-function InitializeWasmApplication(wasmModuleName: string, orthancBaseUrl: string, canvasIds: string[]) {
+function InitializeWasmApplication(wasmModuleName: string, orthancBaseUrl: string) {
   
   Stone.Framework.Configure(wasmModuleName);
 
@@ -110,6 +108,6 @@
       event.preventDefault();
     }, false);
 
-    _InitializeWasmApplication(canvasIds, orthancBaseUrl);
+    _InitializeWasmApplication(orthancBaseUrl);
   });
 }
\ No newline at end of file
--- a/Platforms/Wasm/wasm-viewport.ts	Wed Oct 03 17:01:05 2018 +0200
+++ b/Platforms/Wasm/wasm-viewport.ts	Wed Oct 03 17:14:17 2018 +0200
@@ -19,7 +19,7 @@
   var canvasId = UTF8ToString(htmlCanvasId);
   var webViewport = new Stone.WasmViewport(StoneFrameworkModule, canvasId, cppViewportHandle);  // viewports are stored in a static map in WasmViewport -> won't be deleted
   webViewport.Initialize();
-  
+
   return cppViewportHandle;
 }
 
@@ -103,6 +103,12 @@
       return undefined;
     }
 
+    public static ResizeAll() {
+      for (let canvasId in WasmViewport.viewportsMapByCanvasId_) {
+        WasmViewport.viewportsMapByCanvasId_[canvasId].Resize();
+      }
+    }
+
     public Redraw() {
       if (this.imageData_ === null ||
           this.renderingBuffer_ === null ||