From 0e8b41f6f2ffa21ca6394e20053b262d2dc1e1be Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 20 三月 2024 14:00:38 +0800
Subject: [PATCH] #
---
 zy-asrs-flow/src/pages/map/utils.js |   34 +++++++++++++++++++++++++---------
 1 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/zy-asrs-flow/src/pages/map/utils.js b/zy-asrs-flow/src/pages/map/utils.js
index de532ab..b089a48 100644
--- a/zy-asrs-flow/src/pages/map/utils.js
+++ b/zy-asrs-flow/src/pages/map/utils.js
@@ -5,6 +5,7 @@
 import { API_TIMEOUT } from '@/config/setting'
 import agv from '/public/img/map/agv.svg'
 import shelf from '/public/img/map/shelf.png'
+import point from '/public/img/map/point.svg'
 
 let app = null;
 let mapContainer = null;
@@ -28,6 +29,7 @@
 
 export const SENSOR_TYPE = Object.freeze({
     SHELF: "SHELF",
+    POINT: "POINT",
     AGV: "AGV",
 })
 
@@ -307,6 +309,12 @@
                     label: intl.formatMessage({ id: 'map.sensor.type.agv', defaultMessage: '鏃犱汉灏忚溅' })
                 })
                 break;
+            case SENSOR_TYPE.POINT:
+                options.push({
+                    value: value,
+                    label: intl.formatMessage({ id: 'map.sensor.type.point', defaultMessage: '瀹氫綅鐐�' })
+                })
+                break;
             default:
                 break;
         }
@@ -328,6 +336,9 @@
                 case SENSOR_TYPE.AGV:
                     sprite = PIXI.Sprite.from(agv);
                     break;
+                case SENSOR_TYPE.POINT:
+                    sprite = PIXI.Sprite.from(point);
+                    break;
                 default:
                     break;
             }
@@ -336,6 +347,9 @@
                 // data
                 sprite.data.uuid = item.uuid;
                 sprite.data.no = item.no;
+
+                // dynamical data
+                Object.assign(sprite.data, item.property);
 
                 // graph
                 sprite.position.set(item.positionX, item.positionY);
@@ -359,11 +373,13 @@
     let mapItemList = [];
     mapContainer?.children.forEach(child => {
         if (child.data?.uuid) {
+            const { type, uuid, no, ...property } = child.data;
             mapItemList.push({
                 // data
-                type: child.data.type,
-                uuid: child.data.uuid,
-                no: child.data.no,
+                type: type,
+                uuid: uuid,
+                no: no,
+                property: property,
 
                 // graph
                 positionX: child.position.x,
@@ -411,20 +427,20 @@
         return;
     }
 
-    // 鑾峰彇 sprite 鐨勪腑蹇冪偣鍧愭爣
+    mapContainer.scale.set(1);
+    mapContainer.position.set(0, 0);
+
     let bounds = sprite.getBounds();
     let centerPoint = {
         x: bounds.x + bounds.width / 2,
         y: bounds.y + bounds.height / 2
     };
 
-    // 璁$畻 sprite 搴斿綋骞崇Щ鐨勫儚绱犻噺浠ヨ兘澶熷皢鍏舵斁缃埌灞忓箷涓績
     let targetPos = {
-        x: app.renderer.width / 2 - centerPoint.x * this.scale,
-        y: app.renderer.height / 2 - centerPoint.y * this.scale
+        x: app.renderer.width / 3 - centerPoint.x * mapContainer.scale.x,
+        y: app.renderer.height / 3 - centerPoint.y * mapContainer.scale.y
     };
 
-    // 浣跨敤 TWEEDLE.Tween 鍔ㄧ敾搴撲负骞崇Щ杩囩▼娣诲姞杩囨浮鏁堟灉
     new TWEEDLE.Tween(mapContainer.position).easing(TWEEDLE.Easing.Quadratic.Out)
-        .to(targetPos, 200).start();
+        .to(targetPos, 500).start();
 }
\ No newline at end of file
--
Gitblit v1.9.1