Do not cancel when panning

This commit is contained in:
Tusooa Zhu 2021-08-02 17:15:53 -04:00
parent a94fb753a1
commit de150c0105
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
6 changed files with 16 additions and 6 deletions

File diff suppressed because one or more lines are too long

View file

@ -99,7 +99,9 @@ class PinchZoom extends HTMLElement {
const handled = !(isPan && !this._allowPan()); const handled = !(isPan && !this._allowPan());
if (handled) { if (handled) {
this._maybeStopPropagate(event); this._maybeStopPropagate(event);
this._maybeEmitCancel([pointer, ...pointerTracker.currentPointers]); if (!isPan) { // only cancel if something was propagated
this._maybeEmitCancel([pointer, ...pointerTracker.currentPointers]);
}
} }
event.preventDefault(); event.preventDefault();
return true; return true;

View file

@ -95,7 +95,9 @@ class PinchZoom extends HTMLElement {
const handled = !(isPan && !this._allowPan()); const handled = !(isPan && !this._allowPan());
if (handled) { if (handled) {
this._maybeStopPropagate(event); this._maybeStopPropagate(event);
this._maybeEmitCancel([pointer, ...pointerTracker.currentPointers]); if (!isPan) { // only cancel if something was propagated
this._maybeEmitCancel([pointer, ...pointerTracker.currentPointers]);
}
} }
event.preventDefault(); event.preventDefault();
return true; return true;

4
dist/pinch-zoom.js vendored
View file

@ -280,7 +280,9 @@ var PinchZoom = (function () {
const handled = !(isPan && !this._allowPan()); const handled = !(isPan && !this._allowPan());
if (handled) { if (handled) {
this._maybeStopPropagate(event); this._maybeStopPropagate(event);
this._maybeEmitCancel([pointer, ...pointerTracker.currentPointers]); if (!isPan) { // only cancel if something was propagated
this._maybeEmitCancel([pointer, ...pointerTracker.currentPointers]);
}
} }
event.preventDefault(); event.preventDefault();
return true; return true;

4
dist/pinch-zoom.mjs vendored
View file

@ -95,7 +95,9 @@ class PinchZoom extends HTMLElement {
const handled = !(isPan && !this._allowPan()); const handled = !(isPan && !this._allowPan());
if (handled) { if (handled) {
this._maybeStopPropagate(event); this._maybeStopPropagate(event);
this._maybeEmitCancel([pointer, ...pointerTracker.currentPointers]); if (!isPan) { // only cancel if something was propagated
this._maybeEmitCancel([pointer, ...pointerTracker.currentPointers]);
}
} }
event.preventDefault(); event.preventDefault();
return true; return true;

View file

@ -125,7 +125,9 @@ export default class PinchZoom extends HTMLElement {
const handled = !(isPan && !this._allowPan()); const handled = !(isPan && !this._allowPan());
if (handled) { if (handled) {
this._maybeStopPropagate(event); this._maybeStopPropagate(event);
this._maybeEmitCancel([pointer, ...pointerTracker.currentPointers]); if (!isPan) { // only cancel if something was propagated
this._maybeEmitCancel([pointer, ...pointerTracker.currentPointers]);
}
} }
event.preventDefault(); event.preventDefault();