#
luxiaotao1123
2024-03-03 2ec11cf252a1d9ba5aea1c1b32615237ea3603b1
#
2个文件已修改
10 ■■■■ 已修改文件
zy-asrs-flow/src/pages/map/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/map/utils.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/map/index.jsx
@@ -77,11 +77,11 @@
    }
    const onDrop = (sprite, x, y) => {
        const { mapX, mapY } = Utils.getRealPosition(x, y);
        const { mapX, mapY } = Utils.getRealPosition(x, y, mapContainer.scale.x);
        sprite.x = mapX;
        sprite.y = mapY;
        mapContainer.addChild(sprite);
    }
    };
    return (
        <>
zy-asrs-flow/src/pages/map/utils.js
@@ -12,10 +12,10 @@
    mapContainer = param;
}
export const getRealPosition = (x, y) => {
export const getRealPosition = (x, y, scale) => {
    const rect = app.view.getBoundingClientRect();
    return {
        mapX: x - rect.left,
        mapY: y - rect.top
        mapX: (x - rect.left) / scale,
        mapY: (y - rect.top) / scale
    }
}