comparison Platforms/Wasm/wasm-viewport.ts @ 453:59b4afa92dee

TS: stop propagating touch events to the whole html doc
author Alain Mazy <alain@mazy.be>
date Fri, 18 Jan 2019 10:16:33 +0100
parents 8bf717c4e497
children 50229f6eb4cd
comparison
equal deleted inserted replaced
452:9a8fe40acfff 453:59b4afa92dee
218 that.ViewportMouseWheel(that.pimpl_, event.deltaY, x, y, event.ctrlKey); 218 that.ViewportMouseWheel(that.pimpl_, event.deltaY, x, y, event.ctrlKey);
219 event.preventDefault(); 219 event.preventDefault();
220 }); 220 });
221 221
222 this.htmlCanvas_.addEventListener('touchstart', function(event) { 222 this.htmlCanvas_.addEventListener('touchstart', function(event) {
223 // don't propagate events to the whole body (this could zoom the entire page instead of zooming the viewport)
224 event.preventDefault();
225 event.stopPropagation();
226
223 that.ResetTouch(); 227 that.ResetTouch();
224 }); 228 });
225 229
226 this.htmlCanvas_.addEventListener('touchend', function(event) { 230 this.htmlCanvas_.addEventListener('touchend', function(event) {
231 // don't propagate events to the whole body (this could zoom the entire page instead of zooming the viewport)
232 event.preventDefault();
233 event.stopPropagation();
234
227 that.ResetTouch(); 235 that.ResetTouch();
228 }); 236 });
229 237
230 this.htmlCanvas_.addEventListener('touchmove', function(event) { 238 this.htmlCanvas_.addEventListener('touchmove', function(event) {
239
240 // don't propagate events to the whole body (this could zoom the entire page instead of zooming the viewport)
241 event.preventDefault();
242 event.stopPropagation();
243
231 if (that.touchTranslation_.length == 2) { 244 if (that.touchTranslation_.length == 2) {
232 var t = that.GetTouchTranslation(event); 245 var t = that.GetTouchTranslation(event);
233 that.ViewportMouseMove(that.pimpl_, t[0], t[1]); 246 that.ViewportMouseMove(that.pimpl_, t[0], t[1]);
234 } 247 }
235 else if (that.touchZoom_.length == 3) { 248 else if (that.touchZoom_.length == 3) {