Open ThisIsMissEm opened 3 years ago
Admittedly we can already access both @mapbox/mapbox-gl-draw/src/modes/draw_polygon
and @mapbox/mapbox-gl-draw/src/modes/direct_select
via:
import MapboxDraw from '@mapbox/mapbox-gl-draw';
const DrawPolygon = MapboxDraw.modes.draw_polygon;
If I'm understanding the code correctly.
mapbox-gl-js version: n/a mapbox-gl-draw version: latest
Currently when writing a custom drawing mode for
@mapbox/mapbox-draw-gl
a whole heap of internal modules are required to be imported, for instance: https://github.com/bemky/mapbox-gl-draw-freehand-mode/blob/master/src/index.js#L1-L3This is further a problem for people using typescript, where you need to declare each of the internal modules that your drawing mode uses:
(the above are what we required for the custom drawing modes that we have in the Yara AtFarm+ application)
I think the solution would be to have
/index.js
re-export all of those modules as a public API, rather than having them as internal modules.