Closed terrymainvis closed 3 years ago
Hello.
In the Motion.Event.Section callback you will get only next layer so far. One of the options is to query for all layers and for each of them call layer.removeFrom(sequence); and layer.removeFrom(map); - this should definitelly remove it from everywhere.
Thank you for your reply. It's almost working with something like this: (Not very clean solution but just trying to make it work for now) `
seq.on(leaflet.Motion.Event.Section , evt => {
if (this.currentPolylineIndex > 2) {
this.polylines[this.currentPolylineIndex - 2].removeFrom(this.map);
}
this.currentPolylineIndex ++;
});
` So as soon as I displayed 2 polylines, I start removing the first one and so on. Issue is that it seems that Section Event is not triggered only when starting to draw a polyline as I first thought. The doc says "Fires on each motion section change in L.Motion.Seq starting with first one", what does motion section changes means here?
I solved my issue. Not sure if that's intended but any changes on the layers level makes the seq to start again. For instance, each time I was deleting a polyline, the seq was starting a new instance. Adding myLayer.off() before deleting it to prevent any event to be triggered solved my main issue.
Hello,
I am using the seq functionality to display multiple polyline but I would like to remove the ones which have their animation finished (To avoid having too many lines drawn). I am trying to do it in the Motion.Event.Section callback, trying to remove the finished animation but no result so far. Am I missing something?