From 91a8ee33e3643d9c19c000772aa67ea9e3a2ec35 Mon Sep 17 00:00:00 2001 From: UmakanthKaspa Date: Sat, 3 May 2025 14:00:30 +0000 Subject: [PATCH 1/5] feat: add zoom controls to Studio Canvas --- frontend/src/components/StudioCanvas.vue | 36 ++++++++++++++++++++---- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/StudioCanvas.vue b/frontend/src/components/StudioCanvas.vue index acc77a03..2d1e39a1 100644 --- a/frontend/src/components/StudioCanvas.vue +++ b/frontend/src/components/StudioCanvas.vue @@ -74,13 +74,27 @@
+ + + + + + {{ Math.round(canvasProps.scale * 100) + "%" }} -
- -
+ + + + + + + + + + +
@@ -89,7 +103,6 @@ import { Ref, ref, watch, reactive, computed, onMounted, provide } from "vue" import { LoadingIndicator } from "frappe-ui" import StudioComponent from "@/components/StudioComponent.vue" -import FitScreenIcon from "@/components/Icons/FitScreenIcon.vue" import useStudioStore from "@/stores/studioStore" import { getBlockCopy, getBlockInfo } from "@/utils/helpers" @@ -278,6 +291,19 @@ onMounted(() => { setPanAndZoom(canvasProps, canvasEl, canvasContainerEl) }) +function zoomIn() { + if (canvasProps.scale < 2) { + canvasProps.scale = +(canvasProps.scale + 0.1).toFixed(2) + } +} + +function zoomOut() { + if (canvasProps.scale > 0.2) { + canvasProps.scale = +(canvasProps.scale - 0.1).toFixed(2) + } +} + + defineExpose({ history, rootComponent, From 95fa51c80bb5c000c039374849070370b7eb87b6 Mon Sep 17 00:00:00 2001 From: UmakanthKaspa Date: Sat, 3 May 2025 15:17:15 +0000 Subject: [PATCH 2/5] feat: add canvas-only zoom shortcuts (+, -, 0) with persistence and keyboard scope --- frontend/src/components/StudioCanvas.vue | 55 +++++++++++++++++++++--- frontend/src/utils/useCanvasUtils.ts | 9 +++- 2 files changed, 57 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/StudioCanvas.vue b/frontend/src/components/StudioCanvas.vue index 2d1e39a1..b38fd8da 100644 --- a/frontend/src/components/StudioCanvas.vue +++ b/frontend/src/components/StudioCanvas.vue @@ -19,6 +19,8 @@
- + @@ -86,12 +88,12 @@ {{ Math.round(canvasProps.scale * 100) + "%" }} - + - + @@ -100,7 +102,7 @@