From aa4404ed792e89439c70fb627a00f49d7040a37c Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Mon, 19 Aug 2024 15:22:34 +0300 Subject: [PATCH] fix(editor): Adjust default zoom level in new canvas (no-changelog) (#10469) --- packages/editor-ui/src/components/canvas/Canvas.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/editor-ui/src/components/canvas/Canvas.vue b/packages/editor-ui/src/components/canvas/Canvas.vue index b6440c933e1a7..460b764548728 100644 --- a/packages/editor-ui/src/components/canvas/Canvas.vue +++ b/packages/editor-ui/src/components/canvas/Canvas.vue @@ -269,7 +269,8 @@ function emitWithLastSelectedNode(emitFn: (id: string) => void) { * View */ -const zoom = ref(1); +const defaultZoom = 1; +const zoom = ref(defaultZoom); function onClickPane(event: MouseEvent) { const bounds = viewportRef.value?.getBoundingClientRect() ?? { left: 0, top: 0 }; @@ -282,7 +283,7 @@ function onClickPane(event: MouseEvent) { } async function onFitView() { - await fitView({ maxZoom: 1.2, padding: 0.2 }); + await fitView({ maxZoom: defaultZoom, padding: 0.2 }); } async function onZoomTo(zoomLevel: number) { @@ -298,7 +299,7 @@ async function onZoomOut() { } async function onResetZoom() { - await onZoomTo(1); + await onZoomTo(defaultZoom); } function onViewportChange(viewport: ViewportTransform) {