import { Layout } from "antd"; import { useEffect, useRef, useState } from "react"; import { useSelector, useDispatch } from "react-redux"; import { MapEditor } from "@map"; import { editorAction, IEditorState } from "@store"; import Tools from "./Tools"; import "./index.less"; const mapStateSelector = (state: IEditorState) => state.map; const { Header, Footer, Sider, Content } = Layout; const Plot = () => { const mapStageRef = useRef(null); const mapState = useSelector(mapStateSelector); const dispatch = useDispatch(); const [mapEditor, setMapEditor] = useState(null); // !mapEditor && useEffect(() => { if (mapEditor == null) { const editor = new MapEditor(mapStageRef.current!); setMapEditor(editor); editor.init().then(() => { editor.update(mapState); }); } }, [mapEditor, mapState]); mapEditor?.update(mapState); return ( <>
); }; // const mapStateToProps = (state: IEditorState) => { // return state.map; // }; export default Plot;