Leaflet.CanvasLayer.Field
Leaflet.CanvasLayer.Field copied to clipboard
`TypeError` upon removing `VectorField` layer from map using layer control
When unchecking a VectorFieldAnim layer from a layer control, the console shows the following error several hundred times:
Uncaught TypeError: Cannot read property 'latLngToContainerPoint' of null
at e._drawParticle (L.CanvasLayer.VectorFieldAnim.js:122)
at L.CanvasLayer.VectorFieldAnim.js:109
at Array.forEach (<anonymous>)
at n (L.CanvasLayer.VectorFieldAnim.js:108)
at L.CanvasLayer.VectorFieldAnim.js:52
at Mn (d3.v4.min.js:2)
at Tn (d3.v4.min.js:2)
Is some asynchronous particle calculation not stopping after removing the map?
I can reproduce this behavior with the following steps using a layer control:
-
Add the
VectorFieldAnimlayer -
Add a
ScalarFieldlayer, in this case from an ASCII grid file -
Remove the
VectorFieldAnimlayer
The errors stop when the VectorFieldAnim layer is put back into the map
Perhaps related https://github.com/IHCantabria/Leaflet.CanvasLayer.Field/issues/41 (I have the same behaviour)