基于高德地图JS api开发的geojson编辑器. http://geojson.finevis.cc/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2 KiB

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<HTMLDivElement>(null);
const mapState = useSelector(mapStateSelector);
const dispatch = useDispatch();
const [mapEditor, setMapEditor] = useState<MapEditor | null>(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 (
<>
<div className="map-stage" ref={mapStageRef}></div>
<div className="tools-properties"></div>
<div className="tools-area">
<Tools />
</div>
</>
);
};
// const mapStateToProps = (state: IEditorState) => {
// return state.map;
// };
export default Plot;