Parcourir la source

修复Cesium地图图标点不中的问题

WQQ il y a 1 mois
Parent
commit
fa84c43895
1 fichiers modifiés avec 11 ajouts et 1 suppressions
  1. 11 1
      src/components/CesiumMap.vue

+ 11 - 1
src/components/CesiumMap.vue

@@ -206,7 +206,17 @@ const addPoiMarker = () => {
       for (let i = 0; i < pickedObjects.length; i++) {
         const pickedObj = pickedObjects[i]
         if (Cesium.defined(pickedObj) && pickedObj.id) {
-          if (pickedObj.id.id === 'heilin-station' || pickedObj.id.id === 'heilin-station-click') {
+          let entityId = null
+          if (typeof pickedObj.id === 'string') {
+            entityId = pickedObj.id
+          } else if (pickedObj.id && pickedObj.id.id) {
+            entityId = pickedObj.id.id
+          }
+          if (entityId && (
+              entityId.includes('heilin') || 
+              entityId.includes('tashan') ||
+              entityId.includes('station') ||
+              entityId.includes('reservoir'))) {
             showPopup.value = true
             popupPosition.value = { 
               x: movement.position.x - 120,