Browse Source

fix(cockpit): 修复点位详情面板锚定失效导致面板不显示

票76(C4)起,点位与未关联设备的视觉由 DOM overlay 承担,Cesium billboard 实体恒为 show=false(isShowing=false)。
但详情面板的锚定仍拿引擎实体当"标记存在"判据,于是恒判 marker-missing,面板被置 visibility:hidden——
用户看到的是"点监测点/独立设备镜头会飞,但详情面板不弹"。设施点与关联设备走的是另一套判据,因此正常。

改为以标记计划行(markerPlan.markers)判定存在,并用与 DOM overlay 同一条 projectMarkerPoint 投影求锚点与图标尺寸。
ChenJZ 6 giờ trước cách đây
mục cha
commit
c43a75368a
1 tập tin đã thay đổi với 23 bổ sung và 6 xóa
  1. 23 6
      src/modules/cockpit/services/mapService.js

+ 23 - 6
src/modules/cockpit/services/mapService.js

@@ -354,12 +354,20 @@ export function getMapCanvasRect() {
     return { left: rect.left, top: rect.top, right: rect.right, bottom: rect.bottom }
 }
 
+/** 点位/未关联设备的标记行:DOM overlay 的唯一真相(billboard 已让位视觉,实体恒 show=false)。 */
+function pointMarkerRow(kind, code) {
+    if (!code) return null
+    return (markerPlan.markers || []).find((item) => item && item.kind === kind && item.code === code) || null
+}
+
 export function hasMapMarker(kind, code, pointCode = '', key = '') {
     if (!instance || !instance.engine || !instance.viewer) return false
     if (kind === 'facility-point') return Boolean(facilityMarkerFor(code, key))
-    return kind === DEVICE_LAYER_KIND
-        ? instance.engine.hasDeviceMarker(instance.viewer, code, pointCode)
-        : instance.engine.hasPointMarker(instance.viewer, kind, code)
+    if (kind === DEVICE_LAYER_KIND) return instance.engine.hasDeviceMarker(instance.viewer, code, pointCode)
+    // 票 76(C4):点位视觉已交给 DOM overlay,billboard 实体恒 `show=false`(isShowing=false)——
+    // 再拿引擎实体当"标记存在"判据,详情面板锚定会恒判 marker-missing、面板 visibility:hidden,
+    // 表现为"点了点位镜头飞了但面板不弹"。标记计划才是 DOM 层的真相,存在判据以它为准。
+    return Boolean(pointMarkerRow(kind, code))
 }
 
 export function getMapMarkerAnchor(kind, code, pointCode = '', key = '') {
@@ -371,9 +379,18 @@ export function getMapMarkerAnchor(kind, code, pointCode = '', key = '') {
         const plan = overlayFacilityPlanMarkerCached(marker)
         return { ...at, iconSize: Math.max(plan.draw.width, plan.draw.height), panelGap: 12 }
     }
-    const anchor = kind === DEVICE_LAYER_KIND
-        ? instance.engine.projectDeviceMarker(instance.viewer, code, pointCode)
-        : instance.engine.projectPointMarker(instance.viewer, kind, code)
+    // 点位/未关联设备:与 DOM overlay 同一条投影(markerGroundHeight + 相机),
+    // 不再读已被隐藏的 billboard 实体——那样既拿不到坐标,也拿不到图标尺寸。
+    if (kind !== DEVICE_LAYER_KIND) {
+        const row = pointMarkerRow(kind, code)
+        const at = row && instance.projectMarkerPoint
+            ? instance.projectMarkerPoint(row.longitude, row.latitude, row)
+            : null
+        if (!at) return null
+        const plan = overlayPlanMarkerCached(row)
+        return { ...at, iconSize: Math.max(plan.draw.width, plan.draw.height), panelGap: 12 }
+    }
+    const anchor = instance.engine.projectDeviceMarker(instance.viewer, code, pointCode)
     if (!anchor) return anchor
     // 票 76(2026-10-26 走查补充①):面板让位的**确定性**规则。
     // 旧实现只在「展开或预览」时给 panelGap:60,且不区分态 —— 于是