|
|
@@ -49,7 +49,7 @@ import {
|
|
|
// 票 83:几何读数(本体宽 / 绘制宽 / pad)与计划读数同一出口,走查不读 DOM 内部结构。
|
|
|
import { markerGeometryDataset } from '../domain/markerPlan.js'
|
|
|
// 本票:未关联设备的屏幕拥挤聚合(纯 domain;本层只负责投影/渲染/点击)。
|
|
|
-import { AGGREGATE_BADGE, AGGREGATE_KIND, aggregateBadge, canZoomAggregate, groupUnassociatedByScreen, labelOccludedByAggregates, planMemberList } from '../domain/pointAggregation.js'
|
|
|
+import { AGGREGATE_BADGE, AGGREGATE_KIND, aggregateBadge, canZoomAggregate, depthZIndex, groupUnassociatedByScreen, labelOccludedByAggregates, planMemberList } from '../domain/pointAggregation.js'
|
|
|
|
|
|
/**
|
|
|
* 类名单源:注入的特效 CSS(下方模板串)与 DOM 构建(buildNode/mount)共用同一组常量。
|
|
|
@@ -59,8 +59,6 @@ import { AGGREGATE_BADGE, AGGREGATE_KIND, aggregateBadge, canZoomAggregate, grou
|
|
|
const OVERLAY_HOST_CLASS = 'marker-overlay-host'
|
|
|
const NODE_CLASS = 'marker-overlay-node'
|
|
|
const LABEL_CLASS = 'marker-overlay-label'
|
|
|
-/** 标签独立图层(2026-10-28):标签要盖在所有图标之上,必须脱离节点自身的层叠上下文。 */
|
|
|
-const LABEL_LAYER_CLASS = 'marker-overlay-labels'
|
|
|
/** 标签的零尺寸锚点(随节点位移;真正的标签盒子在它内部)。 */
|
|
|
const LABEL_WRAP_CLASS = 'marker-overlay-label-wrap'
|
|
|
const FX_CLASS = 'marker-overlay-fx'
|
|
|
@@ -682,19 +680,11 @@ export function mountMarkerOverlay(mapHost, { onPick, onHover, onAggregateZoom }
|
|
|
'z-index:1',
|
|
|
].join(';')
|
|
|
hostNode.style.display = ''
|
|
|
- // 票 70(2026-10-28 维护者报「多点位时标签被坐标点图标遮挡」):
|
|
|
- // 标签必须**独立成层**,不能留在节点内部 —— 节点带 `transform`(定位用)因而自成层叠上下文,
|
|
|
- // 其子元素无论 z-index 多高都出不了这个上下文,于是后画的节点会盖住先画节点的标签。
|
|
|
- // 这一层铺满宿主、`pointer-events:none`,层级高于所有节点(含 `--center` 的 3)。
|
|
|
- labelLayer = document.createElement('div')
|
|
|
- labelLayer.className = LABEL_LAYER_CLASS
|
|
|
- labelLayer.style.cssText = [
|
|
|
- 'position:absolute', 'inset:0',
|
|
|
- 'pointer-events:none',
|
|
|
- 'z-index:6',
|
|
|
- ].join(';')
|
|
|
- // 标签层是宿主的子节点、**先挂**(节点后追加不影响 —— 层级由 z-index 决定)。
|
|
|
- hostNode.appendChild(labelLayer)
|
|
|
+ // 深度排序(2026-11-24):标签不再单独成层,而是与图标一起挂在宿主下,
|
|
|
+ // 按「图标 = 2z、标签 = 2z+1」交错 —— 标签略高于自身图标,但低于更近的图标。
|
|
|
+ // 这样聚合徽章不再是绝对最高层,遮挡关系由「图标到相机的距离」决定。
|
|
|
+ // 标签不进节点内部:节点带 transform 会自成层叠上下文,子标签无法与其它节点比较层级。
|
|
|
+ labelLayer = hostNode
|
|
|
// 票 76(C4 parity 现场把手):DOM 单层比 billboard 双层暗(镂空孔/边缘不再叠亮层)。
|
|
|
// `?pinBrightness=1.2` 只做整体亮度补偿(不碰色相/饱和度);定档后写成默认常量并撤掉把手。
|
|
|
try {
|
|
|
@@ -950,8 +940,8 @@ function buildUnassociatedAggregateNode(key, badge, tones) {
|
|
|
root.dataset.markerOverlayKind = AGGREGATE_KIND
|
|
|
root.dataset.markerOverlayCode = key
|
|
|
root.dataset.markerOverlayAggregate = 'yes'
|
|
|
- // z-index 7 > 标签层 6:聚合徽章永远压在单体名称标签之上(「聚合优先」)。
|
|
|
- root.style.cssText = 'position:absolute;left:0;top:0;z-index:7;width:' + size + 'px;height:' + size + 'px;pointer-events:auto;cursor:pointer;transform-origin:50% 50%;'
|
|
|
+ // 层级不再写死:由 renderAggregates 按「组内最近成员的相机距离」动态给 z-index。
|
|
|
+ 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
|
|
|
|
|
|
@@ -1070,6 +1060,13 @@ function renderAggregates(groups, tones) {
|
|
|
aggregatePool.set(key, record)
|
|
|
hostNode.appendChild(record.root)
|
|
|
}
|
|
|
+ // 深度排序:聚合徽章参与同一套画家算法,不再绝对置顶(近的图标可压住远的徽章)。
|
|
|
+ const groupDistance = group.members.reduce((min, member) => {
|
|
|
+ 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)
|
|
|
+ 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
|
|
|
if (record.root.style.display !== 'block') record.root.style.display = 'block'
|
|
|
@@ -1294,6 +1291,14 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
|
|
|
if (record.fxHost.style.transform !== fxTransform) record.fxHost.style.transform = fxTransform
|
|
|
}
|
|
|
if (record.root.style.display !== 'block') record.root.style.display = 'block'
|
|
|
+ // 深度排序:图标 = 2z,标签 = 2z+1(标签略高于自身图标,低于更近的图标)。
|
|
|
+ const markerDepth = depthZIndex(windowPos.distance)
|
|
|
+ const markerZ = String(markerDepth * 2)
|
|
|
+ if (record.root.style.zIndex !== markerZ) record.root.style.zIndex = markerZ
|
|
|
+ if (record.labelWrap) {
|
|
|
+ const markerLabelZ = String(markerDepth * 2 + 1)
|
|
|
+ if (record.labelWrap.style.zIndex !== markerLabelZ) record.labelWrap.style.zIndex = markerLabelZ
|
|
|
+ }
|
|
|
// 标签(2026-10-28):点位与未关联设备**始终显示**(截断),hover 才展开全名;
|
|
|
// 若它是当前选中对象(独立设备被选中)则由下面的 `--active` 正규负责发光,标签仍在。
|
|
|
placeLabel(record, windowPos.x, windowPos.y)
|
|
|
@@ -1386,6 +1391,13 @@ 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)
|
|
|
+ if (record.root.style.zIndex !== deviceZ) record.root.style.zIndex = deviceZ
|
|
|
+ if (record.labelWrap) {
|
|
|
+ const deviceLabelZ = String(deviceDepth * 2 + 1)
|
|
|
+ if (record.labelWrap.style.zIndex !== deviceLabelZ) record.labelWrap.style.zIndex = deviceLabelZ
|
|
|
+ }
|
|
|
placeLabel(record, devicePos.x, devicePos.y)
|
|
|
const isHovered = hoveredLabelKey === key
|
|
|
const deviceLabel = deviceLabelState(device, isHovered)
|
|
|
@@ -1445,7 +1457,14 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
|
|
|
record.root.classList.toggle(`${NODE_CLASS}--active`, active)
|
|
|
// 票 76(四态):① 的 hover 预览与 ② 的固定态都隐藏聚合标签(让出设备环);
|
|
|
// ③④ 中心已是设备点 → 整枚聚合节点让位(标签随之隐藏)。
|
|
|
- // 2026-10-28:标签在**独立图层**,显隐由 `applyLabelState` 统一驱动(不再内联查 DOM 子元素)。
|
|
|
+ // 2026-11-24:标签与图标同宿主、按相机距离交错层级。
|
|
|
+ const aggDepth = depthZIndex(row.distance)
|
|
|
+ const aggZ = String(aggDepth * 2)
|
|
|
+ if (record.root.style.zIndex !== aggZ) record.root.style.zIndex = aggZ
|
|
|
+ if (record.labelWrap) {
|
|
|
+ const aggLabelZ = String(aggDepth * 2 + 1)
|
|
|
+ if (record.labelWrap.style.zIndex !== aggLabelZ) record.labelWrap.style.zIndex = aggLabelZ
|
|
|
+ }
|
|
|
placeLabel(record, row.x - hostOffset.x, row.y - hostOffset.y)
|
|
|
const aggregateLabel = aggregateLabelState(row)
|
|
|
applyLabelState(record, aggregateLabel.visible, aggregateLabel.expanded)
|
|
|
@@ -1500,6 +1519,13 @@ 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)
|
|
|
+ if (record.root.style.zIndex !== facilityZ) record.root.style.zIndex = facilityZ
|
|
|
+ if (record.labelWrap) {
|
|
|
+ const facilityLabelZ = String(facilityDepth * 2 + 1)
|
|
|
+ if (record.labelWrap.style.zIndex !== facilityLabelZ) record.labelWrap.style.zIndex = facilityLabelZ
|
|
|
+ }
|
|
|
placeLabel(record, windowPos.x, windowPos.y)
|
|
|
const facilityHovered = hoveredLabelKey === key
|
|
|
const facilityLabel = markerLabelState(facilityHovered)
|
|
|
@@ -1546,6 +1572,13 @@ 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)
|
|
|
+ if (record.root.style.zIndex !== componentZ) record.root.style.zIndex = componentZ
|
|
|
+ if (record.labelWrap) {
|
|
|
+ const componentLabelZ = String(componentDepth * 2 + 1)
|
|
|
+ if (record.labelWrap.style.zIndex !== componentLabelZ) record.labelWrap.style.zIndex = componentLabelZ
|
|
|
+ }
|
|
|
placeLabel(record, windowPos.x, windowPos.y)
|
|
|
const componentHovered = hoveredLabelKey === key
|
|
|
const componentLabel = markerLabelState(componentHovered)
|