leaflet-corridor
leaflet-corridor copied to clipboard
How to handle changing the corridor dynamically?
Hi, It is a good idea to make polyline rendered weight in meters. Can anyone give a pointer on how to handle the case of corridor value change dynamically? I am new to leaflet.
Thanks alot, John
What's the exact scenario?
I am using it with leaflet Draw to draw polylines with (corridor/weight) in meters. After a change in corridor, I update its options.corridor =
I think you need to pass map as this to updateCallback:
line.corridor += 1000;
line.updateCallback.call(map);
seems to work.
Hi mikhailshilkov,
Wow, It works. Great thanks. I think It would look cleaner if it requires only one method call like layer.refresh();.
Have a great weekend. John.
Sure, I haven't considered that scenario in the initial implementation. Feel free to send a PR.