Merge pull request #2064 from openseadragon/ig-drag

No longer firing canvas-drag-end if there is no canvas-drag preceding
This commit is contained in:
Ian Gilman 2021-11-22 11:35:01 -08:00 committed by GitHub
commit b3196a9756
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -271,7 +271,10 @@
lastPinchDist: 0,
currentPinchDist: 0,
lastPinchCenter: null,
currentPinchCenter: null
currentPinchCenter: null,
// Tracking for drag
sentDragEvent: false
};
this.hasGestureHandlers = !!( this.pressHandler || this.nonPrimaryPressHandler ||
@ -1446,6 +1449,8 @@
for ( i = 0; i < pointerListCount; i++ ) {
delegate.activePointersLists.pop();
}
delegate.sentDragEvent = false;
}
/**
@ -3476,7 +3481,7 @@
}
// Drag End
if ( tracker.dragEndHandler ) {
if ( tracker.dragEndHandler && delegate.sentDragEvent ) {
tracker.dragEndHandler(
{
eventSource: tracker,
@ -3492,6 +3497,9 @@
);
}
// We want to clear this flag regardless of whether we fired the dragEndHandler
delegate.sentDragEvent = false;
// Click / Double-Click
if ( ( tracker.clickHandler || tracker.dblClickHandler ) && updateGPoint.insideElement ) {
quick = releaseTime - updateGPoint.contactTime <= tracker.clickTimeThreshold &&
@ -3679,6 +3687,7 @@
}
);
eventInfo.preventDefault = true;
delegate.sentDragEvent = true;
}
} else if ( pointsList.contacts === 2 ) {
// Move (2 contacts, use center)