File tree Expand file tree Collapse file tree 3 files changed +4
-9
lines changed
leaflet-editable-hook/src Expand file tree Collapse file tree 3 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ function App() {
15
15
editable = { true }
16
16
>
17
17
< TileLayer
18
- attribution = '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors '
18
+ attribution = '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
19
19
url = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
20
20
/>
21
21
< ControlBar />
Original file line number Diff line number Diff line change @@ -3,39 +3,34 @@ import { Button } from 'antd';
3
3
import Control from 'react-leaflet-custom-control' ;
4
4
import { TfiRulerAlt2 } from 'react-icons/tfi' ;
5
5
import { useState } from 'react' ;
6
- import { useMap } from 'react-leaflet' ;
7
6
import Area from './Area' ;
8
7
import Ruler from './Ruler' ;
9
8
10
9
function ControlBar ( ) {
11
- const map = useMap ( ) ;
12
10
const [ drawing , setDrawing ] = useState ( null ) ;
13
11
14
12
const editPolyline = ( ) => setDrawing ( drawing ? null : < Ruler /> ) ;
15
13
16
14
const editPolygon = ( ) => setDrawing ( drawing ? null : < Area /> ) ;
17
15
18
- if ( ! map ) return null ;
19
16
return (
20
17
< >
21
18
< Control prepend position = "topright" >
22
19
< div className = "leaflet-bar" style = { { backgroundColor : 'white' } } >
23
20
< Button
24
- icon = { < TfiRulerAlt2 color = { drawing ?. type === Ruler ? 'black ' : 'lightgray ' } /> }
21
+ icon = { < TfiRulerAlt2 color = { drawing ?. type === Ruler ? 'blue ' : 'black ' } /> }
25
22
type = "text"
26
23
onClick = { editPolyline }
27
24
disabled = { drawing && drawing . type !== Ruler }
28
25
/>
29
- < hr className = "w-8/12 mx-auto" />
30
26
< Button
31
- icon = { < FaDraftingCompass color = { drawing ?. type === Area ? 'black ' : 'lightgray ' } /> }
27
+ icon = { < FaDraftingCompass color = { drawing ?. type === Area ? 'blue ' : 'black ' } /> }
32
28
type = "text"
33
29
onClick = { editPolygon }
34
30
disabled = { drawing && drawing . type !== Area }
35
31
/>
36
32
</ div >
37
33
</ Control >
38
-
39
34
{ drawing }
40
35
</ >
41
36
) ;
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ function RulerMarker({ position, length }) {
65
65
} ) }
66
66
>
67
67
< Tooltip permanent offset = { [ 10 , 0 ] } direction = "right" >
68
- { length . toFixed ( 3 , 10 ) } KM
68
+ { length . toFixed ( 3 ) } KM
69
69
</ Tooltip >
70
70
</ Marker >
71
71
) ;
You can’t perform that action at this time.
0 commit comments