From a673254db9bdc9e540b0b67b4ef63c0deb64916a Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期二, 15 十月 2024 13:59:23 +0800 Subject: [PATCH] # --- zy-acs-flow/src/map/tool.js | 29 ++++++++++++++++++++++++++++- 1 files changed, 28 insertions(+), 1 deletions(-) diff --git a/zy-acs-flow/src/map/tool.js b/zy-acs-flow/src/map/tool.js index 32a0124..8eab20d 100644 --- a/zy-acs-flow/src/map/tool.js +++ b/zy-acs-flow/src/map/tool.js @@ -129,6 +129,10 @@ } } +export const findSpriteByUuid = (uuid) => { + return mapContainer?.children?.find(child => child?.data?.uuid === uuid); +} + export const markSprite = (sprite) => { sprite.alpha = 0.5; } @@ -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) -- Gitblit v1.9.1