Selaa lähdekoodia

style:修改当前位置图标动画不准确bug

zhouyuhao 11 kuukautta sitten
vanhempi
commit
e60b483235

+ 4 - 4
src/views/Tracking/src/components/TrackingDetail/src/components/MapView.vue

@@ -13,6 +13,7 @@ import OriginIcon from '../images/originIcon.png'
 import TransferIcon from '../images/transferIcon.png'
 import { onMounted, ref, watch } from 'vue'
 import * as turf from '@turf/turf'
+import { mapData } from '../mapdata'
 
 const props = defineProps<{
   serial_no?: string
@@ -344,16 +345,16 @@ const addShipMarker = (x: number) => {
     // 获取线段的最后一个点和倒数第二个点
     const lastPoint = solidLine[solidLine.length - 1]
     const secondLastPoint = solidLine[solidLine.length - 2]
+    console.log(lastPoint, secondLastPoint, 'lastPoint, secondLastPoint')
     // 计算线段末端的角度(以弧度为单位)
     const angle =
       (Math.atan2(
-        Number(lastPoint.lat) - Number(secondLastPoint.lat), // Δlat (y)
-        Number(lastPoint.lon) - Number(secondLastPoint.lon) // Δlon (x)
+        Number(lastPoint.lon) - Number(secondLastPoint.lon), // Δlon (x)
+        Number(lastPoint.lat) - Number(secondLastPoint.lat) // Δlat (y)
       ) *
         (180 / Math.PI) +
         360) %
       360
-
     // 创建自定义箭头图标
     const arrowIcon = L.divIcon({
       html: `
@@ -472,7 +473,6 @@ const getMarker = () => {
       if (res.code === 200) {
         allMapData.value = res.data
         const { data } = res
-
         data?.point &&
           data?.point.forEach((item) => {
             const iconColorList = {