comparison Platforms/WebAssembly/wasm-application.js @ 229:b0ba3b38a23c am

ScheduleRedraw can handle multiple viewports
author am@osimis.io
date Thu, 14 Jun 2018 16:51:43 +0200
parents 210c1ce8e1a6
children
comparison
equal deleted inserted replaced
228:210c1ce8e1a6 229:b0ba3b38a23c
2 2
3 // Global context used by "library.js" 3 // Global context used by "library.js"
4 var viewport = null; 4 var viewport = null;
5 var WasmWebService_NotifyError = null; 5 var WasmWebService_NotifyError = null;
6 var WasmWebService_NotifySuccess = null; 6 var WasmWebService_NotifySuccess = null;
7 //var NotifyRestApiGet = null;
8 var NotifyUpdateContent = null; 7 var NotifyUpdateContent = null;
9 8
10 function UpdateContentThread() 9 function UpdateContentThread()
11 { 10 {
12 if (NotifyUpdateContent != null) { 11 if (NotifyUpdateContent != null) {
60 [ 'number', 'string', 'number' ]); 59 [ 'number', 'string', 'number' ]);
61 NotifyUpdateContent = StoneFrameworkModule.cwrap('NotifyUpdateContent', null, [ ]); 60 NotifyUpdateContent = StoneFrameworkModule.cwrap('NotifyUpdateContent', null, [ ]);
62 61
63 console.log("Creating main viewport"); 62 console.log("Creating main viewport");
64 63
65 viewport = new Stone.WasmViewport(StoneFrameworkModule, 'canvas'); 64 viewport = new Stone.WasmViewport(StoneFrameworkModule, canvasId);
66 viewport.Initialize(CreateCppViewport()); 65 viewport.Initialize(CreateCppViewport());
67 66
68 // Prevent scrolling 67 // Prevent scrolling
69 document.body.addEventListener('touchmove', function(event) { 68 document.body.addEventListener('touchmove', function(event) {
70 event.preventDefault(); 69 event.preventDefault();
71 }, false); 70 }, false);
72 71
73 document.getElementById('canvas').onclick = function() { 72 document.getElementById(canvasId).onclick = function() {
74 viewport.Redraw(); 73 viewport.Redraw();
75 }; 74 };
76 75
77 76
78 /************************************** */ 77 /************************************** */