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
Copy file name to clipboardExpand all lines: API.md
+11-21
Original file line number
Diff line number
Diff line change
@@ -184,43 +184,32 @@ The three draw modes work identically. They do not take an options argument.
184
184
185
185
Draw fires off a number of events on draw and select actions. All of these events are name spaced `draw` inside of the mapboxgl event emitter.
186
186
187
-
### draw.change_mode
187
+
### draw.modechange
188
188
189
-
This event is fired just after the current mode is stopped and just before the next mode is started.If the `new` object provided is changed, the changed values will be used to start the next mode.
189
+
This event is fired just after the current mode is stopped and just before the next mode is started. A render will not happen until after all event handlers have been triggered. This means you can force a mode redirect by calling `changeMode` inside of a `draw.modechange` handler.
190
190
191
191
This is not fired when the first mode is started.
192
192
193
193
Here is an example payload.
194
194
195
195
```js
196
196
{
197
-
old: {
198
-
mode:`default`,
199
-
options: []
200
-
},
201
-
new: {
202
-
mode:`direct_select`
203
-
options:'123123123'
204
-
}
197
+
mode:`direct_select`
198
+
opts:'123123123'
205
199
}
206
200
```
207
201
208
-
### draw.delete
202
+
### draw.deleted
209
203
210
204
This is fired every time a feature is deleted inside of `mapbox-gl-draw`. The payload is the GeoJSON feature just before it was deleted.
211
205
212
-
### draw.active
206
+
### draw.mode.default.selected.start
213
207
214
-
This is fired every time a feature is set to active or inactive. If a feature was active and is then set to active again, this is not fired. Same goes for inactive. This is only fired for features. Not for vertices.
208
+
This is fired every time a feature is selected in the default mode. The payload is an array of feature ids being selected. This is **NOT** fired when the mode starts as this information is in the `draw.modechange` event.
215
209
216
-
Here is an example payload.
210
+
### draw.mode.default.selected.end
217
211
218
-
```js
219
-
{
220
-
active:false,
221
-
featureId:'123123123'
222
-
}
223
-
```
212
+
This is fired every time a feature is unselected in the default mode. The payload is an array of feature ids being unselected. This is **NOT** fired when the mode stops, as this can be assumed via the `draw.modechange` event.
224
213
225
214
## Styling Draw
226
215
@@ -286,5 +275,6 @@ property | values | function
286
275
id | string | only available when `meta` is `feature`
287
276
parent | string | only avaible when `meta` is not `feature`
288
277
coord_path | string | a `.` seporated path to one [lon, lat] entity in the parents coordinates
289
-
lon | number | the longitude value of a handle. Only available when `meta` is ` midpoint`.
278
+
lon | number | the longitude value of a handle. Only available when `meta` is `midpoint`.
279
+
lat | number | the latitude value of a handle. Only available when `meta` is `midpoint`.
290
280
bbox | array | the bounding box of the hidden features. Only available when `meta` is `too-small`.
0 commit comments