From f01613f2d65ce199c6595de9e29ba96e7e6ac4f9 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 15 十月 2024 14:19:51 +0800
Subject: [PATCH] #

---
 zy-acs-flow/src/map/tool.js |   32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/zy-acs-flow/src/map/tool.js b/zy-acs-flow/src/map/tool.js
index fb8c7f7..8eab20d 100644
--- a/zy-acs-flow/src/map/tool.js
+++ b/zy-acs-flow/src/map/tool.js
@@ -101,7 +101,7 @@
         default:
             break;
     }
-    if (sprite) {
+    if (sprite && deviceType !== DEVICE_TYPE.AGV) {
         sprite.blendMode = PIXI.BLEND_MODES.MULTIPLY;
     }
     return sprite;
@@ -127,6 +127,10 @@
             return sprite;
         }
     }
+}
+
+export const findSpriteByUuid = (uuid) => {
+    return mapContainer?.children?.find(child => child?.data?.uuid === uuid);
 }
 
 export const markSprite = (sprite) => {
@@ -261,6 +265,29 @@
     function onClick(event) {
         setSpriteSettings(sprite);
     }
+}
+
+export const focusSprite = (sprite) => {
+    if (!sprite || !app || !mapContainer) {
+        return;
+    }
+
+    mapContainer.scale.set(1);
+    mapContainer.position.set(0, 0);
+
+    let bounds = sprite.getBounds();
+    let focusPoint = {
+        x: bounds.x + bounds.width / 2,
+        y: bounds.y + bounds.height / 2
+    };
+
+    let targetPos = {
+        x: app.renderer.width / 3 - focusPoint.x * mapContainer.scale.x,
+        y: app.renderer.height / 3 - focusPoint.y * mapContainer.scale.y
+    };
+
+    new TWEEDLE.Tween(mapContainer.position).easing(TWEEDLE.Easing.Quadratic.Out)
+        .to(targetPos, 500).start();
 }
 
 export const clearMapData = () => {
@@ -452,7 +479,7 @@
 // dynamic graphic ----------------
 
 export const generateDynamicGraphic = (curZone, data) => {
-    console.log("ws", curZone, data);
+    // console.log("ws", curZone, data);
 
     for (const agvVo of data.agvVos) {
         showAgvSprite(curZone, agvVo)
@@ -474,5 +501,6 @@
         agvSprite.rotation = rotationParseNum(direction);
         mapContainer.addChild(agvSprite);
         // viewFeature(shuttle, setCurSPrite); // todo
+        // agv no on sprite
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1