From a239776b3f0ac7b76f55968fc52815f2e6ae980c Mon Sep 17 00:00:00 2001 From: zqm Date: Thu, 13 Nov 2025 15:05:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=AD=E5=BF=83=E6=8C=87?= =?UTF-8?q?=E7=A4=BA=E5=99=A8=E5=9C=A8=E9=BC=A0=E6=A0=87=E6=82=AC=E5=81=9C?= =?UTF-8?q?=E6=97=B6=E4=BD=8D=E7=BD=AE=E5=8F=98=E5=8A=A8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Web/src/DockLayout/DockIndicator.vue | 142 ++++++++++++------ 1 file changed, 95 insertions(+), 47 deletions(-) diff --git a/AutoRobot/Windows/Robot/Web/src/DockLayout/DockIndicator.vue b/AutoRobot/Windows/Robot/Web/src/DockLayout/DockIndicator.vue index 89af649..f55e7de 100644 --- a/AutoRobot/Windows/Robot/Web/src/DockLayout/DockIndicator.vue +++ b/AutoRobot/Windows/Robot/Web/src/DockLayout/DockIndicator.vue @@ -1,6 +1,6 @@ @@ -231,8 +235,11 @@ const props = defineProps({ // 鼠标悬停在哪个指示器上 const hoveredZone = ref(null) +// 鼠标是否悬停在中心指示器上(用于控制中心指示区的显示) +const isCenterIndicatorHovered = ref(false) // 延迟定时器 let mouseLeaveTimer = null +let centerLeaveTimer = null // 处理鼠标进入指示器 const handleMouseEnter = (zone) => { @@ -242,6 +249,11 @@ const handleMouseEnter = (zone) => { mouseLeaveTimer = null } hoveredZone.value = zone + + // 如果是中心指示器,设置专门的状态 + if (zone === 'center') { + isCenterIndicatorHovered.value = true + } } // 处理鼠标离开指示器 @@ -251,6 +263,12 @@ const handleMouseLeave = () => { hoveredZone.value = null mouseLeaveTimer = null }, 100) + + // 单独处理中心指示器的离开事件,设置延迟 + centerLeaveTimer = setTimeout(() => { + isCenterIndicatorHovered.value = false + centerLeaveTimer = null + }, 100) } // 清理定时器 @@ -258,6 +276,9 @@ onUnmounted(() => { if (mouseLeaveTimer) { clearTimeout(mouseLeaveTimer) } + if (centerLeaveTimer) { + clearTimeout(centerLeaveTimer) + } }) // 计算指示器的样式 @@ -404,15 +425,38 @@ watch(activeDockZone, (newZone) => { z-index: 9999; /* 确保在预览区域上方 */ } -/* 中心指示器:定位在目标区域的中心 */ -.indicator-center { +/* 中心区域容器:包装中心指示区和中心指示器 */ +.center-dock-container { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); + z-index: 9999; /* 确保在预览区域上方 */ + width: 185px; + height: 185px; + display: flex; + justify-content: center; + align-items: center; +} + +/* 中心指示区:较大的背景区域 */ +.indicator-center-area { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; opacity: 0.7; /* 默认半透明 */ transition: opacity 0.2s; - z-index: 9999; /* 确保在预览区域上方 */ + z-index: 1; /* 中心指示区在下层 */ +} + +/* 中心指示器:较小的图标,显示在中心指示区上层 */ +.indicator-center { + position: relative; + z-index: 2; /* 确保在中心指示区上方 */ + opacity: 0.7; /* 默认半透明 */ + transition: all 0.2s; /* 应用到所有属性的过渡 */ } /* 活动状态样式 */ @@ -434,7 +478,11 @@ watch(activeDockZone, (newZone) => { } .indicator-center.active { opacity: 1; /* 完全不透明 */ - transform: translate(-50%, -50%) scale(1.1); /* 保持中心居中的同时放大 */ + transform: scale(1.1); /* 只放大,不改变位置 */ +} + +.indicator-center-area.active { + opacity: 1; /* 完全不透明 */ transition: all 0.2s; } \ No newline at end of file