#
luxiaotao1123
2024-03-02 2e4d0e4edb6b892223dce6513c9e0f8a24fa970d
zy-asrs-flow/src/pages/map/components/edit.jsx
@@ -1,7 +1,30 @@
import React, { useState, useRef, useEffect } from 'react';
import { Col, Form, Modal, Row, Checkbox, Skeleton, Tree, Drawer, Space, Button, Card } from 'antd';
import { Col, Form, Modal, Row, Checkbox, Image, Tree, Drawer, Space, Button, Card } from 'antd';
import { FormattedMessage, useIntl, useModel } from '@umijs/max';
import * as PIXI from 'pixi.js';
import agv from '/public/img/map/agv.svg'
const Edit = (props) => {
    const [dragging, setDragging] = useState(false);
    const [dragImage, setDragImage] = useState(null);
    useEffect(() => {
        const handleMouseMove = (e) => {
            if (dragging) {
                props.onDrop(e.clientX, e.clientY);
                setDragging(false);
                props.onCancel();
            }
        };
        window.addEventListener('mousemove', handleMouseMove);
        return () => window.removeEventListener('mousemove', handleMouseMove);
    }, [dragging, props.onDrop, props.onCancel]);
    const onDragStart = (e) => {
        setDragging(true)
    };
    return (
        <>
            <Drawer
@@ -13,9 +36,20 @@
                rootStyle={{ position: "absolute" }}
                mask={false}
                width={378}
                extra={
                    <Space>
                        <Button onClick={() => props.onCancel()}><FormattedMessage id='common.cancel' defaultMessage='取消' /></Button>
                    </Space>
                }
            >
                <Card>
                    <Image
                        src={agv}
                        width='50px'
                        preview={false}
                        draggable="true"
                        onDragStart={onDragStart}
                    />
                </Card>
            </Drawer>
        </>