I'm using the leaflet snaking polyline to draw a route on a map with multiple markers, and have it working. However, I want to make the snaking speed a setting that the user can change, so I need to be able to modify the default snaking speed when I add the layerGroup to the layer. To add the layer with the default snaking speed I simply have the following line of code (and it works):
layerGrp.addLayer( endMarker );
layerGrp.addTo(polyLayer).snakeIn();
But I want to really add
layerGrp.addLayer(endMarker, { snakingSpeed: snakingSpeedFromUser } );
layerGrp.addTo(polyLayer).snakeIn();
I've tried what's shown above, and also just
layerGrp.addLayer( {snakingSpeed: snakingSpeedFromUser } );
But both of them give me a runtime error of
Uncaught (in promise) Error: The provided object is not a Layer.
Polylayer is a layergroup so I can show/hide the polylines. Here's where it is added to the map:
var gridLayer = L.layerGroup([]);
var polyLayer = L.layerGroup([]);
var overlayMaps = { "Track": polyLayer, "Grid": gridLayer };
var layerControls = { "Map": mapLayer,
"Track": polyLayer,
"Grid": gridLayer };
How can I add the options to the layerGroup dynamically at runtime?
Thanks......