From 6d5ec149fadd3da03b1e359235a90a6396ff7f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mitja=20Bezen=C5=A1ek?= Date: Thu, 11 Apr 2024 18:00:56 +0200 Subject: [PATCH] Fix panning. (#3445) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We also need to clear the timeout when panning. https://github.com/tldraw/tldraw/assets/2523721/f32fd4d0-332c-4a80-bed0-9ce49a68e1ab https://github.com/tldraw/tldraw/assets/2523721/e97f5fac-083f-4f77-ab72-40701790f039 Had an [alternative approach](https://github.com/tldraw/tldraw/pull/3444) of setting timeouts and clearing them in dispatch, but since the timeout is 500ms I think this should work as well. ### Change Type - [x] `sdk` — Changes the tldraw SDK - [ ] `dotcom` — Changes the tldraw.com web app - [ ] `docs` — Changes to the documentation, examples, or templates. - [ ] `vs code` — Changes to the vscode plugin - [ ] `internal` — Does not affect user-facing stuff - [x] `bugfix` — Bug fix - [ ] `feature` — New feature - [ ] `improvement` — Improving existing features - [ ] `chore` — Updating dependencies, other boring stuff - [ ] `galaxy brain` — Architectural changes - [ ] `tests` — Changes to any test code - [ ] `tools` — Changes to infrastructure, CI, internal scripts, debugging tools, etc. - [ ] `dunno` — I don't know --- packages/editor/src/lib/editor/Editor.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/editor/src/lib/editor/Editor.ts b/packages/editor/src/lib/editor/Editor.ts index 79ed3ac0f..df7df0c50 100644 --- a/packages/editor/src/lib/editor/Editor.ts +++ b/packages/editor/src/lib/editor/Editor.ts @@ -8668,6 +8668,7 @@ export class Editor extends EventEmitter { } if (this.inputs.isPanning && this.inputs.isPointing) { + clearTimeout(this._longPressTimeout) // Handle panning const { currentScreenPoint, previousScreenPoint } = this.inputs this.pan(Vec.Sub(currentScreenPoint, previousScreenPoint))