From e10c7cb8a9eea9805749c26f6161bbc7540b1ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mitja=20Bezen=C5=A1ek?= Date: Tue, 13 Feb 2024 14:34:17 +0100 Subject: [PATCH] Fix camera. (#2818) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes a bug with zoom interactions not working correctly. Before: https://github.com/tldraw/tldraw/assets/2523721/125e9aaa-681c-4242-bb9e-298dd41b7a97 After: https://github.com/tldraw/tldraw/assets/2523721/e59b950c-2c55-4663-91cc-fdc0c1403bb0 ### Change Type - [x] `patch` — Bug fix - [ ] `minor` — New feature - [ ] `major` — Breaking change - [ ] `dependencies` — Changes to package dependencies[^1] - [ ] `documentation` — Changes to the documentation only[^2] - [ ] `tests` — Changes to any test code only[^2] - [ ] `internal` — Any other changes that don't affect the published package[^2] - [ ] I don't know [^1]: publishes a `patch` release, for devDependencies use `internal` [^2]: will not publish a new version ### Test Plan 1. Zooming via the minimap should now correctly go through the zoom steps. 2. Other zoom interactions should work correctly (things like zoom to selection, zoom to 100%,...). - [ ] Unit Tests - [ ] End to end tests ### Release Notes - Fixes an issue with the camera and zooming. --- packages/editor/src/lib/editor/Editor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor/src/lib/editor/Editor.ts b/packages/editor/src/lib/editor/Editor.ts index e04cd5795..66523c2f3 100644 --- a/packages/editor/src/lib/editor/Editor.ts +++ b/packages/editor/src/lib/editor/Editor.ts @@ -2530,7 +2530,7 @@ export class Editor extends EventEmitter { return this._setCamera({ x: -targetViewportPage.x, y: -targetViewportPage.y, - z: viewportPageBounds.width / targetViewportPage.width, + z: this.getViewportScreenBounds().width / targetViewportPage.width, }) }