From 17b35b377c383d9832f9a0cc6b380adb57c72814 Mon Sep 17 00:00:00 2001 From: Dmitry Semenov Date: Tue, 8 Jan 2019 16:42:50 +0200 Subject: [PATCH] fix: pointer events on multi-input devices with Windows 10 and Chrome closes #1579, closes #1593 --- src/js/framework-bridge.js | 2 +- src/js/gestures.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/js/framework-bridge.js b/src/js/framework-bridge.js index 4be59f214..9c6c84fab 100644 --- a/src/js/framework-bridge.js +++ b/src/js/framework-bridge.js @@ -140,7 +140,7 @@ var framework = { features.caf = window.cancelAnimationFrame; } - features.pointerEvent = navigator.pointerEnabled || navigator.msPointerEnabled; + features.pointerEvent = !!(window.PointerEvent) || navigator.msPointerEnabled; // fix false-positive detection of old Android in new IE // (IE11 ua string contains "Android 4.0") diff --git a/src/js/gestures.js b/src/js/gestures.js index 7ee906e73..cccd4664d 100644 --- a/src/js/gestures.js +++ b/src/js/gestures.js @@ -641,9 +641,7 @@ var _gestureStartTime, if(pointerIndex > -1) { releasePoint = _currPointers.splice(pointerIndex, 1)[0]; - if(navigator.pointerEnabled) { - releasePoint.type = e.pointerType || 'mouse'; - } else { + if(navigator.msPointerEnabled) { var MSPOINTER_TYPES = { 4: 'mouse', // event.MSPOINTER_TYPE_MOUSE 2: 'touch', // event.MSPOINTER_TYPE_TOUCH @@ -654,6 +652,8 @@ var _gestureStartTime, if(!releasePoint.type) { releasePoint.type = e.pointerType || 'mouse'; } + } else { + releasePoint.type = e.pointerType || 'mouse'; } } @@ -1106,11 +1106,11 @@ _registerModule('Gestures', { } if(_pointerEventEnabled) { - if(navigator.pointerEnabled) { - addEventNames('pointer', 'down', 'move', 'up', 'cancel'); - } else { + if(navigator.msPointerEnabled) { // IE10 pointer events are case-sensitive addEventNames('MSPointer', 'Down', 'Move', 'Up', 'Cancel'); + } else { + addEventNames('pointer', 'down', 'move', 'up', 'cancel'); } } else if(_features.touch) { addEventNames('touch', 'start', 'move', 'end', 'cancel');