cartoj.draw
MapboxDraw control component using react-map-gl's useControl hook.
Usage:
[draw/draw-control {:position "top-left"
:on-create (fn [^js evt] ...)
:on-update (fn [^js evt] ...)
:on-delete (fn [^js evt] ...)}]draw-control
(draw-control & args)
Reagent component wrapping @mapbox/mapbox-gl-draw via useControl.
Props:
:position — control position string (optional)
:on-create — callback (fn [^js evt]) — evt.features is a JS array
:on-update — callback (fn [^js evt]) — evt.features, evt.action
:on-delete — callback (fn [^js evt]) — evt.features
:on-render — callback (fn [^js evt ^js draw]) — fires on every internal
store render (during drawing AND after mutations). Call
(.getAll draw) to read the current FeatureCollection.
All other props are passed to the MapboxDraw constructor (kebab-case keys
converted to camelCase).
Returns nil (the control renders nothing to the DOM).