1

I created a toolbar to add different markers with Leaflet.Editable (http://leaflet.github.io/Leaflet.Editable/example/index.html) Is there a way to change the marker according to the tool used to add a marker? How can I pass the attributes to be a L.Control.extend to a layer designed by Leaflet.Editable?

Any suggestion is welcome!

2

OK, I have found this solution:

I replaced the drawing function through the options as below window.LAYER = this.options.callback.call(map.editTools)

L.EditControl = L.Control.extend({ options: { position: 'topleft', callback: null, icon: null, ... }, onAdd: function (map) { let container = L.DomUtil.create('li', 'drawing-tool'), ...; L.DomEvent.on(container, 'click', L.DomEvent.stop) .on(container, 'click', function () { // I replaced the drawing function through the options as below // window.LAYER = this.options.callback.call(map.editTools);
window.LAYER = this.options.callback.call( map.editTools, null, this.options ); }, this); return container; } });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.