From d0f5933cb7fe9196ca0250252efc820a1a9d947e Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 08 五月 2024 22:47:30 +0800
Subject: [PATCH] 新增历史轨迹菜单

---
 src/utils/map/animation.js |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/utils/map/animation.js b/src/utils/map/animation.js
index 551b3bb..ab13719 100644
--- a/src/utils/map/animation.js
+++ b/src/utils/map/animation.js
@@ -2,7 +2,10 @@
 import calculate from '@/utils/map/calculate';
 import Layer from '@/utils/map/3dLayer';
 import sector from '@/utils/map/sector';
-import map from '@/utils/map/index_old';
+import { map } from '@/utils/map/index_old';
+import util from "@/utils/map/util";
+import car_driving from '@/assets/mipmap/car_driving.png';
+import boat_driving from '@/assets/mipmap/boat_driving.png';
 
 function MapAnimation() {
   // 闈炶繛缁潗鏍囩偣鏈�澶ц窛绂�(绫�)
@@ -264,16 +267,16 @@
       var url;
       switch (this.vehicleType) {
         case 0:
-          url = './asset/mipmap/car_driving.png';
+          url = car_driving;
           break;
         case 1:
-          url = './asset/mipmap/car_driving.png';
+          url = car_driving;
           break;
         case 2:
-          url = './asset/mipmap/boat_driving.png';
+          url = boat_driving;
           break;
         default:
-          url = './asset/mipmap/car_driving.png';
+          url = car_driving;
           break;
       }
       // var url = "./asset/mipmap/car_offline.png";
@@ -292,26 +295,33 @@
       //     break;
       // }
 
+      // eslint-disable-next-line no-undef
       var icon = new AMap.Icon({
+        // eslint-disable-next-line no-undef
         size: new AMap.Size(60, 30),
+        // eslint-disable-next-line no-undef
         imageSize: new AMap.Size(54, 21),
         image: url
         // imageOffset: new AMap.Pixel(-16, -16) // 鐩稿浜庡熀鐐圭殑鍋忕Щ浣嶇疆
       });
 
+      // eslint-disable-next-line no-undef
       var car = new AMap.Marker({
         icon: icon,
         position: lnglat, // 鍩虹偣浣嶇疆
+        // eslint-disable-next-line no-undef
         offset: new AMap.Pixel(-20, -15) // 鐩稿浜庡熀鐐圭殑鍋忕Щ浣嶇疆
       });
 
-      MapUtil._map.add(car);
+      map.add(car);
       this.moveViews['car'] = car;
 
       // 鏃堕棿
+      // eslint-disable-next-line no-undef
       var text = new AMap.Text({
         text: time,
         position: lnglat,
+        // eslint-disable-next-line no-undef
         offset: new AMap.Pixel(5, 20),
         style: {
           'font-size': '13px',
@@ -324,10 +334,10 @@
           padding: '0 4px'
         }
       });
-      MapUtil._map.add(text);
+      map.add(text);
       this.moveViews['text'] = text;
     } else {
-      MapUtil.setCenter(lnglat);
+      util.setCenter(lnglat);
       this.moveViews['car'].setPosition(lnglat);
       this.moveViews['text'].setPosition(lnglat);
       this.moveViews['text'].setText(time);

--
Gitblit v1.9.3