From 38588f2cca4fefc1006c5fe1fb4f677722b65d49 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 19 Oct 2022 23:08:41 +0200 Subject: [PATCH] canvas: io touch data polling tweak --- src/client/widgets/pads/canvas.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/client/widgets/pads/canvas.js b/src/client/widgets/pads/canvas.js index 25a0d875..1a737fc7 100644 --- a/src/client/widgets/pads/canvas.js +++ b/src/client/widgets/pads/canvas.js @@ -119,16 +119,18 @@ class CanvasWidget extends Canvas { if (iOS) { var code = String(this.getProp('onTouch')) if (iosEvents.some(x=>code.includes(x))) { + this.iosTouch = true this.iosTouchCache = {} this.iosTouchPolls = {} IOS_TOUCH_POLLING = true + // enable data getters in ../../events/utils.js } } this.on('draginit',(e)=>{ touchCb(e, 'start') - if (iOS && IOS_TOUCH_POLLING) { + if (iOS && this.iosTouch) { // cache touch inforamtions this.iosTouchCache[e.pointerId] = e // start polling extra touch inforamtions @@ -155,7 +157,7 @@ class CanvasWidget extends Canvas { this.on('drag',(e)=>{ touchCb(e, 'move') - if (iOS && IOS_TOUCH_POLLING) { + if (iOS && this.iosTouch) { // cache touch inforamtions this.iosTouchCache[e.pointerId] = e } @@ -163,7 +165,7 @@ class CanvasWidget extends Canvas { this.on('dragend',(e)=>{ touchCb(e, 'stop') - if (iOS && IOS_TOUCH_POLLING) { + if (iOS && this.iosTouch) { // stop polling extra touch inforamtions clearInterval(this.iosTouchPolls[e.pointerId]) delete this.iosTouchPolls[e.pointerId]