Kaynağa Gözat

fix(cockpit): 深度层级加迟滞并重做聚合成员面板

深度排序新增 stabilizeZIndex(缓冲 8 个 z 单位):图标/徽章/标签逐帧计算后只有跨过缓冲才换层,避免距离接近时反复交换层级。聚合成员面板从调试列表重做为「点位摘要」同款:三停渐变+磨砂+色条标题+状态分布 chips+搜索+成员信息卡片(名称/编码/类型/状态),并锚定徽章逐帧跟随、视口内夹取;面板 z-index 提到 9999,卸载时清理样式。
ChenJZ 1 gün önce
ebeveyn
işleme
38e9af808f

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

@@ -104,6 +104,16 @@ export function depthZIndex(distance, { min = 1, max = 900 } = {}) {
     return Math.round(max - (max - min) * t)
 }
 
+/** 深度层级迟滞(z 单位):两个图标距离接近时,不因逐帧微小变化交换层级。 */
+export const DEPTH_Z_HYSTERESIS = 8
+
+/** 稳定 z-index:变化不足阈值时保持原值;首次直接采用,新值非法时保持原值。 */
+export function stabilizeZIndex(previous, next, hysteresis = DEPTH_Z_HYSTERESIS) {
+    if (!Number.isFinite(next)) return Number.isFinite(previous) ? previous : 1
+    if (!Number.isFinite(previous)) return next
+    return Math.abs(next - previous) > hysteresis ? next : previous
+}
+
 /** 类型字的行业色语义:沿用管线行业色单源(燃气红 / 供水蓝 / 排水绿 / 窨井紫)。 */
 export function typeCharOf(industry, fallback = '设') {
     return TYPE_CHAR[industry] || fallback

+ 270 - 79
src/modules/cockpit/services/markerOverlay.js

@@ -49,7 +49,7 @@ import {
 // 票 83:几何读数(本体宽 / 绘制宽 / pad)与计划读数同一出口,走查不读 DOM 内部结构。
 import { markerGeometryDataset } from '../domain/markerPlan.js'
 // 本票:未关联设备的屏幕拥挤聚合(纯 domain;本层只负责投影/渲染/点击)。
-import { AGGREGATE_BADGE, AGGREGATE_KIND, aggregateBadge, canZoomAggregate, depthZIndex, groupMonitoringPointsByScreen, groupUnassociatedByScreen, labelOccludedByAggregates, planMemberList } from '../domain/pointAggregation.js'
+import { AGGREGATE_BADGE, AGGREGATE_KIND, aggregateBadge, canZoomAggregate, depthZIndex, groupMonitoringPointsByScreen, groupUnassociatedByScreen, labelOccludedByAggregates, planMemberList, stabilizeZIndex } from '../domain/pointAggregation.js'
 
 /**
  * 类名单源:注入的特效 CSS(下方模板串)与 DOM 构建(buildNode/mount)共用同一组常量。
@@ -234,8 +234,52 @@ export function refreshMarkerFx() {
     pool.clear()
 }
 
+/**
+ * 聚合成员面板样式(与「点位摘要 / 设备详情 / 设施详情」同一套视觉 token):
+ * 三停渐变 + 磨砂 + 细描边 + 标题左侧色条;成员用信息卡片而不是调试行。
+ */
+function buildAggregatePanelCss() {
+    return `
+.aggregate-panel{position:absolute;z-index:9999;display:flex;flex-direction:column;width:300px;max-height:340px;overflow:hidden;pointer-events:auto;border:1px solid var(--panel-line,rgba(1,171,234,.35));border-radius:8px;background:linear-gradient(180deg,var(--panel-top,rgba(2,9,27,.28)) 0%,var(--panel-mid,rgba(0,53,156,.2)) 26%,var(--panel-bot,rgba(0,15,52,.38)) 100%);backdrop-filter:blur(16px) saturate(115%);-webkit-backdrop-filter:blur(16px) saturate(115%);box-shadow:inset 0 1px 0 rgba(1,171,234,.14),0 18px 44px rgba(0,0,0,.55);color:var(--text-2,#88b7e8);font:var(--fs-caption,10.5px) "Microsoft YaHei UI","PingFang SC",sans-serif}
+.aggregate-panel *{box-sizing:border-box}
+.aggregate-panel__head{display:flex;align-items:center;gap:8px;min-height:32px;padding:0 8px;border-bottom:1px solid rgba(1,171,234,.22);background:linear-gradient(90deg,var(--panel-mid,rgba(0,53,156,.2)) 0%,var(--panel-bot,rgba(0,15,52,.38)) 42%,transparent 78%)}
+.aggregate-panel__title{position:relative;flex:1 1 auto;min-width:0;padding-left:10px;overflow:hidden;color:var(--text,#e8f7ff);font-size:14.5px;font-weight:700;letter-spacing:.1em;white-space:nowrap;text-overflow:ellipsis;text-shadow:0 0 12px rgba(1,171,234,.6)}
+.aggregate-panel__title::before{content:'';position:absolute;left:0;top:50%;width:4px;height:14px;transform:translateY(-50%);background:linear-gradient(180deg,var(--cyan-hi,#6fe3ff),var(--cyan-d,#009de9));box-shadow:0 0 10px var(--cyan,#01abea)}
+.aggregate-panel__action{flex:none;padding:1px 8px;border:1px solid rgba(1,171,234,.42);border-radius:8px;background:rgba(0,20,72,.6);color:var(--text-2,#88b7e8);font:inherit;letter-spacing:.04em;white-space:nowrap;cursor:pointer}
+.aggregate-panel__action:hover,.aggregate-panel__action:focus-visible{color:var(--text-strong,#e8f7ff);border-color:rgba(1,171,234,.75);outline:none}
+.aggregate-panel__body{flex:1 1 auto;min-height:0;padding:8px 10px 10px;overflow-y:auto;overflow-x:hidden}
+.aggregate-panel__summary{margin:0 0 6px;color:var(--text-3,#6f9fc4);font-size:10.5px;line-height:1.5}
+.aggregate-panel__chips{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:6px}
+.aggregate-panel__chip{display:inline-flex;align-items:center;gap:4px;padding:1px 6px;border:1px solid rgba(1,171,234,.25);border-radius:6px;background:rgba(2,10,20,.55);font-size:10px;white-space:nowrap}
+.aggregate-panel__dot{flex:none;width:6px;height:6px;border-radius:50%;box-shadow:0 0 6px currentColor}
+.aggregate-panel__search{width:100%;margin:0 0 6px;padding:4px 7px;border:1px solid rgba(1,171,234,.35);border-radius:6px;background:rgba(0,0,0,.35);color:var(--text,#e8f7ff);font:11px "Microsoft YaHei UI","PingFang SC",sans-serif;outline:none}
+.aggregate-panel__search::placeholder{color:var(--text-4,#5b87aa)}
+.aggregate-panel__card{display:flex;flex-direction:column;gap:1px;width:100%;margin:0 0 4px;padding:6px 7px;border:1px solid rgba(1,171,234,.22);border-radius:6px;background:rgba(2,20,40,.55);color:inherit;text-align:left;cursor:pointer;font:inherit}
+.aggregate-panel__card:hover{border-color:rgba(1,171,234,.65);background:rgba(1,171,234,.12)}
+.aggregate-panel__card-top{display:flex;align-items:center;justify-content:space-between;gap:6px}
+.aggregate-panel__name{overflow:hidden;color:var(--text-strong,#e8f7ff);font-size:12px;font-weight:700;white-space:nowrap;text-overflow:ellipsis}
+.aggregate-panel__status{display:inline-flex;align-items:center;gap:4px;padding:0 5px;border:1px solid currentColor;border-radius:9px;font-size:10px;white-space:nowrap}
+.aggregate-panel__meta{overflow:hidden;color:var(--text-3,#6f9fc4);font:10px "Bahnschrift","Consolas",monospace;white-space:nowrap;text-overflow:ellipsis}
+.aggregate-panel__type{color:var(--text-2,#88b7e8)}
+.aggregate-panel__hint{margin:4px 0 0;color:var(--text-4,#5b87aa);font-size:9.5px;text-align:right}
+`
+}
+
+const AGGREGATE_PANEL_STYLE_ID = 'marker-overlay-aggregate-panel-styles'
+
+function ensureAggregatePanelStyles() {
+    if (typeof document === 'undefined') return
+    if (document.getElementById(AGGREGATE_PANEL_STYLE_ID)) return
+    const style = document.createElement('style')
+    style.id = AGGREGATE_PANEL_STYLE_ID
+    style.textContent = buildAggregatePanelCss()
+    document.head.appendChild(style)
+}
+
 /** 每帧由 `syncMarkerOverlay` 注入的门控查询(mapService 从 domain 动效计划产出)。 */
 let frameEffectOf = () => ''
+/** 当前帧色板:成员卡片的状态色与徽章同源(点击打开面板时取用)。 */
+let frameTones = {}
 /** 票 85:降级收敛系数(null = 未降级);同一屏所有环共享。 */
 let frameConverge = null
 /** 关联设备层的门控查询(票 84:三类对象的环统一走同一条门控)。 */
@@ -510,9 +554,18 @@ let aggregateSelectedCode = ''
 let lastAggregateGroups = []
 /** 监测点聚合的上一帧分组(与设备分组分开,互不串用迟滞历史)。 */
 let lastPointAggregateGroups = []
-/** 成员列表面板(宿主子节点,单例)。 */
+/** 成员列表面板(宿主子节点,单例,跟随聚合徽章)。 */
 let memberListEl = null
 let memberListGroupKey = ''
+let memberListAnchorCode = ''
+let memberListFingerprint = ''
+let memberListQuery = ''
+let memberListTones = null
+let memberListOnPick = null
+let memberListTitleEl = null
+let memberListSummaryEl = null
+let memberListChipsEl = null
+let memberListRowsEl = null
 /** 标签独立图层(宿主子节点);`null` = 尚未挂载。 */
 let labelLayer = null
 /**
@@ -705,6 +758,7 @@ export function mountMarkerOverlay(mapHost, { onPick, onHover, onAggregateZoom }
         }
         // 特效样式注入(票 70 重做 / t45 C3b):幂等一次;卸载时移除。
         ensureFxStyles()
+        ensureAggregatePanelStyles()
         // 显式点击触发器(票 47 维护者裁定:给事件触发器、点击照搬原功能函数):
         // 命中标记节点 → 交给注入的 onPick(mapService 传 pickDeviceOrPointAt,与 Canvas 点选同一函数)。
         hostNode.addEventListener('click', (event) => {
@@ -853,6 +907,13 @@ function applyLabelState(record, visible, expanded) {
     if (record.labelBox.style.maxWidth !== wantedWidth) record.labelBox.style.maxWidth = wantedWidth
 }
 
+/** 深度 z 的迟滞出口:同一记录只有跨过缓冲才换层,避免相机微动时反复交换。 */
+function stableDepth(record, next) {
+    const stable = stabilizeZIndex(record.zIndex, next)
+    record.zIndex = stable
+    return stable
+}
+
 /** 标签跟随节点位移(与节点同一次 transform;不逐帧读布局)。 */
 function placeLabel(record, x, y) {
     if (!record || !record.labelWrap) return
@@ -1072,7 +1133,7 @@ function renderAggregates(groups, tones) {
             const value = member.screen && Number.isFinite(member.screen.distance) ? member.screen.distance : 1e8
             return Math.min(min, value)
         }, Infinity)
-        const badgeZ = String(depthZIndex(groupDistance) * 2)
+        const badgeZ = String(stableDepth(record, depthZIndex(groupDistance) * 2))
         if (record.root.style.zIndex !== badgeZ) record.root.style.zIndex = badgeZ
         const transform = 'translate(' + group.screen.x + 'px, ' + group.screen.y + 'px) translate(-50%, -50%)'
         if (record.root.style.transform !== transform) record.root.style.transform = transform
@@ -1097,89 +1158,215 @@ function renderAggregates(groups, tones) {
             aggregatePool.delete(key)
         }
     }
-    if (memberListEl && memberListGroupKey && !aggregateGroups.has(memberListGroupKey)) closeMemberList()
+    refreshMemberList(groups, tones)
 }
 
 function closeMemberList() {
     if (memberListEl && memberListEl.parentNode) memberListEl.parentNode.removeChild(memberListEl)
     memberListEl = null
     memberListGroupKey = ''
+    memberListAnchorCode = ''
+    memberListFingerprint = ''
+    memberListQuery = ''
+    memberListTones = null
+    memberListOnPick = null
+    memberListTitleEl = null
+    memberListSummaryEl = null
+    memberListChipsEl = null
+    memberListRowsEl = null
+}
+
+function memberListFingerprintOf(group) {
+    const status = ((group.statusSummary && group.statusSummary.statuses) || [])
+        .map((item) => item.status + ':' + item.count).join(',')
+    const types = (group.industrySummary || []).map((item) => item.key + ':' + item.count).join(',')
+    // 成员自身的状态/名称变化也必须触发重绘(只比计数会漏掉「两人互换状态」)。
+    const members = (group.members || []).map((item) => item.code + ':' + (item.status || '') + ':' + (item.name || '')).join(',')
+    return [group.groupKey, group.count, status, types, members].join('|')
+}
+
+function toneHexOf(tones, key, fallback) {
+    return (tones && tones[key]) || fallback || '#7fb8d8'
 }
 
