diff --git a/events.js b/events.js index f62b991..af675bb 100755 --- a/events.js +++ b/events.js @@ -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 diff --git a/interaction.js b/interaction.js index 1905dee..b051f94 100755 --- a/interaction.js +++ b/interaction.js @@ -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) } }