You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The purpose of this hook is to provide functionality for editing features on the map, such as drawing polylines, polygons, markers, rectangles, circles, and more.
6
10
7
-
## Demo
8
-
https://leaflet-editable-hook.vercel.app/
11
+
## Demo
12
+
13
+
https://leaflet-editable-hook.vercel.app/
9
14
10
15
## Prerequisites
16
+
11
17
- leaflet: "^1.9.4"
12
18
- leaflet-editable: "^1.2.0"
13
-
- react-leaflet: "^4.2.1"
19
+
- react: "^19.0.0"
20
+
- react-dom: "^19.0.0"
21
+
- react-leaflet: "^5.0.0"
14
22
15
23
## Installation
16
24
@@ -19,148 +27,153 @@ Install with npm
19
27
```bash
20
28
npm i leaflet-editable-hook
21
29
```
22
-
30
+
23
31
## Documentation
24
32
25
33
[See full documentation about Leaflet.Editable](https://leaflet.github.io/Leaflet.Editable/doc/api.html)
| drawing() | boolean | Return true if any drawing action is ongoing. |
30
-
| stopDrawing() | void | When you need to stop any ongoing drawing, without needing to know which editor is active. |
31
-
| commitDrawing() | void | When you need to commit any ongoing drawing, without needing to know which editor is active. |
32
-
| startPolyline(<L.LatLng> latlng, <hash> options) | L.Polyline | Start drawing a Polyline. If latlng is given, a first point will be added. In any case, continuing on user click. If options is given, it will be passed to the Polyline class constructor. |
33
-
| startPolygon(<L.LatLng> latlng, <hash> options) | L.Polygon | Start drawing a Polygon. If latlng is given, a first point will be added. In any case, continuing on user click. If options is given, it will be passed to the Polygon class constructor. |
34
-
| startMarker(<L.LatLng> latlng, <hash> options) | L.Marker | Start adding a Marker. If latlng is given, the Marker will be shown first at this point. In any case, it will follow the user mouse, and will have a final latlng on next click (or touch). If options is given, it will be passed to the Marker class constructor. |
35
-
| startRectangle(<L.LatLng> latlng, <hash> options) | L.Rectangle | Start drawing a Rectangle. If latlng is given, the Rectangle anchor will be added. In any case, continuing on user drag. If options is given, it will be passed to the Rectangle class constructor. |
36
-
| startCircle(<L.LatLng> latlng, <hash> options) | L.Circle | Start drawing a Circle. If latlng is given, the Circle anchor will be added. In any case, continuing on user drag. If options is given, it will be passed to the Circle class constructor. |
37
-
| enableEdit(feature: L.Layer) | void | Enable editing, by creating an editor if not existing, and then calling enable on it. |
38
-
| disableEdit(feature: L.Layer) | void | Disable editing, also remove the editor property reference. |
| drawing() | boolean | Return true if any drawing action is ongoing. |
38
+
| stopDrawing() | void | When you need to stop any ongoing drawing, without needing to know which editor is active. |
39
+
| commitDrawing() | void | When you need to commit any ongoing drawing, without needing to know which editor is active. |
40
+
| startPolyline(<L.LatLng> latlng, <hash> options) | L.Polyline | Start drawing a Polyline. If latlng is given, a first point will be added. In any case, continuing on user click. If options is given, it will be passed to the Polyline class constructor. |
41
+
| startPolygon(<L.LatLng> latlng, <hash> options) | L.Polygon | Start drawing a Polygon. If latlng is given, a first point will be added. In any case, continuing on user click. If options is given, it will be passed to the Polygon class constructor. |
42
+
| startMarker(<L.LatLng> latlng, <hash> options) | L.Marker | Start adding a Marker. If latlng is given, the Marker will be shown first at this point. In any case, it will follow the user mouse, and will have a final latlng on next click (or touch). If options is given, it will be passed to the Marker class constructor. |
43
+
| startRectangle(<L.LatLng> latlng, <hash> options) | L.Rectangle | Start drawing a Rectangle. If latlng is given, the Rectangle anchor will be added. In any case, continuing on user drag. If options is given, it will be passed to the Rectangle class constructor. |
44
+
| startCircle(<L.LatLng> latlng, <hash> options) | L.Circle | Start drawing a Circle. If latlng is given, the Circle anchor will be added. In any case, continuing on user drag. If options is given, it will be passed to the Circle class constructor. |
45
+
| enableEdit(feature: L.Layer) | void | Enable editing, by creating an editor if not existing, and then calling enable on it. |
46
+
| disableEdit(feature: L.Layer) | void | Disable editing, also remove the editor property reference. |
0 commit comments