Skip to content

Commit

Permalink
fix(canvas): fix auto zoom on diagram load (chartdb#395)
Browse files Browse the repository at this point in the history
guyb1 authored Nov 13, 2024
1 parent 42c1596 commit 492c932
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/pages/editor-page/canvas/canvas.tsx
Original file line number Diff line number Diff line change
@@ -166,7 +166,13 @@ export const Canvas: React.FC<CanvasProps> = ({ initialTables, readonly }) => {

useEffect(() => {
if (!isInitialLoadingNodes) {
setTimeout(() => fitView({ maxZoom: 1, duration: 0 }), 0);
debounce(() => {
fitView({
duration: 200,
padding: 0.1,
maxZoom: 0.8,
});
}, 500)();
}
}, [isInitialLoadingNodes, fitView]);

0 comments on commit 492c932

Please sign in to comment.