Browse Source

Only update the visible features

pull/3/head
Jelmer van der Linde 5 years ago
parent
commit
1655349f7a
  1. 2
      index.html
  2. 5
      leaflet.indexedfeaturelayer.js

2
index.html

@ -111,7 +111,7 @@
lights.then(layer => {
let draw = function(t) {
layer.eachLayer(marker => {
layer.eachVisibleLayer(marker => {
try {
marker.setState(marker.options.sequence.state(t));
} catch (e) {

5
leaflet.indexedfeaturelayer.js

@ -106,13 +106,16 @@ L.IndexedFeatureLayer = L.GeoJSON.extend({
this._visible.removeFrom(map);
},
eachVisibleLayer: function(callback) {
return this._visible.eachLayer(callback);
},
_getBounds: function() {
return getBoundsWithPadding(this._map, this.options.padding);
},
_redraw: function() {
const layers = this.search(this._getBounds());
console.log(layers.length, 'layers');
this._visible.updateLayers(layers);
},

Loading…
Cancel
Save