diff --git a/src/App.js b/src/App.js index c21360b..a924a50 100644 --- a/src/App.js +++ b/src/App.js @@ -179,7 +179,7 @@ function App() { */} {/* */} - {/* */} + ); diff --git a/src/components/TestComponentNew/Grid.js b/src/components/TestComponentNew/Grid.js deleted file mode 100644 index 367dc34..0000000 --- a/src/components/TestComponentNew/Grid.js +++ /dev/null @@ -1,31 +0,0 @@ -import L from "leaflet"; -import { GridLayer, withLeaflet } from "react-leaflet"; - -class Grid extends GridLayer { - createLeafletElement() { - const Grid = L.GridLayer.extend({ - createTile: () => { - const tile = document.createElement("div"); - tile.style.outline = "1px solid black"; - return tile; - }, - }); - return new Grid({ tileSize: 100 }); - } - - componentDidMount() { - const { map } = this.props.leaflet; - if (this.props.showGrid) this.leafletElement.addTo(map); - } - - updateLeafletElement(fromProps, toProps) { - const { map } = this.props.leaflet; - if (toProps.showGrid !== fromProps.showGrid) { - toProps.showGrid - ? this.leafletElement.addTo(map) - : this.leafletElement.removeFrom(map); - } - } -} - -export default withLeaflet(Grid); diff --git a/src/components/TestComponentNew/index.js b/src/components/TestComponentNew/index.js index 2e1cb35..ffab46a 100644 --- a/src/components/TestComponentNew/index.js +++ b/src/components/TestComponentNew/index.js @@ -1,78 +1,7 @@ -import React, { useState, useRef, useMemo } from "react"; -import { - MapContainer, - TileLayer, - FeatureGroup, - Rectangle, - useMap, - LayerGroup, - ZoomControl, - ScaleControl, -} from "react-leaflet"; -import "leaflet/dist/leaflet.css"; -import "leaflet-draw/dist/leaflet.draw.css"; -import { EditControl } from "react-leaflet-draw"; -import "leaflet-draw"; -import "./index.scss"; -import grid from "../../assets/images/grid.png"; -// import Grid from "./Grid"; -const outerBounds = [ - [50.505, -29.09], - [52.505, 29.09], -]; +import React from "react"; -const TestComponentNew = () => { - const leafEl = useRef(null); - const onCreated = (e) => { - const drawnItems = leafEl.current._layers; - console.log({ drawnItems }); - // if (Object.keys(drawnItems).length > 1) { - // Object.keys(drawnItems).forEach((layerid, index) => { - // if (index > 0) return; - // const layer = drawnItems[layerid]; - // leafEl.current.removeLayer(layer); - // }); - // console.log(drawnItems); - // } - }; - - return ( - - - - - - - - - - - ); +const index = () => { + return
index
; }; -export default TestComponentNew; +export default index; diff --git a/src/components/TestComponentNew/index.scss b/src/components/TestComponentNew/index.scss deleted file mode 100644 index 89e0beb..0000000 --- a/src/components/TestComponentNew/index.scss +++ /dev/null @@ -1,12 +0,0 @@ -.leaflet-container { - width: 100%; - height: 100vh; -} -.leaflet-control-scale-line:not(:first-child) { - display: none !important; -} -.leaflet-tile { - border: 1px solid gray; - - box-sizing: content-box; -}