# HG changeset patch # User am@osimis.io # Date 1538579657 -7200 # Node ID 97f16214dc5ef7767cfdf76d7173e53ce003b887 # Parent 8bdc6112bc2e8b87744c2361f5e123332f04a11a cleanup diff -r 8bdc6112bc2e -r 97f16214dc5e Platforms/Wasm/wasm-application-runner.ts --- 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 diff -r 8bdc6112bc2e -r 97f16214dc5e Platforms/Wasm/wasm-viewport.ts --- 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 ||