Fix camera. (#2818)

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.
This commit is contained in:
Mitja Bezenšek 2024-02-13 14:34:17 +01:00 committed by GitHub
parent 8f9e6e4533
commit e10c7cb8a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2530,7 +2530,7 @@ export class Editor extends EventEmitter<TLEventMap> {
return this._setCamera({
x: -targetViewportPage.x,
y: -targetViewportPage.y,
z: viewportPageBounds.width / targetViewportPage.width,
z: this.getViewportScreenBounds().width / targetViewportPage.width,
})
}