From 3ef1788f712ea37a127bdea0cefd677ca3691f4a Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 19 三月 2024 11:05:54 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/utils.js |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/utils.js b/zy-asrs-flow/src/pages/map/utils.js
index cde1275..bf7a16f 100644
--- a/zy-asrs-flow/src/pages/map/utils.js
+++ b/zy-asrs-flow/src/pages/map/utils.js
@@ -28,6 +28,7 @@
 
 export const SENSOR_TYPE = Object.freeze({
     SHELF: "SHELF",
+    POINT: "POINT",
     AGV: "AGV",
 })
 
@@ -56,7 +57,6 @@
     sprite.off('pointerdown');
     sprite.off('click');
 
-    let viewTarget;
     sprite.on("click", onClick);
 
     function onClick(event) {
@@ -405,4 +405,27 @@
         });
         childList = [];
     }
+}
+
+export const beCenter = (sprite) => {
+    if (!sprite || !app || !mapContainer) {
+        return;
+    }
+
+    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
+    };
+
+    let targetPos = {
+        x: app.renderer.width / 3 - centerPoint.x * mapContainer.scale.x,
+        y: app.renderer.height / 3 - centerPoint.y * mapContainer.scale.y
+    };
+
+    new TWEEDLE.Tween(mapContainer.position).easing(TWEEDLE.Easing.Quadratic.Out)
+        .to(targetPos, 500).start();
 }
\ No newline at end of file

--
Gitblit v1.9.1