kopia lustrzana https://github.com/geodienst/lighthousemap
Only update the visible features
rodzic
2c8a5bdd25
commit
1655349f7a
|
@ -111,7 +111,7 @@
|
||||||
|
|
||||||
lights.then(layer => {
|
lights.then(layer => {
|
||||||
let draw = function(t) {
|
let draw = function(t) {
|
||||||
layer.eachLayer(marker => {
|
layer.eachVisibleLayer(marker => {
|
||||||
try {
|
try {
|
||||||
marker.setState(marker.options.sequence.state(t));
|
marker.setState(marker.options.sequence.state(t));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -106,13 +106,16 @@ L.IndexedFeatureLayer = L.GeoJSON.extend({
|
||||||
this._visible.removeFrom(map);
|
this._visible.removeFrom(map);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
eachVisibleLayer: function(callback) {
|
||||||
|
return this._visible.eachLayer(callback);
|
||||||
|
},
|
||||||
|
|
||||||
_getBounds: function() {
|
_getBounds: function() {
|
||||||
return getBoundsWithPadding(this._map, this.options.padding);
|
return getBoundsWithPadding(this._map, this.options.padding);
|
||||||
},
|
},
|
||||||
|
|
||||||
_redraw: function() {
|
_redraw: function() {
|
||||||
const layers = this.search(this._getBounds());
|
const layers = this.search(this._getBounds());
|
||||||
console.log(layers.length, 'layers');
|
|
||||||
this._visible.updateLayers(layers);
|
this._visible.updateLayers(layers);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue