Mercurial > hg > orthanc-stone
comparison Platforms/WebAssembly/wasm-application.js @ 227:c8f11437a6fd am
getting ready for multiple viewports
author | am@osimis.io |
---|---|
date | Thu, 14 Jun 2018 13:28:40 +0200 |
parents | 1fa4c65c7e1b |
children | 210c1ce8e1a6 |
comparison
equal
deleted
inserted
replaced
226:1fa4c65c7e1b | 227:c8f11437a6fd |
---|---|
45 | 45 |
46 | 46 |
47 function InitializeWasmApplication(canvasId) | 47 function InitializeWasmApplication(canvasId) |
48 { | 48 { |
49 console.log("Initializing wasm-app"); | 49 console.log("Initializing wasm-app"); |
50 viewport = new Stone.WasmViewport(StoneFrameworkModule, 'canvas'); | |
51 viewport.Initialize(); | |
52 | 50 |
53 /******************** */ | 51 console.log("Connecting C++ methods to JS methods"); |
54 SetStartupParameter = StoneFrameworkModule.cwrap('SetStartupParameter', null, [ 'string', 'string' ]); | 52 SetStartupParameter = StoneFrameworkModule.cwrap('SetStartupParameter', null, [ 'string', 'string' ]); |
55 CreateWasmApplication = StoneFrameworkModule.cwrap('CreateWasmApplication', null, [ ], [ ]); | 53 CreateWasmApplication = StoneFrameworkModule.cwrap('CreateWasmApplication', null, [ 'any' ], [ ]); |
54 CreateCppViewport = StoneFrameworkModule.cwrap('CreateCppViewport', 'any', [ ], [ ]); | |
55 ReleaseCppViewport = StoneFrameworkModule.cwrap('ReleaseCppViewport', null, [ 'any' ], [ ]); | |
56 StartWasmApplication = StoneFrameworkModule.cwrap('StartWasmApplication', null, [ ], [ ]); | 56 StartWasmApplication = StoneFrameworkModule.cwrap('StartWasmApplication', null, [ ], [ ]); |
57 | |
58 /******************** */ | |
59 | |
60 // NotifyGlobalParameter = StoneFrameworkModule.cwrap('NotifyGlobalParameter', null, | |
61 // [ 'string', 'string' ]); | |
62 // ViewportUpdate = StoneFrameworkModule.cwrap('ViewportUpdate', null, | |
63 // [ 'string' ]); | |
64 WasmWebService_NotifySuccess = StoneFrameworkModule.cwrap('WasmWebService_NotifySuccess', null, | 57 WasmWebService_NotifySuccess = StoneFrameworkModule.cwrap('WasmWebService_NotifySuccess', null, |
65 [ 'number', 'string', 'array', 'number', 'number' ]); | 58 [ 'number', 'string', 'array', 'number', 'number' ]); |
66 WasmWebService_NotifyError = StoneFrameworkModule.cwrap('WasmWebService_NotifyError', null, | 59 WasmWebService_NotifyError = StoneFrameworkModule.cwrap('WasmWebService_NotifyError', null, |
67 [ 'number', 'string', 'number' ]); | 60 [ 'number', 'string', 'number' ]); |
68 //NotifyRestApiGet = Module.cwrap('NotifyRestApiGet', null, [ 'number', 'array', 'number' ]); | |
69 NotifyUpdateContent = StoneFrameworkModule.cwrap('NotifyUpdateContent', null, [ ]); | 61 NotifyUpdateContent = StoneFrameworkModule.cwrap('NotifyUpdateContent', null, [ ]); |
62 | |
63 console.log("Creating main viewport"); | |
64 | |
65 viewport = new Stone.WasmViewport(StoneFrameworkModule, 'canvas'); | |
66 viewport.Initialize(CreateCppViewport()); | |
70 | 67 |
71 // Prevent scrolling | 68 // Prevent scrolling |
72 document.body.addEventListener('touchmove', function(event) { | 69 document.body.addEventListener('touchmove', function(event) { |
73 event.preventDefault(); | 70 event.preventDefault(); |
74 }, false); | 71 }, false); |