Fixed bug for Safari Technology Review pointer events

This commit is contained in:
Uwe Oestermeier 2019-03-22 11:59:28 +01:00
parent 155556ec6e
commit bef066abda
2 changed files with 10 additions and 3 deletions

View File

@ -29,6 +29,13 @@ export default class Events {
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) {
// Attempts to clone the which attribute of events failed in WebKit. May
// be this is a bug or a security feature. Workaround: we introduce

View File

@ -536,11 +536,11 @@ export class InteractionDelegate {
element.addEventListener(
'pointermove',
e => {
if (this.debug) console.log('pointermove', e.pointerId)
if (this.debug) console.log('pointermove', e.pointerId, e.pointerType)
if (
e.pointerType == 'touch' ||
(e.pointerType == 'mouse' && Events.isMouseDown(e))
(e.pointerType == 'mouse' && Events.isPointerDown(e))
) {
// this.capture(e) &&
if (this.debug)
@ -868,7 +868,7 @@ export class InteractionDelegate {
let point = extracted[key]
let updated = this.interaction.update(key, point)
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)
}
}