Explorar el Código

style(cockpit): 缩小点位并优化 36px 聚合徽章视觉

点位本体宽 27→23、设备 21→18(约 -15%,单源 MARKER_BODY_WIDTH 生效于 billboard/DOM/设施/管线);聚合徽章改 36px 玻璃质感圆盘:径向高光+状态色描边/柔光、中心成员数、左上 14px 类型角标(同质行业图案/混合“混”)、右上 14px 最高异常数量(其余 +N 种)、下方轻量类别文案;聚合级特效收敛到 0.82 并降透明度,避免相邻聚合脉冲环互相压叠;标记 SVG 补一层轻落影提升在浅色底图上的可读性。几何常量集中在 AGGREGATE_BADGE 单源。
ChenJZ hace 2 días
padre
commit
23707b5a58

+ 13 - 7
src/modules/cockpit/domain/markerMetrics.js

@@ -40,10 +40,16 @@ export const MASTER_ASPECT = MASTER_SOURCE.bboxHeight / MASTER_SOURCE.bboxWidth
  */
 export const PAD_RATIO = MASTER_SOURCE.outlinePad / MASTER_SOURCE.bboxWidth
 
-/** 档位本体宽(屏显 CSS px)。监测设备档同时服务关联与未关联设备。 */
+/**
+ * 档位本体宽(屏显 CSS px)。监测设备档同时服务关联与未关联设备。
+ *
+ * 2026-11-24 维护者要求「缩小点位大小」:点位 27→23、设备 21→18(约 -15%),
+ * 为 36px 聚合徽章留出层级差(聚合符号略大于单体点位,仍能一眼区分「一组」与「一个」)。
+ * 只改这里,billboard / DOM / 设备素材 / 设施点 / 管线构件全部随单源生效。
+ */
 export const MARKER_BODY_WIDTH = {
-    point: 27,
-    device: 21,
+    point: 23,
+    device: 18,
 }
 
 /** 全局系数(规范 58 §八 / 票 72;渲染层只消费,不另造数值)。 */
