javascript – 在传单版本1.0.2中未触发事件视图复制

我正在使用带有Leaflet的v3(v 1.0.2)并且需要捕获viewreset事件,但它没有被触发.

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

还有其他人有这个问题吗?例如,我能够捕捉到zoomend事件.

另外,在新版本的Leaflet中操纵svg-layers上的位置等也有点痛苦……但这是另一个故事.

JSFidlle显示问题http://leafletjs.com/reference-1.0.2.html

解决方法:

根据: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.

并在:https://github.com/Leaflet/Leaflet/pull/3278

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

因此,在缩放时不再触发viewreset事件.

上一篇:javascript – 刷新传单地图:地图容器已经初始化


下一篇:javascript – Leaflet Simple CRS