-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
index.d.ts
149 lines (126 loc) · 3.28 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import * as Leaflet from "leaflet";
declare module "leaflet" {
interface Map {
/**
* SelectArea options to pass when instantiating.
*/
selectAreaOptions: SelectAreaOptions;
/**
* SelectArea instance.
*/
selectArea: SelectArea;
}
interface MapOptions {
/**
* Whether to create a SelectArea instance at map init or not.
*/
selectArea?: boolean | undefined;
/**
* Options to pass to SelectArea when instantiating.
*/
selectAreaOptions?: SelectAreaOptions | undefined;
}
/**
* Options to pass to SelectArea when instantiating.
*/
interface SelectAreaOptions {
/**
* Enable selection with the shift key.
*/
shiftKey?: boolean | undefined;
/**
* Enable selection with the ctrl key.
*/
ctrlKey?: boolean | undefined;
/**
* Function to validate if the selection should proceed.
*/
validate?: (layerPoint: Point) => boolean | undefined;
/**
* Automatically disable selection after a selection is made.
*/
autoDisable?: boolean | undefined;
/**
* CSS cursor to use when the selection tool is active.
*/
cursor?: string | undefined;
}
/**
* SelectArea class definition.
*/
interface SelectAreaStatic {
new (map: Map, options: SelectAreaOptions): SelectArea;
}
/**
* SelectArea instance methods and properties.
*/
interface SelectArea extends Handler {
/**
* Options for the SelectArea instance.
*/
options: SelectAreaOptions;
/**
* Set the validation function.
* @param validate The validation function.
* @returns The SelectArea instance.
*/
setValidate(validate: (layerPoint: Point) => boolean): SelectArea;
/**
* Set whether to auto-disable the selection tool.
* @param autoDisable Auto-disable setting.
*/
setAutoDisable(autoDisable: boolean): void;
/**
* Enable or disable the control key for selection.
* @param on Whether to enable the control key.
*/
setControlKey(on: boolean): void;
/**
* Enable or disable the shift key for selection.
* @param on Whether to enable the shift key.
*/
setShiftKey(on: boolean): void;
/**
* Enable the selection tool.
* @param validate Optional validation function.
* @param autoDisable Optional auto-disable setting.
*/
enable(
validate?: (layerPoint: Point) => boolean,
autoDisable?: boolean
): void;
/**
* Disable the selection tool.
*/
disable(): void;
}
let SelectArea: SelectAreaStatic;
interface SelectAreaEvent extends LeafletEvent {
/**
* The selected area bounds.
*/
bounds: LatLngBounds;
/**
* The starting LatLng of the selection.
*/
start: LatLng;
/**
* The ending LatLng of the selection.
*/
end: LatLng;
}
interface LeafletEventHandlerFnMap {
/**
* Fired when the area selection is completed.
*/
"selectarea:selected"?: (event: SelectAreaEvent) => void | undefined;
/**
* Fired when the area selection starts.
*/
"selectarea:start"?: LeafletEventHandlerFn | undefined;
/**
* Fired when the area selection toggles on or off.
*/
"selectarea:toggled"?: LeafletEventHandlerFn | undefined;
}
}