-function openMemberList(group, onPick) {
+function buildPanelStatusChip(label, toneHex) {
+    const chip = document.createElement('span')
+    chip.className = 'aggregate-panel__chip'
+    const dot = document.createElement('span')
+    dot.className = 'aggregate-panel__dot'
+    dot.style.background = toneHex
+    dot.style.color = toneHex
+    const text = document.createElement('span')
+    text.textContent = label
+    chip.appendChild(dot)
+    chip.appendChild(text)
+    return chip
+}
+
+/** 面板贴着徽章外侧,随组屏幕位置逐帧更新(视口内夹取)。 */
+function positionMemberList(group) {
+    if (!memberListEl || !group) return
+    const width = 300
+    const height = 340
+    const hostW = hostNode.clientWidth || 900
+    const hostH = hostNode.clientHeight || 700
+    let x = group.screen.x + 24
+    if (x + width > hostW - 12) x = group.screen.x - width - 24
+    x = Math.max(12, Math.min(hostW - width - 12, x))
+    let y = group.screen.y - 36
+    y = Math.max(12, Math.min(hostH - height - 12, y))
+    const left = x + 'px'
+    const top = y + 'px'
+    if (memberListEl.style.left !== left) memberListEl.style.left = left
+    if (memberListEl.style.top !== top) memberListEl.style.top = top
+}
+
+function renderMemberRows(group) {
+    if (!memberListRowsEl) return
+    for (const child of [...memberListRowsEl.children]) memberListRowsEl.removeChild(child)
+    for (const row of planMemberList(group, { query: memberListQuery })) {
+        const card = document.createElement('button')
+        card.type = 'button'
+        card.className = 'aggregate-panel__card'
+        card.dataset.memberCode = row.code
+        card.addEventListener('click', (event) => {
+            event.stopPropagation()
+            // 设备:本地立刻把成员移出聚合;监测点:由详情选择驱动 selectedPointCode,
+            // 下一帧从聚合移出并保持单体标记与两级详情。
+            const memberKind = group.memberKind || 'unassociated-equipment'
+            if (memberKind === 'unassociated-equipment') aggregateSelectedCode = row.code
+            const onPick = memberListOnPick
+            closeMemberList()
+            if (typeof onPick === 'function') onPick({ kind: memberKind, code: row.code, key: memberKind + '|' + row.code })
+        })
+        const top = document.createElement('span')
+        top.className = 'aggregate-panel__card-top'
+        const name = document.createElement('strong')
+        name.className = 'aggregate-panel__name'
+        name.textContent = row.name || row.code
+        const status = document.createElement('span')
+        status.className = 'aggregate-panel__status'
+        const hex = toneHexOf(memberListTones, row.statusTone, '#7fb8d8')
+        status.style.color = hex
+        const dot = document.createElement('span')
+        dot.className = 'aggregate-panel__dot'
+        dot.style.background = hex
+        dot.style.color = hex
+        const statusText = document.createElement('span')
+        statusText.textContent = row.statusLabel || row.status || '状态未发布'
+        status.appendChild(dot)
+        status.appendChild(statusText)
+        top.appendChild(name)
+        top.appendChild(status)
+        const meta = document.createElement('span')
+        meta.className = 'aggregate-panel__meta'
+        meta.textContent = row.code + ' · '
+        const type = document.createElement('span')
+        type.className = 'aggregate-panel__type'
+        type.textContent = row.industryLabel || '未标注'
+        meta.appendChild(type)
+        card.appendChild(top)
+        card.appendChild(meta)
+        memberListRowsEl.appendChild(card)
+    }
+}
+
+function renderMemberListContent(group) {
+    if (!memberListEl) return
+    if (memberListTitleEl) memberListTitleEl.textContent = group.count + ' ' + (group.noun || '台独立设备')
+    if (memberListSummaryEl) {
+        const typeText = (group.industrySummary || []).map((item) => item.label + ' ' + item.count).join(' / ')
+        memberListSummaryEl.textContent = '类型 ' + (typeText || '未标注') + ' · 按风险优先排序'
+        memberListSummaryEl.title = typeText || ''
+    }
+    if (memberListChipsEl) {
+        for (const child of [...memberListChipsEl.children]) memberListChipsEl.removeChild(child)
+        for (const item of (group.statusSummary && group.statusSummary.statuses) || []) {
+            const hex = toneHexOf(memberListTones, item.tone, '#7fb8d8')
+            memberListChipsEl.appendChild(buildPanelStatusChip(item.label + ' ' + item.count, hex))
+        }
+    }
+    renderMemberRows(group)
+}
+
+function updateMemberList(group, tones) {
+    if (!memberListEl || !group) return
+    if (tones) memberListTones = tones
+    const fp = memberListFingerprintOf(group)
+    if (fp !== memberListFingerprint) {
+        memberListFingerprint = fp
+        renderMemberListContent(group)
+    }
+    positionMemberList(group)
+}
+
+/** 面板打开期间每帧跟随:锚成员还在组里就更新的位置/内容,成员组消失才关闭。 */
+function refreshMemberList(groups, tones) {
+    if (!memberListEl || !memberListAnchorCode) return
+    const group = (groups || []).find((item) => item.members.some((member) => member.code === memberListAnchorCode))
+    if (!group || group.count < 2) { closeMemberList(); return }
+    memberListGroupKey = group.groupKey
+    updateMemberList(group, tones)
+}
+
+function openMemberList(group, onPick, tones) {
     if (!group || !group.count) return
     closeMemberList()
+    memberListTones = tones || frameTones
+    memberListOnPick = typeof onPick === 'function' ? onPick : null
+    memberListAnchorCode = group.members[0] ? group.members[0].code : ''
+    memberListGroupKey = group.groupKey
+    memberListQuery = ''
+    ensureAggregatePanelStyles()
+
     const root = document.createElement('div')
     root.dataset.memberList = ''
-    root.style.cssText = 'position:absolute;z-index:20;pointer-events:auto;width:260px;max-height:320px;overflow:auto;background:rgba(2,9,27,0.97);border:1px solid rgba(1,171,234,0.55);border-radius:6px;padding:8px;color:#e8f7ff;font:12px/1.5 sans-serif;box-shadow:0 10px 30px rgba(0,0,0,0.6)'
-    const header = document.createElement('div')
-    header.style.cssText = 'display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;'
-    const title = document.createElement('strong')
-    title.textContent = group.count + ' ' + (group.noun || '台独立设备')
+    root.className = 'aggregate-panel'
+    const header = document.createElement('header')
+    header.className = 'aggregate-panel__head'
+    memberListTitleEl = document.createElement('span')
+    memberListTitleEl.className = 'aggregate-panel__title'
+    memberListTitleEl.dataset.memberTitle = ''
     const close = document.createElement('button')
     close.type = 'button'
+    close.className = 'aggregate-panel__action'
+    close.dataset.memberClose = ''
     close.textContent = '关闭'
-    close.style.cssText = 'pointer-events:auto;background:transparent;border:1px solid rgba(1,171,234,0.5);color:#9fd8f2;border-radius:4px;padding:1px 6px;cursor:pointer;font:11px sans-serif'
-    header.appendChild(title)
+    close.addEventListener('click', (event) => { event.stopPropagation(); closeMemberList() })
+    header.appendChild(memberListTitleEl)
     header.appendChild(close)
-    // 类型与状态分布摘要:打开列表前就能看到「聚合了哪些类型、各是什么状态」。
-    const subtitle = document.createElement('div')
-    subtitle.style.cssText = 'color:#7fb8d8;font-size:11px;line-height:1.45;margin-bottom:6px;'
-    const typeText = (group.industrySummary || []).map((item) => item.label + ' ' + item.count).join(' / ')
-    const statusText = ((group.statusSummary && group.statusSummary.statuses) || []).map((item) => item.label + ' ' + item.count).join(' / ')
-    subtitle.textContent = '类型 ' + (typeText || '未标注') + ' · 状态 ' + (statusText || '状态未发布')
-    subtitle.title = subtitle.textContent
+
+    const body = document.createElement('div')
+    body.className = 'aggregate-panel__body'
+    memberListSummaryEl = document.createElement('p')
+    memberListSummaryEl.className = 'aggregate-panel__summary'
+    memberListSummaryEl.dataset.memberSummary = ''
+    memberListChipsEl = document.createElement('div')
+    memberListChipsEl.className = 'aggregate-panel__chips'
+    memberListChipsEl.dataset.memberChips = ''
     const input = document.createElement('input')
     input.type = 'search'
+    input.className = 'aggregate-panel__search'
     input.placeholder = '搜索名称 / 编码'
-    input.style.cssText = 'width:100%;box-sizing:border-box;margin-bottom:6px;background:rgba(0,0,0,0.35);border:1px solid rgba(1,171,234,0.35);border-radius:4px;color:#e8f7ff;padding:3px 6px;font:12px sans-serif'
-    const list = document.createElement('div')
-    list.style.cssText = 'display:flex;flex-direction:column;gap:2px;'
-    const renderRows = (query) => {
-        list.innerHTML = ''
-        for (const row of planMemberList(group, { query })) {
-            const button = document.createElement('button')
-            button.type = 'button'
-            button.dataset.memberCode = row.code
-            button.style.cssText = 'pointer-events:auto;text-align:left;background:transparent;border:0;border-radius:3px;color:#e8f7ff;padding:3px 5px;cursor:pointer;font:12px/1.45 sans-serif'
-            button.addEventListener('pointerover', () => { button.style.background = 'rgba(1,171,234,0.18)' })
-            button.addEventListener('pointerout', () => { button.style.background = 'transparent' })
-            button.addEventListener('click', (event) => {
-                event.stopPropagation()
-                // 设备:本地立刻把成员移出聚合;监测点:由详情选择驱动 selectedPointCode,
-                // 下一帧从聚合移出并保持单体标记与两级详情。
-                const memberKind = group.memberKind || 'unassociated-equipment'
-                if (memberKind === 'unassociated-equipment') aggregateSelectedCode = row.code
-                closeMemberList()
-                if (typeof onPick === 'function') onPick({ kind: memberKind, code: row.code, key: memberKind + '|' + row.code })
-            })
-            const name = document.createElement('span')
-            name.textContent = row.name || row.code
-            const meta = document.createElement('span')
-            meta.textContent = ' · ' + row.code + ' · ' + (row.industryLabel || '未标注') + ' · ' + (row.statusLabel || row.status || '状态未发布')
-            meta.style.cssText = 'color:#7fb8d8;font-size:11px'
-            button.appendChild(name)
-            button.appendChild(meta)
-            list.appendChild(button)
-        }
-    }
-    close.addEventListener('click', (event) => { event.stopPropagation(); closeMemberList() })
-    input.addEventListener('input', () => renderRows(input.value))
+    input.dataset.memberSearch = ''
+    input.addEventListener('input', () => { memberListQuery = input.value; renderMemberRows(group) })
     input.addEventListener('pointerdown', (event) => event.stopPropagation())
+    memberListRowsEl = document.createElement('div')
+    memberListRowsEl.dataset.memberRows = ''
+    const hint = document.createElement('p')
+    hint.className = 'aggregate-panel__hint'
+    hint.textContent = '点击卡片进入详情'
+    body.appendChild(memberListSummaryEl)
+    body.appendChild(memberListChipsEl)
+    body.appendChild(input)
+    body.appendChild(memberListRowsEl)
+    body.appendChild(hint)
     root.appendChild(header)
-    root.appendChild(subtitle)
-    root.appendChild(input)
-    root.appendChild(list)
-    renderRows('')
-    const width = hostNode.clientWidth || 800
-    const height = hostNode.clientHeight || 600
-    const x = Math.max(8, Math.min(width - 268, group.screen.x + 20))
-    const y = Math.max(8, Math.min(height - 120, group.screen.y + 20))
-    root.style.left = x + 'px'
-    root.style.top = y + 'px'
+    root.appendChild(body)
     hostNode.appendChild(root)
     memberListEl = root
-    memberListGroupKey = group.groupKey
+    renderMemberListContent(group)
+    positionMemberList(group)
 }
 
 function handleAggregateClick(group, { onAggregateZoom, onPick } = {}) {
@@ -1188,7 +1375,7 @@ function handleAggregateClick(group, { onAggregateZoom, onPick } = {}) {
         if (typeof onAggregateZoom === 'function') onAggregateZoom(group)
         return
     }
-    openMemberList(group, onPick)
+    openMemberList(group, onPick, frameTones)
 }
 
 export function syncMarkerOverlay({ markers, devices, aggregates, facilities, selectedFacilityKey, pipeComponents, pipeComponentsVisible, pointScales, tones, planOf, facilityPlanOf, componentPlanOf, effectOf, deviceEffectOf, facilityEffectOf, converge, selectedCode, selectedPointCode, projectToWindow }) {
@@ -1198,6 +1385,7 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
     frameDeviceEffectOf = typeof deviceEffectOf === 'function' ? deviceEffectOf : () => ''
     frameFacilityEffectOf = typeof facilityEffectOf === 'function' ? facilityEffectOf : () => ''
     frameConverge = converge || null
+    frameTones = tones || {}
     // 当前选中的对象编码(2026-10-28):**非聚合设备点**选中时要上「被选择态」同款高亮,
     // 而聚合设备的中心由引擎的 pinned 标志负责;两者语义不同,故这里另收一份。
     markerSelectedCode = typeof selectedCode === 'string' ? selectedCode : ''
@@ -1322,11 +1510,12 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
         // 04:已选中的监测点单独显示时置顶,且标签不被邻近聚合折叠 —— 否则「保持选择」只剩一个点。
         const selectedPoint = marker.kind === 'monitoring-point' && marker.code === selectedPointCode
         // 901 > depthZIndex 上限 900:选中点连同标签压过所有徽章(图标 1802、标签 1803)。
-        const markerDepth = selectedPoint ? 901 : depthZIndex(windowPos.distance)
-        const markerZ = String(markerDepth * 2)
+        // 其余图标走 stableDepth:距离接近时不交换层级(深度迟滞)。
+        const markerZNum = selectedPoint ? 1802 : stableDepth(record, depthZIndex(windowPos.distance) * 2)
+        const markerZ = String(markerZNum)
         if (record.root.style.zIndex !== markerZ) record.root.style.zIndex = markerZ
         if (record.labelWrap) {
-            const markerLabelZ = String(markerDepth * 2 + 1)
+            const markerLabelZ = String(markerZNum + 1)
             if (record.labelWrap.style.zIndex !== markerLabelZ) record.labelWrap.style.zIndex = markerLabelZ
         }
         // 标签(2026-10-28):点位与未关联设备**始终显示**(截断),hover 才展开全名;
@@ -1421,11 +1610,11 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
         //   · ④ 设备被选择的中心设备:隐藏(与 ② 聚合被选择态同性质)。
         //   · 非聚合设备点(k=1 关联设备):**始终显示** —— 聚合规则不得外溢到它们。
         const devicePos = { x: device.x - hostOffset.x, y: device.y - hostOffset.y }
-        const deviceDepth = depthZIndex(device.distance)
-        const deviceZ = String(deviceDepth * 2)
+        const deviceZNum = stableDepth(record, depthZIndex(device.distance) * 2)
+        const deviceZ = String(deviceZNum)
         if (record.root.style.zIndex !== deviceZ) record.root.style.zIndex = deviceZ
         if (record.labelWrap) {
-            const deviceLabelZ = String(deviceDepth * 2 + 1)
+            const deviceLabelZ = String(deviceZNum + 1)
             if (record.labelWrap.style.zIndex !== deviceLabelZ) record.labelWrap.style.zIndex = deviceLabelZ
         }
         placeLabel(record, devicePos.x, devicePos.y)
@@ -1488,11 +1677,11 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
         // 票 76(四态):① 的 hover 预览与 ② 的固定态都隐藏聚合标签(让出设备环);
         // ③④ 中心已是设备点 → 整枚聚合节点让位(标签随之隐藏)。
         // 2026-11-24:标签与图标同宿主、按相机距离交错层级。
-        const aggDepth = depthZIndex(row.distance)
-        const aggZ = String(aggDepth * 2)
+        const aggZNum = stableDepth(record, depthZIndex(row.distance) * 2)
+        const aggZ = String(aggZNum)
         if (record.root.style.zIndex !== aggZ) record.root.style.zIndex = aggZ
         if (record.labelWrap) {
-            const aggLabelZ = String(aggDepth * 2 + 1)
+            const aggLabelZ = String(aggZNum + 1)
             if (record.labelWrap.style.zIndex !== aggLabelZ) record.labelWrap.style.zIndex = aggLabelZ
         }
         placeLabel(record, row.x - hostOffset.x, row.y - hostOffset.y)
@@ -1549,11 +1738,11 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
         const transform = `translate(${windowPos.x}px, ${windowPos.y}px)`
         if (record.root.style.transform !== transform) record.root.style.transform = transform
         if (record.root.style.display !== 'block') record.root.style.display = 'block'
-        const facilityDepth = depthZIndex(windowPos.distance)
-        const facilityZ = String(facilityDepth * 2)
+        const facilityZNum = stableDepth(record, depthZIndex(windowPos.distance) * 2)
+        const facilityZ = String(facilityZNum)
         if (record.root.style.zIndex !== facilityZ) record.root.style.zIndex = facilityZ
         if (record.labelWrap) {
-            const facilityLabelZ = String(facilityDepth * 2 + 1)
+            const facilityLabelZ = String(facilityZNum + 1)
             if (record.labelWrap.style.zIndex !== facilityLabelZ) record.labelWrap.style.zIndex = facilityLabelZ
         }
         placeLabel(record, windowPos.x, windowPos.y)
@@ -1602,11 +1791,11 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
         const transform = `translate(${windowPos.x}px, ${windowPos.y}px)`
         if (record.root.style.transform !== transform) record.root.style.transform = transform
         if (record.root.style.display !== 'block') record.root.style.display = 'block'
-        const componentDepth = depthZIndex(windowPos.distance)
-        const componentZ = String(componentDepth * 2)
+        const componentZNum = stableDepth(record, depthZIndex(windowPos.distance) * 2)
+        const componentZ = String(componentZNum)
         if (record.root.style.zIndex !== componentZ) record.root.style.zIndex = componentZ
         if (record.labelWrap) {
-            const componentLabelZ = String(componentDepth * 2 + 1)
+            const componentLabelZ = String(componentZNum + 1)
             if (record.labelWrap.style.zIndex !== componentLabelZ) record.labelWrap.style.zIndex = componentLabelZ
         }
         placeLabel(record, windowPos.x, windowPos.y)
@@ -1682,6 +1871,8 @@ export function unmountMarkerOverlay() {
     if (typeof document !== 'undefined') {
         const style = document.getElementById(FX_STYLE_ID)
         if (style && style.parentNode) style.parentNode.removeChild(style)
+        const panelStyle = document.getElementById(AGGREGATE_PANEL_STYLE_ID)
+        if (panelStyle && panelStyle.parentNode) panelStyle.parentNode.removeChild(panelStyle)
     }
     if (hostNode && hostNode.parentNode) hostNode.parentNode.removeChild(hostNode)
     hostNode = null