Skip to content

Commit 3aaa9d1

Browse files
committed
Fix onZoomEnd bug: only remove affected features based on their zoom
and the zoom of the map.
1 parent 8f0925b commit 3aaa9d1

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

Diff for: src/mapml/layers/FeatureLayer.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,10 @@ export var FeatureLayer = L.FeatureGroup.extend({
157157
},
158158

159159
_handleZoomEnd: function (e) {
160-
let mapZoom = this._map.getZoom();
161-
if (
162-
this.zoomBounds &&
163-
(mapZoom > this.zoomBounds.maxZoom || mapZoom < this.zoomBounds.minZoom)
164-
) {
165-
this.clearLayers();
166-
return;
160+
// handle zoom end gets called twice for every zoom, this condition makes it go through once only.
161+
if (this.zoomBounds) {
162+
this._resetFeatures();
167163
}
168-
this._resetFeatures();
169164
},
170165

171166
// remove or add features based on the min max attribute of the features,

0 commit comments

Comments
 (0)