From 81ec08bd0f5a2ffc8acc9955f7cf80654ab480e8 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期日, 03 三月 2024 16:44:51 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/index.jsx |    2 +-
 zy-asrs-flow/src/pages/map/utils.js  |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/index.jsx b/zy-asrs-flow/src/pages/map/index.jsx
index 37aeaf2..bb582a3 100644
--- a/zy-asrs-flow/src/pages/map/index.jsx
+++ b/zy-asrs-flow/src/pages/map/index.jsx
@@ -77,7 +77,7 @@
     }
 
     const onDrop = (sprite, x, y) => {
-        const { mapX, mapY } = Utils.getRealPosition(x, y, mapContainer.scale.x);
+        const { mapX, mapY } = Utils.getRealPosition(x, y, mapContainer);
         sprite.x = mapX;
         sprite.y = mapY;
         mapContainer.addChild(sprite);
diff --git a/zy-asrs-flow/src/pages/map/utils.js b/zy-asrs-flow/src/pages/map/utils.js
index 88cf1e3..3abb061 100644
--- a/zy-asrs-flow/src/pages/map/utils.js
+++ b/zy-asrs-flow/src/pages/map/utils.js
@@ -12,10 +12,10 @@
     mapContainer = param;
 }
 
-export const getRealPosition = (x, y, scale) => {
+export const getRealPosition = (x, y, mapContainer) => {
     const rect = app.view.getBoundingClientRect();
     return {
-        mapX: (x - rect.left) / scale,
-        mapY: (y - rect.top) / scale
+        mapX: (x - rect.left) / mapContainer.scale.x - mapContainer.x / mapContainer.scale.x,
+        mapY: (y - rect.top) / mapContainer.scale.y - mapContainer.y / mapContainer.scale.y
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1