From 8f8bbb55581294903d4efe33d8072cdc606e1b52 Mon Sep 17 00:00:00 2001 From: haex Date: Fri, 24 Oct 2025 14:33:56 +0200 Subject: [PATCH] fix window overview --- src/components/haex/desktop/index.vue | 78 +++++++++++++------------ src/components/haex/window/index.vue | 2 +- src/components/haex/window/overview.vue | 34 ++++++++--- src/components/haex/workspace/card.vue | 2 +- src/stores/vault/index.ts | 5 +- 5 files changed, 70 insertions(+), 51 deletions(-) diff --git a/src/components/haex/desktop/index.vue b/src/components/haex/desktop/index.vue index 9b36bbc..c630a1d 100644 --- a/src/components/haex/desktop/index.vue +++ b/src/components/haex/desktop/index.vue @@ -90,7 +90,8 @@
->({}) +const overviewWindowState = ref( + new Map(), +) // Calculate scale and card dimensions for each window watch( () => windowManager.showWindowOverview, (isOpen) => { if (isOpen) { - // Calculate scale for each window - windowManager.windows.forEach((window) => { - const scaleX = MAX_PREVIEW_WIDTH / window.width - const scaleY = MAX_PREVIEW_HEIGHT / window.height - const scale = Math.min(scaleX, scaleY, 1) // Never scale up, only down + // Wait for the Overview modal to mount and create the teleport targets + nextTick(() => { + windowManager.windows.forEach((window) => { + const scaleX = MAX_PREVIEW_WIDTH / window.width + const scaleY = MAX_PREVIEW_HEIGHT / window.height + const scale = Math.min(scaleX, scaleY, 1) - // Ensure minimum card size - const scaledWidth = window.width * scale - const scaledHeight = window.height * scale + // Ensure minimum card size + const scaledWidth = window.width * scale + const scaledHeight = window.height * scale - let finalScale = scale - if (scaledWidth < MIN_PREVIEW_WIDTH) { - finalScale = MIN_PREVIEW_WIDTH / window.width - } - if (scaledHeight < MIN_PREVIEW_HEIGHT) { - finalScale = Math.max(finalScale, MIN_PREVIEW_HEIGHT / window.height) - } + let finalScale = scale + if (scaledWidth < MIN_PREVIEW_WIDTH) { + finalScale = MIN_PREVIEW_WIDTH / window.width + } + if (scaledHeight < MIN_PREVIEW_HEIGHT) { + finalScale = Math.max(finalScale, MIN_PREVIEW_HEIGHT / window.height) + } - overviewWindowState[window.id] = { - x: 0, - y: 0, - width: window.width, // Keep original width - height: window.height, // Keep original height - scale: finalScale, // Store the scale factor - } + overviewWindowState.value.set(window.id, { + x: 0, + y: 0, + width: window.width, + height: window.height, + scale: finalScale, + }) + }) }) + } else { + // Clear state when overview is closed + overviewWindowState.value.clear() } }, - { immediate: true }, ) // Disable Swiper in overview mode diff --git a/src/components/haex/window/index.vue b/src/components/haex/window/index.vue index f9cd959..7cb49fe 100644 --- a/src/components/haex/window/index.vue +++ b/src/components/haex/window/index.vue @@ -3,7 +3,7 @@ ref="windowEl" :style="windowStyle" :class="[ - 'absolute bg-default/80 backdrop-blur-xl rounded-xl shadow-2xl overflow-hidden isolate', + 'absolute bg-default/80 backdrop-blur-xl rounded-lg shadow-xl overflow-hidden isolate', 'border border-gray-200 dark:border-gray-700 transition-all ease-out duration-600 ', 'flex flex-col @container', { 'select-none': isResizingOrDragging }, diff --git a/src/components/haex/window/overview.vue b/src/components/haex/window/overview.vue index 32b84e1..2c1c2d7 100644 --- a/src/components/haex/window/overview.vue +++ b/src/components/haex/window/overview.vue @@ -1,20 +1,20 @@