Fix viewport on initial load

This commit is contained in:
Steve Ruiz 2022-01-14 20:57:54 +00:00
parent cb1f4e242e
commit 8cba193bfd
2 changed files with 5 additions and 3 deletions

View file

@ -1368,6 +1368,8 @@ export class TldrawApp extends StateManager<TDSnapshot> {
},
'loaded_document'
)
const { point, zoom } = this.pageState.camera
this.updateViewport(point, zoom)
return this
}

View file

@ -251,9 +251,9 @@ export class TranslateSession extends BaseSession {
? Utils.snapBoundsToGrid(Utils.translateBounds(initialCommonBounds, delta), currentGrid)
: Utils.translateBounds(initialCommonBounds, delta)
),
(this.isCloning ? this.snapInfo.bounds : this.snapInfo.others).filter(
(bounds) => Utils.boundsContain(viewport, bounds) || Utils.boundsCollide(viewport, bounds)
),
(this.isCloning ? this.snapInfo.bounds : this.snapInfo.others).filter((bounds) => {
return Utils.boundsContain(viewport, bounds) || Utils.boundsCollide(viewport, bounds)
}),
SNAP_DISTANCE / camera.zoom
)