diff --git a/package.json b/package.json index c78b93b7..3350907e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "open-stage-control", "productName": "Open Stage Control", "description": "Libre and modular OSC / MIDI controller", - "version": "1.18.2-beta2", + "version": "1.18.2-beta3", "author": { "name": "Jean-Emmanuel Doucet", "email": "jean-emmanuel@ammd.net" diff --git a/src/client/events/drag.js b/src/client/events/drag.js index b410384a..d159deba 100644 --- a/src/client/events/drag.js +++ b/src/client/events/drag.js @@ -228,9 +228,17 @@ function triggerWidgetEvent(target, name, event) { // init DOM.ready(()=>{ - if (!iOS) document.addEventListener('pointermove', mouseMoveCapture, true) + + if (!iOS) { + document.addEventListener('pointermove', mouseMoveCapture, true) + if ('onwebkitmouseforcechanged' in document) document.addEventListener('webkitmouseforcechanged', mouseMoveCapture, true) + } if (!iOS) document.addEventListener('pointerup', mouseUpCapture, true) + document.addEventListener('touchmove', touchMoveCapture, true) + + if ('ontouchforcechange' in document) document.addEventListener('touchforcechange', touchMoveCapture, true) + DOM.addEventListener(document, 'touchend touchcancel', touchUpCapture, true) if (!iOS) document.addEventListener('pointerdown', mouseDownCapture) diff --git a/src/client/events/utils.js b/src/client/events/utils.js index ce7b562a..6ff567ea 100644 --- a/src/client/events/utils.js +++ b/src/client/events/utils.js @@ -1,5 +1,4 @@ const Touch = window.Touch || class Touch {} -const iOS = require('../ui/ios') // const cssTransformCoords = require('./transform-coords') @@ -8,7 +7,7 @@ module.exports = { fix: function(e) { - var ev = { + return { target: e.target, firstTarget: null, @@ -41,23 +40,6 @@ module.exports = { touchType: e.touchType } - if (iOS && IOS_TOUCH_POLLING) { - // iOS-specific event properties - ev.touchType = e.touchType - // iOS-pollable event properties - for (let p of ['altitudeAngle', 'azimuthAngle', 'force']) { - Object.defineProperty(ev, 'update_' + p, { - enumerable: false, - value: function(){ - var changed = this[p] !== e[p] - if (changed) this[p] = e[p] - return changed - } - }) - } - } - - return ev }, normalizeDragEvent: function(event, previousEvent) { diff --git a/src/client/globals.js b/src/client/globals.js index ec73f8c1..70a33037 100644 --- a/src/client/globals.js +++ b/src/client/globals.js @@ -30,8 +30,6 @@ window.DOUBLE_TAP_TIME = ENV.doubletap ? parseInt(ENV.doubletap) : 375 window.CLIENT_SYNC = parseInt(ENV.clientSync) !== 0 -window.IOS_TOUCH_POLLING = false - window.TOGGLE_ALT_TRAVERSING = !!ENV.altTraversing diff --git a/src/client/widgets/pads/canvas.js b/src/client/widgets/pads/canvas.js index e5a3ba76..8517498d 100644 --- a/src/client/widgets/pads/canvas.js +++ b/src/client/widgets/pads/canvas.js @@ -1,9 +1,7 @@ var Canvas = require('../common/canvas'), Script = require('../scripts/script'), widgetManager = require('../../managers/widgets'), - html = require('nanohtml'), - iOS = require('../../ui/ios'), - iosEvents = ['altitudeAngle', 'azimuthAngle', 'force'] + html = require('nanohtml') class CanvasWidget extends Canvas { @@ -116,60 +114,16 @@ class CanvasWidget extends Canvas { this.batchDraw() } - 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 (this.iosTouch) { - // cache touch inforamtions - this.iosTouchCache[e.pointerId] = e - // start polling extra touch inforamtions - this.iosTouchPolls[e.pointerId] = setInterval(()=>{ - if (!this.iosTouchCache[e.pointerId]) return - var changed = false - for (var p of iosEvents) { - // update event data - if (this.iosTouchCache[e.pointerId]['update_' + p]()) changed = true - } - if (changed) { - // if polled value has changed, retrig last move event - // reset movement data since this is only relevant when - // the pointer doesn't move - this.iosTouchCache[e.pointerId].movementX = 0 - this.iosTouchCache[e.pointerId].movementY = 0 - // call touch move callback - touchCb(this.iosTouchCache[e.pointerId], 'move') - } - }, 1000 / 30) - } }, {element: this.container, multitouch: true}) this.on('drag',(e)=>{ touchCb(e, 'move') - if (this.iosTouch) { - // cache touch inforamtions - this.iosTouchCache[e.pointerId] = e - } }, {element: this.container, multitouch: true}) this.on('dragend',(e)=>{ touchCb(e, 'stop') - if (this.iosTouch) { - // stop polling extra touch inforamtions - clearInterval(this.iosTouchPolls[e.pointerId]) - delete this.iosTouchPolls[e.pointerId] - delete this.iosTouchCache[e.pointerId] - } }, {element: this.container, multitouch: true}) } @@ -239,12 +193,6 @@ class CanvasWidget extends Canvas { clearInterval(this.drawInterval) - if (this.iosTouch) { - for (var k in this.iosTouchPolls) { - clearInterval(this.iosTouchPolls[k]) - } - } - super.onRemove() }