Skip to content

Commit f9b7e41

Browse files
Actualizar atribución de OpenStreetMap y cambiar el color de los íconos en ControlBar
1 parent 6024c39 commit f9b7e41

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

leaflet-editable-hook/src/App.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function App() {
1515
editable={true}
1616
>
1717
<TileLayer
18-
attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
18+
attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
1919
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
2020
/>
2121
<ControlBar />

leaflet-editable-hook/src/ControlBar.jsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,34 @@ import { Button } from 'antd';
33
import Control from 'react-leaflet-custom-control';
44
import { TfiRulerAlt2 } from 'react-icons/tfi';
55
import { useState } from 'react';
6-
import { useMap } from 'react-leaflet';
76
import Area from './Area';
87
import Ruler from './Ruler';
98

109
function ControlBar() {
11-
const map = useMap();
1210
const [drawing, setDrawing] = useState(null);
1311

1412
const editPolyline = () => setDrawing(drawing ? null : <Ruler />);
1513

1614
const editPolygon = () => setDrawing(drawing ? null : <Area />);
1715

18-
if (!map) return null;
1916
return (
2017
<>
2118
<Control prepend position="topright">
2219
<div className="leaflet-bar" style={{ backgroundColor: 'white' }}>
2320
<Button
24-
icon={<TfiRulerAlt2 color={drawing?.type === Ruler ? 'black' : 'lightgray'} />}
21+
icon={<TfiRulerAlt2 color={drawing?.type === Ruler ? 'blue' : 'black'} />}
2522
type="text"
2623
onClick={editPolyline}
2724
disabled={drawing && drawing.type !== Ruler}
2825
/>
29-
<hr className="w-8/12 mx-auto" />
3026
<Button
31-
icon={<FaDraftingCompass color={drawing?.type === Area ? 'black' : 'lightgray'} />}
27+
icon={<FaDraftingCompass color={drawing?.type === Area ? 'blue' : 'black'} />}
3228
type="text"
3329
onClick={editPolygon}
3430
disabled={drawing && drawing.type !== Area}
3531
/>
3632
</div>
3733
</Control>
38-
3934
{drawing}
4035
</>
4136
);

leaflet-editable-hook/src/Ruler.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function RulerMarker({ position, length }) {
6565
})}
6666
>
6767
<Tooltip permanent offset={[10, 0]} direction="right">
68-
{length.toFixed(3, 10)} KM
68+
{length.toFixed(3)} KM
6969
</Tooltip>
7070
</Marker>
7171
);

0 commit comments

Comments
 (0)