@@ -108,10 +114,10 @@ export function tierOf(kind) {
 /**
  * 按对象种类取几何(本体宽 / 高 / pad / 绘制宽高)。
  *
- * 派生读数(验收直接断言这些值):
- *   · 监测点:pad 2.86、绘制宽 32.72;
- *   · 监测设备:pad 2.22、绘制宽 25.44;
- *   · 绘制比 = 1.286(「点比设备大」在屏幕上真的成立)。
+ * 派生读数(随单源变化;2026-11-24 缩小点位后):
+ *   · 监测点:pad ≈ 2.43、绘制宽 ≈ 27.87;
+ *   · 监测设备:pad ≈ 1.90、绘制宽 ≈ 21.81;
+ *   · 绘制比 ≈ 1.277(「点比设备大」在屏幕上仍然成立)。
  *
  * @param {string} kind `monitoring-point` / `monitoring-device` / `unassociated-equipment` / `overlap-aggregate`
  */

+ 14 - 0
src/modules/cockpit/domain/pointAggregation.js

@@ -29,6 +29,20 @@ export const DEFAULT_MIN_SPAN_METERS = 5
 /** 单个聚合组的屏幕离散上限(px):防止「一路相邻」的单链聚类把整张图并成一组。 */
 export const DEFAULT_MAX_SPREAD_PX = 90
 
+/**
+ * 聚合徽章几何(规格 69:默认 40px、最低备选 36px;本方案采用 **36px**)。
+ * 类型角标、异常角标与类别文案的尺寸也在这里单源声明,渲染层不另写数值。
+ */
+export const AGGREGATE_BADGE = {
+    size: 36,
+    typeChip: 14,
+    statusCorner: 14,
+    labelOffset: 39,
+    /** 聚合级特效相对单体环的收敛(避免多个聚合的脉冲环互相压叠)。 */
+    effectScale: 0.82,
+    effectOpacity: 0.85,
+}
+
 const EARTH_LAT_METERS = 110540
 const EARTH_LON_METERS = 111320
 const DEG = Math.PI / 180

+ 76 - 18
src/modules/cockpit/services/markerOverlay.js

@@ -49,7 +49,7 @@ import {
 // 票 83:几何读数(本体宽 / 绘制宽 / pad)与计划读数同一出口,走查不读 DOM 内部结构。
 import { markerGeometryDataset, innerIconFor } from '../domain/markerPlan.js'
 // 本票:未关联设备的屏幕拥挤聚合(纯 domain;本层只负责投影/渲染/点击)。
-import { AGGREGATE_KIND, aggregateBadge, canZoomAggregate, groupUnassociatedByScreen, planMemberList } from '../domain/pointAggregation.js'
+import { AGGREGATE_BADGE, AGGREGATE_KIND, aggregateBadge, canZoomAggregate, groupUnassociatedByScreen, planMemberList } from '../domain/pointAggregation.js'
 
 /**
  * 类名单源:注入的特效 CSS(下方模板串)与 DOM 构建(buildNode/mount)共用同一组常量。
@@ -393,7 +393,8 @@ function buildAggregateNode(key, row, toneHex, plan) {
         `top:${-(h + pad)}px`,
         `width:${plan.draw.width}px`,
         `height:${plan.draw.height}px`,
-        plan.desaturate ? 'filter:saturate(0.55) brightness(0.72)' : '',
+        // 美化:在原有降饱和之外补一层极轻的落影,让图标在浅色地形/底图上仍能「立住」。
+        'filter:' + (plan.desaturate ? 'saturate(0.55) brightness(0.72) ' : '') + 'drop-shadow(0 2px 3px rgba(0,0,0,0.55))',
     ].join(';')
     svg.style.transformOrigin = `${pad + w * plan.anchor.x}px ${h + pad}px`
     root.appendChild(svg)
@@ -600,7 +601,8 @@ function buildNode(key, marker, plan, toneHex, fx) {
         `top:${-(h + pad)}px`,
         `width:${plan.draw.width}px`,
         `height:${plan.draw.height}px`,
-        plan.desaturate ? 'filter:saturate(0.55) brightness(0.72)' : '',
+        // 美化:在原有降饱和之外补一层极轻的落影,让图标在浅色地形/底图上仍能「立住」。
+        'filter:' + (plan.desaturate ? 'saturate(0.55) brightness(0.72) ' : '') + 'drop-shadow(0 2px 3px rgba(0,0,0,0.55))',
     ].join(';')
     // 反应量缩放的**原点 = 尖端**(尖端固定在地面坐标上,标记围绕尖端放大/缩小,
     // 与 billboard verticalOrigin:BOTTOM + scale 同一行为)。
@@ -925,13 +927,20 @@ function badgeFingerprint(badge) {
 }
 
 /**
- * 聚合徽章节点(规格 69–72):圆形 40px,常驻「类别 + 准确成员数」,
- * 左上角是类型图案(同质单一行业)/通用“混”,右上角是最高优先级异常及数量(+N 种),
- * 外圈按最高优先级异常挂**唯一一套**聚合级特效,title 汇总类型与状态分布。
+ * 聚合徽章节点(规格 69–72,**36px 方案**)。
+ *
+ * 视觉:径向高光的玻璃质感圆盘 + 状态色描边/外辉光 + 中心成员数;
+ * 左上角类型角标(同质行业图案 / 混合“混”)、右上角最高优先级异常数量(其余异常 +N 种);
+ * 下方类别短文案;外圈只挂一套与最高异常一致的聚合级特效。
  */
 function buildUnassociatedAggregateNode(key, badge, tones) {
     const palette = tones || {}
     const toneHex = palette[badge.tone] || palette.neutral || '#01abea'
+    const abnormalTone = badge.abnormal ? (palette[badge.abnormal.tone] || toneHex) : toneHex
+    const size = AGGREGATE_BADGE.size
+    const chip = AGGREGATE_BADGE.typeChip
+    const corner = AGGREGATE_BADGE.statusCorner
+    const half = size / 2
 
     const root = document.createElement('div')
     root.className = NODE_CLASS + ' ' + NODE_CLASS + '--aggregate'
@@ -939,7 +948,7 @@ function buildUnassociatedAggregateNode(key, badge, tones) {
     root.dataset.markerOverlayKind = AGGREGATE_KIND
     root.dataset.markerOverlayCode = key
     root.dataset.markerOverlayAggregate = 'yes'
-    root.style.cssText = 'position:absolute;left:0;top:0;width:40px;height:40px;pointer-events:auto;cursor:pointer;transform-origin:50% 50%;'
+    root.style.cssText = 'position:absolute;left:0;top:0;width:' + size + 'px;height:' + size + 'px;pointer-events:auto;cursor:pointer;transform-origin:50% 50%;'
     root.style.setProperty('--marker-tone', toneHex)
     root.title = badge.tooltip || badge.label
 
@@ -948,27 +957,51 @@ function buildUnassociatedAggregateNode(key, badge, tones) {
     if (badge.effect && badge.effectStatus) {
         const profile = effectProfileFor(badge.effectStatus)
         if (profile && profile.effect === badge.effect) {
-            fxHost = buildFxLayers({ effect: profile.effect, profile, converge: null }, { draw: { width: 40 } }, toneHex, key)
+            fxHost = buildFxLayers({ effect: profile.effect, profile, converge: null }, { draw: { width: size } }, toneHex, key)
+            // 聚合级特效收敛:多个聚合相邻时,脉冲环不应互相压叠到看不见徽章。
+            fxHost.style.transform = 'scale(' + AGGREGATE_BADGE.effectScale + ')'
+            fxHost.style.opacity = String(AGGREGATE_BADGE.effectOpacity)
             root.appendChild(fxHost)
         }
     }
 
+    // 圆盘:径向高光(左上受光)+ 深色玻璃底 + 状态色描边与柔光。
     const circle = document.createElement('div')
-    circle.style.cssText = 'position:absolute;left:0;top:0;width:40px;height:40px;border-radius:50%;border:2px solid ' + toneHex + ';background:rgba(2,9,27,0.92);display:flex;align-items:center;justify-content:center;box-shadow:0 0 10px ' + toneHex + '66;'
+    circle.style.cssText = [
+        'position:absolute', 'left:0', 'top:0',
+        'width:' + size + 'px', 'height:' + size + 'px', 'border-radius:50%',
+        'border:1.5px solid ' + toneHex,
+        'background:radial-gradient(circle at 34% 28%, rgba(255,255,255,0.22) 0%, rgba(3,15,34,0.96) 56%, rgba(2,9,27,0.99) 100%)',
+        'box-shadow:inset 0 0 0 1px rgba(255,255,255,0.10), inset 0 -6px 10px rgba(0,0,0,0.45), 0 0 12px ' + toneHex + '59, 0 4px 10px rgba(0,0,0,0.55)',
+        'display:flex', 'align-items:center', 'justify-content:center',
+    ].join(';')
+    const sheen = document.createElement('div')
+    sheen.style.cssText = 'position:absolute;inset:1px;border-radius:50%;background:linear-gradient(180deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0) 52%);pointer-events:none;'
+    circle.appendChild(sheen)
     const countEl = document.createElement('span')
     countEl.textContent = String(badge.count)
-    countEl.style.cssText = 'color:#fff;font:600 15px/1 monospace;'
+    countEl.style.cssText = 'position:relative;color:#f4fbff;font:700 13px/1 "Bahnschrift","DIN Alternate","Segoe UI",monospace;letter-spacing:-0.02em;text-shadow:0 1px 3px rgba(0,0,0,0.85);'
     circle.appendChild(countEl)
     root.appendChild(circle)
 
-    // 类型图案:同质单一行业 → 该行业图案;混合 → 通用「混」。
+    // 类型角标:同质单一行业 → 该行业图案;混合 → 通用「混」。
     const typeEl = document.createElement('div')
-    typeEl.style.cssText = 'position:absolute;left:-6px;top:-6px;width:18px;height:18px;border-radius:50%;background:rgba(2,9,27,0.96);border:1px solid rgba(1,171,234,0.55);display:flex;align-items:center;justify-content:center;overflow:hidden;color:#9fd8f2;font:600 10px/1 sans-serif;'
+    typeEl.style.cssText = [
+        'position:absolute',
+        'left:' + (-Math.round(chip * 0.3)) + 'px',
+        'top:' + (-Math.round(chip * 0.3)) + 'px',
+        'width:' + chip + 'px', 'height:' + chip + 'px', 'border-radius:50%',
+        'background:radial-gradient(circle at 40% 30%, rgba(255,255,255,0.14), rgba(2,10,24,0.98) 70%)',
+        'border:1px solid ' + toneHex + '88',
+        'box-shadow:0 1px 4px rgba(0,0,0,0.65), 0 0 6px ' + toneHex + '33',
+        'display:flex', 'align-items:center', 'justify-content:center', 'overflow:hidden',
+        'color:#cfe9ff', 'font:700 8px/1 "Segoe UI",sans-serif',
+    ].join(';')
     const iconKey = badge.industryKey ? innerIconFor(badge.industryKey) : ''
     if (iconKey) {
         const img = document.createElement('img')
         img.alt = badge.typeLabel
-        img.style.cssText = 'width:14px;height:14px;display:block;'
+        img.style.cssText = 'width:' + (chip - 4) + 'px;height:' + (chip - 4) + 'px;display:block;'
         renderInnerIconUrl(iconKey).then((url) => { img.src = url }).catch(() => {})
         typeEl.appendChild(img)
     } else {
@@ -977,22 +1010,47 @@ function buildUnassociatedAggregateNode(key, badge, tones) {
     typeEl.title = '类型:' + badge.typeLabel
     root.appendChild(typeEl)
 
-    // 角标:最高优先级异常及数量;其余异常用 +N 种状态提示。
+    // 异常角标:最高优先级异常数量;其余异常以紧凑 +N 种提示。
     const statusEl = document.createElement('div')
     if (badge.abnormal) {
-        statusEl.textContent = badge.abnormal.count + (badge.otherAbnormalCount > 0 ? ' +' + badge.otherAbnormalCount : '')
+        statusEl.textContent = String(badge.abnormal.count)
         statusEl.title = badge.abnormal.label + ' ' + badge.abnormal.count
             + (badge.otherAbnormalCount > 0 ? ' · 另有 ' + badge.otherAbnormalCount + ' 种异常状态' : '')
-        const abnormalTone = palette[badge.abnormal.tone] || toneHex
-        statusEl.style.cssText = 'position:absolute;right:-10px;top:-10px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:' + abnormalTone + ';color:#02091b;font:700 10px/16px monospace;text-align:center;box-shadow:0 0 6px ' + abnormalTone + ';'
+        statusEl.style.cssText = [
+            'position:absolute',
+            'right:' + (-Math.round(corner * 0.55)) + 'px',
+            'top:' + (-Math.round(corner * 0.55)) + 'px',
+            'min-width:' + corner + 'px', 'height:' + corner + 'px',
+            'padding:0 3px', 'border-radius:' + Math.round(corner / 2) + 'px',
+            'background:linear-gradient(180deg, ' + abnormalTone + ', ' + abnormalTone + 'cc)',
+            'border:1px solid rgba(255,255,255,0.35)',
+            'box-shadow:0 0 8px ' + abnormalTone + 'cc, 0 2px 4px rgba(0,0,0,0.5)',
+            'color:#04121f', 'font:800 9px/' + corner + 'px "Bahnschrift",monospace',
+            'text-align:center',
+        ].join(';')
+        if (badge.otherAbnormalCount > 0) {
+            const more = document.createElement('span')
+            more.textContent = '+' + badge.otherAbnormalCount
+            more.style.cssText = 'position:absolute;right:-10px;top:-7px;padding:1px 2px;border-radius:4px;background:rgba(2,9,27,0.98);border:1px solid ' + abnormalTone + ';color:' + abnormalTone + ';font:700 8px/1 "Bahnschrift",monospace;'
+            statusEl.appendChild(more)
+        }
     } else {
         statusEl.style.display = 'none'
     }
     root.appendChild(statusEl)
 
+    // 类别短文案(常驻)。
     const label = document.createElement('span')
     label.textContent = badge.category
-    label.style.cssText = 'position:absolute;left:50%;top:42px;transform:translateX(-50%);padding:1px 5px;border-radius:3px;background:rgba(2,9,27,0.92);color:#9fd8f2;font:11px/1.4 sans-serif;white-space:nowrap;'
+    label.style.cssText = [
+        'position:absolute', 'left:50%', 'top:' + AGGREGATE_BADGE.labelOffset + 'px', 'transform:translateX(-50%)',
+        'padding:1px 6px', 'border-radius:5px',
+        'background:rgba(2,9,27,0.72)',
+        'border:1px solid rgba(140,200,255,0.22)',
+        'color:#b9dcf2', 'font:600 9px/1.35 "Microsoft YaHei UI","PingFang SC",sans-serif',
+        'letter-spacing:0.02em', 'white-space:nowrap',
+        'box-shadow:0 2px 6px rgba(0,0,0,0.4)',
+    ].join(';')
     root.appendChild(label)
 
     return { root, countEl, typeEl, statusEl, labelEl: label, fxHost, fp: badgeFingerprint(badge) }