Open cyrilchapon opened 7 years ago
Workaround : Instanciate a temporary object
(new MapboxDraw()).modes
and use it to instanciate the real MapboxDraw object
var modes = (new MapboxDraw()).modes;
modes.MYCUSTOMMODE = MyCustomMode;
var draw = new MapboxDraw({
modes: modes
});
MapboxDraw.modes
should be ./src/modes/index.js
while api.modes
is the Modes constants object. Part of me wants to drop api.modes
along with a fix for this to help mitigate confusion about what these two values indicate.
Agreed, furthermore js convention for uppercase is prototype I think, while lowercased camel for instances, isn't it ?
Envoyé de mon iPhone
Le 29 août 2017 à 17:49, Matthew Chase Whittemore notifications@github.com<mailto:notifications@github.com> a écrit :
MapboxDraw.modes should be ./src/modes/index.js while api.modes is the Modes constants object. Part of me wants to drop api.modes along with a fix for this to help mitigate confusion about what these two values indicate.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/mapbox/mapbox-gl-draw/issues/683#issuecomment-325707659, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKOz6sdLwCswy7K4Gw99foc1nxNuwexYks5sdDMYgaJpZM4PFpz7.
I'm not sure what you're asking @cyrilchapon. Can you provide an example?
Hey there! @mcwhittemore was this ever fixed? I'm still getting this as undefined and have been unable to add custom modes on the most recent release.
Because of this issue, the instructions provided at https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/MODES.md don't work.
mapbox-gl-js version: v0.39.1 mapbox-gl-draw version: v0.19.0
Steps to Trigger Behavior
console.log(MapboxDraw.modes)
Expected Behavior
API states that
Actual Behavior
MapboxDraw.modes
is undefinedSide notes
I'm using both mapboxgl and mapboxgldraw from a CDN in the browser, using globals from
window