changeset 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 9a8fe40acfff
children 50229f6eb4cd
files Platforms/Wasm/wasm-viewport.ts
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Platforms/Wasm/wasm-viewport.ts	Thu Jan 17 21:41:38 2019 +0100
+++ b/Platforms/Wasm/wasm-viewport.ts	Fri Jan 18 10:16:33 2019 +0100
@@ -220,14 +220,27 @@
       });
 
       this.htmlCanvas_.addEventListener('touchstart', function(event) {
+        // don't propagate events to the whole body (this could zoom the entire page instead of zooming the viewport)
+        event.preventDefault();
+        event.stopPropagation();
+
         that.ResetTouch();
       });
     
       this.htmlCanvas_.addEventListener('touchend', function(event) {
+        // don't propagate events to the whole body (this could zoom the entire page instead of zooming the viewport)
+        event.preventDefault();
+        event.stopPropagation();
+
         that.ResetTouch();
       });
     
       this.htmlCanvas_.addEventListener('touchmove', function(event) {
+
+        // don't propagate events to the whole body (this could zoom the entire page instead of zooming the viewport)
+        event.preventDefault();
+        event.stopPropagation();
+
         if (that.touchTranslation_.length == 2) {
           var t = that.GetTouchTranslation(event);
           that.ViewportMouseMove(that.pimpl_, t[0], t[1]);