comparison Platforms/Wasm/wasm-application-runner.ts @ 722:28b9e3a54200

Undo mechanism implemented (not connected to UI yet). Undo stack and measuring tools are now handled by the ViewportController. Multi-touch does not crash trackers anymore.
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 21 May 2019 10:27:54 +0200
parents 70992b38aa8a
children 67d0a8da4afe
comparison
equal deleted inserted replaced
721:af0aa0c149fa 722:28b9e3a54200
20 export var CreateCppViewport: Function = null; 20 export var CreateCppViewport: Function = null;
21 var ReleaseCppViewport: Function = null; 21 var ReleaseCppViewport: Function = null;
22 var StartWasmApplication: Function = null; 22 var StartWasmApplication: Function = null;
23 export var SendSerializedMessageToStoneApplication: Function = null; 23 export var SendSerializedMessageToStoneApplication: Function = null;
24 24
25 var auxiliaryParameters : Map<string,string> = null;
26
27 export function SetApplicationParameters(params : Map<string,string>) {
28 if (auxiliaryParameters != null) {
29 console.warn("wasm-application-runner.SetApplicationParameters: about to overwrite the existing application parameters!")
30 }
31 auxiliaryParameters = params;
32 }
33
25 function DoAnimationThread() { 34 function DoAnimationThread() {
26 if (WasmDoAnimation != null) { 35 if (WasmDoAnimation != null) {
27 WasmDoAnimation(); 36 WasmDoAnimation();
28 } 37 }
29 38
30 // Update the viewport content every 100ms if need be 39 // Update the viewport content every 100ms if need be
31 setTimeout(DoAnimationThread, 100); 40 setTimeout(DoAnimationThread, 100);
32 } 41 }
42
33 43
34 function GetUriParameters(): Map<string, string> { 44 function GetUriParameters(): Map<string, string> {
35 var parameters = window.location.search.substr(1); 45 var parameters = window.location.search.substr(1);
36 46
37 if (parameters != null && 47 if (parameters != null &&
61 71
62 function _InitializeWasmApplication(orthancBaseUrl: string): void { 72 function _InitializeWasmApplication(orthancBaseUrl: string): void {
63 73
64 CreateWasmApplication(); 74 CreateWasmApplication();
65 75
66 // parse uri and transmit the parameters to the app before initializing it 76 // transmit the API-specified parameters to the app before initializing it
77 for (let key in auxiliaryParameters) {
78 if (auxiliaryParameters.hasOwnProperty(key)) {
79 Logger.defaultLogger.debug(
80 `About to call SetStartupParameter("${key}","${auxiliaryParameters[key]}")`);
81 SetStartupParameter(key, auxiliaryParameters[key]);
82 }
83 }
84
85 // parse uri and transmit the URI parameters to the app before initializing it
67 let parameters = GetUriParameters(); 86 let parameters = GetUriParameters();
68 87
69 for (let key in parameters) { 88 for (let key in parameters) {
70 if (parameters.hasOwnProperty(key)) { 89 if (parameters.hasOwnProperty(key)) {
71 Logger.defaultLogger.debug( 90 Logger.defaultLogger.debug(