Skip to content

Commit 32d4aaf

Browse files
keyhellclaude
andcommitted
Default to fit-to-screen zoom on load when shapes exist
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 380f0fb commit 32d4aaf

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/components/replica-builder/lib/useBuilderState.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,13 @@ export function useBuilderState() {
9898
deleteHotkeysPlugin.attach(node);
9999
copyPastePlugin.attach(node);
100100
zoomPanPlugin.attach(node);
101-
zoomPanPlugin.resetPan();
102-
zoomPanPlugin.setZoom(1);
101+
const initialBounds = shapeStore.allShapesBoundingBox;
102+
if (initialBounds) {
103+
zoomPanPlugin.fitToShapes(initialBounds);
104+
} else {
105+
zoomPanPlugin.resetPan();
106+
zoomPanPlugin.setZoom(1);
107+
}
103108

104109
return () => {
105110
selectionPlugin.detach();

0 commit comments

Comments
 (0)