Skip to content

Commit

Permalink
fix(touch): prevent infinite loop on multi-touch drag (#8470)
Browse files Browse the repository at this point in the history
* Change in gesture.ts

* prettier
  • Loading branch information
AbhinavKRN authored Aug 8, 2024
1 parent cf5a3c0 commit 6b3f9a6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
11 changes: 9 additions & 2 deletions core/gesture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 6b3f9a6

Please sign in to comment.