From 2809182e9bfe4cd3c6287208ffdad1557db8ddcb Mon Sep 17 00:00:00 2001 From: Steve Bauman Date: Fri, 6 Sep 2024 17:36:57 -0400 Subject: [PATCH] Fix fit-to-window Closes #213 --- components/Window.vue | 5 +++++ pages/generator.vue | 6 ++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/components/Window.vue b/components/Window.vue index bb84c67..4d54503 100644 --- a/components/Window.vue +++ b/components/Window.vue @@ -235,6 +235,11 @@ const props = defineProps({ }, }); +defineExpose({ + actualWidth: () => root.value.clientWidth, + actualHeight: () => root.value.clientHeight, +}); + const emit = defineEmits(['update:scale', 'update:title']); const { fontFamilies } = useFonts(); diff --git a/pages/generator.vue b/pages/generator.vue index 9f14b47..ddeba22 100644 --- a/pages/generator.vue +++ b/pages/generator.vue @@ -66,12 +66,10 @@ export default { watch(pane, (value) => { if (settings.lockWindowSize) { settings.width = - (pane.value.actualWidth() + Number(settings.lockWindowPaddingX)) * - settings.scale; + (value.actualWidth() + Number(settings.lockWindowPaddingX)) * settings.scale; settings.height = - (pane.value.actualHeight() + Number(settings.lockWindowPaddingY)) * - settings.scale; + (value.actualHeight() + Number(settings.lockWindowPaddingY)) * settings.scale; } nextTick(() => (ready.value = true));