Mercurial > hg > orthanc-stone
diff Platforms/Wasm/wasm-viewport.ts @ 466:5055031f4a06 bgo-commands-codegen
- Added browserify to build. This allows using require calls for modules that
work with tsc compiler.
- removed older stuff related to Protocol Buffers and Flatbuffers
- changed triple-slash references to import statements
- module prefixes are now added at call sites
- added cmake module for filename handling
- switched to Ninja for sample build
- Added virtual dtor in ICommand
author | bgo-osimis |
---|---|
date | Mon, 11 Feb 2019 16:00:04 +0100 |
parents | 8bf717c4e497 |
children | 7cdb4634846c |
line wrap: on
line diff
--- a/Platforms/Wasm/wasm-viewport.ts Wed Jan 16 21:08:38 2019 +0100 +++ b/Platforms/Wasm/wasm-viewport.ts Mon Feb 11 16:00:04 2019 +0100 @@ -1,3 +1,6 @@ +import wasmApplicationRunner = require('./wasm-application-runner'); +//import stoneFrameworkLoader = require('./stone-framework-loader'); + var isPendingRedraw = false; function ScheduleWebViewportRedraw(cppViewportHandle: any) : void @@ -7,24 +10,26 @@ console.log('Scheduling a refresh of the viewport, as its content changed'); window.requestAnimationFrame(function() { isPendingRedraw = false; - Stone.WasmViewport.GetFromCppViewport(cppViewportHandle).Redraw(); + WasmViewport.GetFromCppViewport(cppViewportHandle).Redraw(); }); } } +(<any>window).ScheduleWebViewportRedraw = ScheduleWebViewportRedraw; + declare function UTF8ToString(any): string; function CreateWasmViewport(htmlCanvasId: string) : any { - var cppViewportHandle = CreateCppViewport(); + var cppViewportHandle = wasmApplicationRunner.CreateCppViewport(); 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 + var webViewport = new WasmViewport((<any> window).StoneFrameworkModule, canvasId, cppViewportHandle); // viewports are stored in a static map in WasmViewport -> won't be deleted webViewport.Initialize(); return cppViewportHandle; } + +(<any>window).CreateWasmViewport = CreateWasmViewport; -module Stone { - // export declare type InitializationCallback = () => void; // export declare var StoneFrameworkModule : any; @@ -32,7 +37,7 @@ //const ASSETS_FOLDER : string = "assets/lib"; //const WASM_FILENAME : string = "orthanc-framework"; - export class WasmViewport { +export class WasmViewport { private static viewportsMapByCppHandle_ : Map<number, WasmViewport> = new Map<number, WasmViewport>(); // key = the C++ handle private static viewportsMapByCanvasId_ : Map<string, WasmViewport> = new Map<string, WasmViewport>(); // key = the canvasId @@ -291,5 +296,5 @@ } } -} + \ No newline at end of file