Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Event viewreset is not fired in leaflet version 1.0.2

I am using d3 with Leaflet (v 1.0.2) and need to catch the viewreset event, but it's not fired.

this.map.on("viewreset", () => console.log("VIEW RESET"));

Is anyone else having this problem? I'm able to catch the zoomend event for example.

Also, manipulating positions and etc. on svg-layers is a bit of a pain as well in the new versions of Leaflet...but that is another story.

JSFidlle showing the problem http://leafletjs.com/reference-1.0.2.html

like image 605
Martin Avatar asked Oct 29 '25 01:10

Martin


1 Answers

According to: https://github.com/Leaflet/Leaflet/issues/4837

in 1.0, layers will have to rely on both zoom (zoom change) and viewreset (full reset of a layer). This was necessary to implement flyTo and other arbitrary animations.

And in: https://github.com/Leaflet/Leaflet/pull/3278

remove viewreset event and depend solely on zoom event in layers instead

So viewreset event is no longer triggered on zoom.

like image 100
eko Avatar answered Oct 31 '25 15:10

eko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!