From 9584ccb4cf848eb76dcd6fab155326c85d8f341f Mon Sep 17 00:00:00 2001 From: zqm Date: Tue, 27 Jan 2026 14:34:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=8C=87=E7=A4=BA=E5=99=A8?= =?UTF-8?q?=E5=B0=BA=E5=AF=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Web/src/DockLayout/DockIndicator.vue | 47 +++++++------------ 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/AutoRobot/Windows/Robot/Web/src/DockLayout/DockIndicator.vue b/AutoRobot/Windows/Robot/Web/src/DockLayout/DockIndicator.vue index b2c6f98..0ed8e19 100644 --- a/AutoRobot/Windows/Robot/Web/src/DockLayout/DockIndicator.vue +++ b/AutoRobot/Windows/Robot/Web/src/DockLayout/DockIndicator.vue @@ -904,55 +904,42 @@ const edgeIndicatorStyle = computed(() => { const { width, height } = safeTargetRect.value; // 基础尺寸定义: - // - baseWidth: 水平指示器(上下)的宽度,也是垂直指示器(左右)的高度 - // - baseHeight: 水平指示器(上下)的高度,也是垂直指示器(左右)的宽度 - const baseWidth = 40; // 基础水平宽度/垂直高度(上下指示器宽40px,左右指示器高40px) - const baseHeight = 20; // 基础水平高度/垂直宽度(上下指示器高20px,左右指示器宽20px) + // - baseSize: 边缘指示器的基础尺寸,与独立中心指示器(41x41px)保持协调 + const baseSize = 40; // 基础尺寸,与独立中心指示器(41x41px)接近 // 根据目标区域尺寸调整指示器大小 const minTargetSize = 100; // 从100px开始缩小,与最小显示尺寸80px保持协调 - const maxIndicatorSizeRatio = 0.25; // 指示器最大尺寸不超过目标区域的25%,确保在小Area上不过大 - let indicatorWidth = baseWidth; - let indicatorHeight = baseHeight; + let indicatorSize = baseSize; const targetMinSize = Math.min(width, height); if (targetMinSize < minTargetSize) { - // 按比例缩小边缘指示器 + // 只有当目标区域小于最小尺寸时,才按比例缩小边缘指示器 const scaleFactor = targetMinSize / minTargetSize; - - // 计算缩小后的尺寸 - let scaledWidth = Math.floor(baseWidth * scaleFactor); - let scaledHeight = Math.floor(baseHeight * scaleFactor); - - // 确保指示器不超过目标区域的最大比例 - const maxWidth = Math.floor(width * maxIndicatorSizeRatio); - const maxHeight = Math.floor(height * maxIndicatorSizeRatio); - - // 取较小值作为最终尺寸 - indicatorWidth = Math.max(15, Math.min(scaledWidth, maxWidth)); // 降低最小宽度到15px - indicatorHeight = Math.max(8, Math.min(scaledHeight, maxHeight)); // 降低最小高度到8px + indicatorSize = Math.floor(baseSize * scaleFactor); + // 确保指示器不小于最小尺寸 + indicatorSize = Math.max(15, indicatorSize); // 最小尺寸15px } + // 当目标区域足够大时,保持基础尺寸 return { // 边缘指示器保持现有CSS的定位方式(使用top/right/bottom/left相对于容器边缘) // 仅调整大小,不修改定位属性,避免与现有CSS冲突 - // 水平边缘指示器(上、下):宽 > 高 + // 所有边缘指示器现在都是正方形,与独立中心指示器保持协调 indicatorTop: { - width: `${indicatorWidth}px`, // 水平指示器宽度 - height: `${indicatorHeight}px` // 水平指示器高度 + width: `${indicatorSize}px`, // 正方形宽度 + height: `${indicatorSize}px` // 正方形高度 }, indicatorBottom: { - width: `${indicatorWidth}px`, // 水平指示器宽度 - height: `${indicatorHeight}px` // 水平指示器高度 + width: `${indicatorSize}px`, // 正方形宽度 + height: `${indicatorSize}px` // 正方形高度 }, - // 垂直边缘指示器(左、右):高 > 宽 indicatorLeft: { - width: `${indicatorHeight}px`, // 垂直指示器宽度(使用水平指示器的高度) - height: `${indicatorWidth}px` // 垂直指示器高度(使用水平指示器的宽度) + width: `${indicatorSize}px`, // 正方形宽度 + height: `${indicatorSize}px` // 正方形高度 }, indicatorRight: { - width: `${indicatorHeight}px`, // 垂直指示器宽度(使用水平指示器的高度) - height: `${indicatorWidth}px` // 垂直指示器高度(使用水平指示器的宽度) + width: `${indicatorSize}px`, // 正方形宽度 + height: `${indicatorSize}px` // 正方形高度 } }; });