Fixed bug for Safari Technology Review pointer events
This commit is contained in:
parent
155556ec6e
commit
bef066abda
@ -29,6 +29,13 @@ export default class Events {
|
|||||||
event.__capturedBy = obj
|
event.__capturedBy = obj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static isPointerDown(event) {
|
||||||
|
// According to
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events
|
||||||
|
// pointer events use the buttons feature to represent pressed buttons
|
||||||
|
return event.buttons
|
||||||
|
}
|
||||||
|
|
||||||
static isMouseDown(event) {
|
static isMouseDown(event) {
|
||||||
// Attempts to clone the which attribute of events failed in WebKit. May
|
// Attempts to clone the which attribute of events failed in WebKit. May
|
||||||
// be this is a bug or a security feature. Workaround: we introduce
|
// be this is a bug or a security feature. Workaround: we introduce
|
||||||
|
@ -536,11 +536,11 @@ export class InteractionDelegate {
|
|||||||
element.addEventListener(
|
element.addEventListener(
|
||||||
'pointermove',
|
'pointermove',
|
||||||
e => {
|
e => {
|
||||||
if (this.debug) console.log('pointermove', e.pointerId)
|
if (this.debug) console.log('pointermove', e.pointerId, e.pointerType)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
e.pointerType == 'touch' ||
|
e.pointerType == 'touch' ||
|
||||||
(e.pointerType == 'mouse' && Events.isMouseDown(e))
|
(e.pointerType == 'mouse' && Events.isPointerDown(e))
|
||||||
) {
|
) {
|
||||||
// this.capture(e) &&
|
// this.capture(e) &&
|
||||||
if (this.debug)
|
if (this.debug)
|
||||||
@ -868,7 +868,7 @@ export class InteractionDelegate {
|
|||||||
let point = extracted[key]
|
let point = extracted[key]
|
||||||
let updated = this.interaction.update(key, point)
|
let updated = this.interaction.update(key, point)
|
||||||
if (updated) {
|
if (updated) {
|
||||||
console.warn("new pointer in updateInteraction shouldn't happen")
|
console.warn("new pointer in updateInteraction shouldn't happen", key)
|
||||||
this.interactionStarted(event, key, point)
|
this.interactionStarted(event, key, point)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user