From 844e96f1276d8496cf7c230d6c56b9a5a59aa049 Mon Sep 17 00:00:00 2001 From: Sergio <64972770+ssr765@users.noreply.github.com> Date: Sun, 9 Jun 2024 19:02:57 +0200 Subject: [PATCH] feat: draw on correct position when resizing editor --- src/components/VpEditor.vue | 9 ++++++--- src/composables/useDraw.ts | 12 ++++++------ src/composables/useEditor.ts | 4 ++-- src/types.ts | 4 ++-- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/components/VpEditor.vue b/src/components/VpEditor.vue index e5fd04a..a62036b 100644 --- a/src/components/VpEditor.vue +++ b/src/components/VpEditor.vue @@ -27,6 +27,9 @@ const props = withDefaults( { width: 1280, height: 720 } ) +const widthRef = ref(props.width); +const heightRef = ref(props.height); + const history = defineModel('history', { default: [] }) const vpImage = ref() @@ -36,8 +39,8 @@ const { activeShape, setTool, undo, redo, save, reset } = useEditor({ tools: props.tools, history: toRef(history), settings: toRef(settings), - width: props.width, - height: props.height, + width: widthRef, + height: heightRef, emit }) @@ -52,7 +55,7 @@ onMounted(() => {