|
| 1 | +// useLeafletEditable.d.ts |
| 2 | +import "leaflet-editable"; |
| 3 | +import { |
| 4 | + Layer, |
| 5 | + LayerEventHandlerFn, |
| 6 | + LeafletEventHandlerFn, |
| 7 | + VertexEventHandlerFn, |
| 8 | + CancelableEventHandlerFn, |
| 9 | + ShapeEventHandlerFn, |
| 10 | + Editable, |
| 11 | +} from "leaflet"; |
| 12 | + |
| 13 | +// Type definitions for event handlers used by the useLeafletEditable hook |
| 14 | +export interface LeafletEditableEventHandlers { |
| 15 | + onCreated?: LayerEventHandlerFn; |
| 16 | + onEnable?: LeafletEventHandlerFn; |
| 17 | + onDisable?: LeafletEventHandlerFn; |
| 18 | + onEditing?: LeafletEventHandlerFn; |
| 19 | + onDragStart?: LeafletEventHandlerFn; |
| 20 | + onDrag?: LeafletEventHandlerFn; |
| 21 | + onDragEnd?: LeafletEventHandlerFn; |
| 22 | + onDrawingStart?: LeafletEventHandlerFn; |
| 23 | + onDrawingEnd?: LeafletEventHandlerFn; |
| 24 | + onDrawingCancel?: LeafletEventHandlerFn; |
| 25 | + onDrawingCommit?: LeafletEventHandlerFn; |
| 26 | + onDrawingMousedown?: LeafletEventHandlerFn; |
| 27 | + onDrawingMouseup?: LeafletEventHandlerFn; |
| 28 | + onDrawingClick?: CancelableEventHandlerFn; |
| 29 | + onDrawingMove?: LeafletEventHandlerFn; |
| 30 | + onDrawingClicked?: LeafletEventHandlerFn; |
| 31 | + onVertexNew?: VertexEventHandlerFn; |
| 32 | + onVertexClick?: CancelableEventHandlerFn; |
| 33 | + onVertexClicked?: VertexEventHandlerFn; |
| 34 | + onVertexRawclick?: CancelableEventHandlerFn; |
| 35 | + onVertexDeleted?: VertexEventHandlerFn; |
| 36 | + onVertexCtrlclick?: VertexEventHandlerFn; |
| 37 | + onVertexShiftclick?: VertexEventHandlerFn; |
| 38 | + onVertexMetakeyclick?: VertexEventHandlerFn; |
| 39 | + onVertexAltclick?: VertexEventHandlerFn; |
| 40 | + onVertexContextmenu?: VertexEventHandlerFn; |
| 41 | + onVertexMousedown?: VertexEventHandlerFn; |
| 42 | + onVertexDrag?: VertexEventHandlerFn; |
| 43 | + onVertexDragstart?: VertexEventHandlerFn; |
| 44 | + onVertexDragend?: VertexEventHandlerFn; |
| 45 | + onMiddlemarkerMousedown?: VertexEventHandlerFn; |
| 46 | + onShapeNew?: ShapeEventHandlerFn; |
| 47 | + onShapeDelete?: CancelableEventHandlerFn; |
| 48 | + onShapeDeleted?: ShapeEventHandlerFn; |
| 49 | +} |
| 50 | + |
| 51 | +export interface UseLeafletEditableOptions { |
| 52 | + events: LeafletEditableEventHandlers; |
| 53 | +} |
| 54 | + |
| 55 | +export function useLeafletEditable( |
| 56 | + options: UseLeafletEditableOptions, |
| 57 | +): Editable & { |
| 58 | + enableEdit: (feature: Layer) => void; |
| 59 | + disableEdit: (feature: Layer) => void; |
| 60 | +}; |
0 commit comments