mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-01-31 23:21:42 +03:00
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.
This commit is contained in:
parent
a4dbae0754
commit
c25bf0a239
@ -1357,11 +1357,11 @@
|
|||||||
* @private
|
* @private
|
||||||
* @inner
|
* @inner
|
||||||
*/
|
*/
|
||||||
function capturePointer( tracker, pointerType, touchCount ) {
|
function capturePointer( tracker, pointerType, pointerCount ) {
|
||||||
var pointsList = tracker.getActivePointersListByType( pointerType ),
|
var pointsList = tracker.getActivePointersListByType( pointerType ),
|
||||||
eventParams;
|
eventParams;
|
||||||
|
|
||||||
pointsList.captureCount += (pointerType === 'touch' ? touchCount : 1);
|
pointsList.captureCount += (pointerCount || 1);
|
||||||
|
|
||||||
if ( pointsList.captureCount === 1 ) {
|
if ( pointsList.captureCount === 1 ) {
|
||||||
if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) {
|
if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) {
|
||||||
@ -1400,11 +1400,11 @@
|
|||||||
* @private
|
* @private
|
||||||
* @inner
|
* @inner
|
||||||
*/
|
*/
|
||||||
function releasePointer( tracker, pointerType, touchCount ) {
|
function releasePointer( tracker, pointerType, pointerCount ) {
|
||||||
var pointsList = tracker.getActivePointersListByType( pointerType ),
|
var pointsList = tracker.getActivePointersListByType( pointerType ),
|
||||||
eventParams;
|
eventParams;
|
||||||
|
|
||||||
pointsList.captureCount -= (pointerType === 'touch' ? touchCount : 1);
|
pointsList.captureCount -= (pointerCount || 1);
|
||||||
|
|
||||||
if ( pointsList.captureCount === 0 ) {
|
if ( pointsList.captureCount === 0 ) {
|
||||||
if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) {
|
if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user