Large route Uncaught RangeError: Maximum call stack size exceeded
Hi,
Excellent plugin. Really nice visuals.
For quite large routes I do sometimes run into an error: Uncaught RangeError: Maximum call stack size exceeded
Uncaught RangeError: Maximum call stack size exceeded L.Projection.SphericalMercator.project @ leaflet-src.js:1465 L.CRS.latLngToPoint @ leaflet-src.js:1499 L.Map.L.Evented.extend.project @ leaflet-src.js:2060 L.Map.L.Evented.extend.latLngToLayerPoint @ leaflet-src.js:2074 L.Map.L.Evented.extend.latLngToContainerPoint @ leaflet-src.js:2100 L.Polyline.include._snakeForward @ L.Polyline.SnakeAnim.js:81 L.Polyline.include._snakeForward @ L.Polyline.SnakeAnim.js:106 L.Polyline.include._snakeForward @ L.Polyline.SnakeAnim.js:106 L.Polyline.include._snakeForward @ L.Polyline.SnakeAnim.js:106 L.Polyline.include._snakeForward @ L.Polyline.SnakeAnim.js:106
Example can be found at: http://maps.gisforthought.com/leaflet_snake_demo/demo.html
With the route file: http://maps.gisforthought.com/leaflet_snake_demo/route.js
But works on a simplified version of the same route.
I know, there is a problem with the recursive tail calls. It's not about now large the route is, but rather about how many vertices have to be skipped in a frame.
The solution is to replace the recursive calls to _snakeForward with a loop. Right now I'm not focusing on this plugin, so feel free to work on a solution.