fix(touch): prevent infinite loop on multi-touch drag (#8470)

* Change in gesture.ts

* prettier
This commit is contained in:
AbhinavKRNarayan
2024-08-09 03:47:34 +05:30
committed by GitHub
parent cf5a3c0fa3
commit 6b3f9a6723
3 changed files with 12 additions and 4 deletions

View File

@@ -599,13 +599,20 @@ export class Gesture {
*/
handleTouchMove(e: PointerEvent) {
const pointerId = Touch.getTouchIdentifierFromEvent(e);
// Update the cache
this.cachedPoints.set(pointerId, this.getTouchPoint(e));
if (this.isPinchZoomEnabled && this.cachedPoints.size === 2) {
this.handlePinch(e);
} else {
this.handleMove(e);
// Handle the move directly instead of calling handleMove
this.updateFromEvent(e);
if (this.workspaceDragger) {
this.workspaceDragger.drag(this.currentDragDeltaXY);
} else if (this.dragger) {
this.dragger.onDrag(this.mostRecentEvent, this.currentDragDeltaXY);
}
e.preventDefault();
e.stopPropagation();
}
}

3
package-lock.json generated
View File

@@ -47,7 +47,7 @@
"markdown-tables-to-json": "^0.1.7",
"mocha": "^10.0.0",
"patch-package": "^8.0.0",
"prettier": "3.3.3",
"prettier": "^3.3.3",
"readline-sync": "^1.4.10",
"rimraf": "^5.0.0",
"typescript": "^5.3.3",
@@ -9600,6 +9600,7 @@
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz",
"integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==",
"dev": true,
"license": "MIT",
"bin": {
"prettier": "bin/prettier.cjs"
},

View File

@@ -134,7 +134,7 @@
"markdown-tables-to-json": "^0.1.7",
"mocha": "^10.0.0",
"patch-package": "^8.0.0",
"prettier": "3.3.3",
"prettier": "^3.3.3",
"readline-sync": "^1.4.10",
"rimraf": "^5.0.0",
"typescript": "^5.3.3",