diff --git a/src/components/ScreenshotOverlay.vue b/src/components/ScreenshotOverlay.vue index cf80ace..e568fc0 100644 --- a/src/components/ScreenshotOverlay.vue +++ b/src/components/ScreenshotOverlay.vue @@ -8,7 +8,7 @@ >
拖动选择截图区域 · Esc取消
-
+
@@ -29,6 +29,21 @@ const state = { const hasSelection = ref(false) const isCapturing = ref(false) +const actionsStyle = computed(() => { + if (!hasSelection.value) return {} + const x = Math.min(state.startX, state.endX) + const y = Math.min(state.startY, state.endY) + const w = Math.abs(state.endX - state.startX) + const h = Math.abs(state.endY - state.startY) + const panelW = 160 + const gap = 8 + let left = x + w - panelW + let top = y + h + gap + if (left < 4) left = 4 + if (top + 40 > window.innerHeight) top = y - 40 - gap + return { left: left + 'px', top: top + 'px', transform: 'none', bottom: 'auto' } +}) + onMounted(() => { document.addEventListener('keydown', onKeyDown) }) @@ -172,9 +187,6 @@ function onKeyDown(e: KeyboardEvent) { .screenshot-actions { position: fixed; - bottom: 40px; - left: 50%; - transform: translateX(-50%); display: flex; gap: 10px; pointer-events: auto;