From c25bf0a2398abc95fec5fdead07ceac33aa14dfc Mon Sep 17 00:00:00 2001 From: Daniel Zimmermann Date: Sat, 14 May 2016 22:16:36 +1000 Subject: [PATCH] Correctly handle touch PointerEvents `onPointerDown/Up` may call `capture/releasePointer` with `"touch"` as the pointerType, which would result in a bug as `touchCount` would be `undefined`. `capture/releasePointer` should just default to a count of `1` if not specified. This properly retains the existing behaviour for non-TouchEvent handling. --- src/mousetracker.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mousetracker.js b/src/mousetracker.js index 6b78f4d8..498a72ac 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -1357,11 +1357,11 @@ * @private * @inner */ - function capturePointer( tracker, pointerType, touchCount ) { + function capturePointer( tracker, pointerType, pointerCount ) { var pointsList = tracker.getActivePointersListByType( pointerType ), eventParams; - pointsList.captureCount += (pointerType === 'touch' ? touchCount : 1); + pointsList.captureCount += (pointerCount || 1); if ( pointsList.captureCount === 1 ) { if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) { @@ -1400,11 +1400,11 @@ * @private * @inner */ - function releasePointer( tracker, pointerType, touchCount ) { + function releasePointer( tracker, pointerType, pointerCount ) { var pointsList = tracker.getActivePointersListByType( pointerType ), eventParams; - pointsList.captureCount -= (pointerType === 'touch' ? touchCount : 1); + pointsList.captureCount -= (pointerCount || 1); if ( pointsList.captureCount === 0 ) { if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) {