canvas: ios: different touch.force implementation
This commit is contained in:
parent
4984777dd8
commit
edb014e1da
5 changed files with 12 additions and 76 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue