From 7fd4327861ee2b36af01ff526742b0704f713ccc Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 26 十一月 2024 15:00:42 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/map/tool.js | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/zy-acs-flow/src/map/tool.js b/zy-acs-flow/src/map/tool.js
index 3afce6a..4d61c35 100644
--- a/zy-acs-flow/src/map/tool.js
+++ b/zy-acs-flow/src/map/tool.js
@@ -72,11 +72,10 @@
export const getRealPosition = (x, y) => {
- const rect = app.view.getBoundingClientRect();
- return {
- mapX: (x - rect.left) / mapContainer.scale.x - mapContainer.x / mapContainer.scale.x,
- mapY: (y - rect.top) / mapContainer.scale.y - mapContainer.y / mapContainer.scale.y
- }
+ const globalPoint = new PIXI.Point();
+ app.renderer.plugins.interaction.mapPositionToPoint(globalPoint, x, y);
+ const mapPoint = mapContainer.toLocal(globalPoint);
+ return { mapX: mapPoint.x, mapY: mapPoint.y };
}
export const generateSprite = (deviceType, texture) => {
@@ -657,7 +656,7 @@
}
}
-const agvRotationOffsetDegrees = 0;
+const agvRotationOffsetDegrees = 90;
const agvRotationOffset = rotationParseNum(agvRotationOffsetDegrees);
const showAgvSprite = (curZone, agvVo, setCurSprite) => {
@@ -684,7 +683,6 @@
agvSprite.position.set(codeSprite.position.x, codeSprite.position.y);
agvSprite.rotation = targetRotation + agvRotationOffset;
mapContainer.addChild(agvSprite);
- beInsight(agvSprite, setCurSprite);
// agvNo sprite
const agvText = new PIXI.Text(agvNo.toString(), {
@@ -715,8 +713,10 @@
agvSprite.data.battery = battery;
}
- animateRotation(agvSprite, targetRotation, agvRotationOffset);
+ animateRotation(agvSprite, targetRotation + agvRotationOffset, agvRotationOffset);
}
+
+ beInsight(agvSprite, setCurSprite);
new TWEEDLE.Tween(agvSprite.position)
.to({
@@ -740,7 +740,7 @@
}
agvPath = new PIXI.Graphics();
agvPath.name = agvPathName;
- agvPath.lineStyle(Math.max(20, 4 * (1 / mapContainer.scale.x)), 0x2f68ac, 0.8);
+ agvPath.lineStyle(Math.max(20, 4 * (1 / mapContainer?.scale.x || 1)), 0x2f68ac, 0.8);
agvPath.zIndex = DEVICE_Z_INDEX.DYNAMIC_ROUTE;
// agvPath.blendMode = PIXI.BLEND_MODES.NORMAL;
--
Gitblit v1.9.1