Add guard to fix overlapping regional forecast icons after a period of time
This commit is contained in:
parent
31713abfaa
commit
a23eb483ea
1 changed files with 27 additions and 20 deletions
|
|
@ -21,6 +21,7 @@ class RegionalForecast extends WeatherDisplay {
|
|||
this.locationMarker = null;
|
||||
this.nearbyMarkers = [];
|
||||
this.nearbyMarkersKey = '';
|
||||
this.refreshingMarkers = false;
|
||||
}
|
||||
|
||||
async getData(weatherParameters, refresh) {
|
||||
|
|
@ -54,8 +55,11 @@ class RegionalForecast extends WeatherDisplay {
|
|||
}
|
||||
|
||||
async refreshNearbyMarkers() {
|
||||
if (!this.map || !this.active) return;
|
||||
if (!this.map || !this.active || this.refreshingMarkers) return;
|
||||
|
||||
this.refreshingMarkers = true;
|
||||
|
||||
try {
|
||||
this.map.invalidateSize(false);
|
||||
this.map.setView([this.weatherParameters.latitude, this.weatherParameters.longitude], 6);
|
||||
|
||||
|
|
@ -78,6 +82,9 @@ class RegionalForecast extends WeatherDisplay {
|
|||
});
|
||||
this.nearbyMarkers.forEach((marker) => marker.addTo(this.map));
|
||||
this.nearbyMarkersKey = markerKey;
|
||||
} finally {
|
||||
this.refreshingMarkers = false;
|
||||
}
|
||||
}
|
||||
|
||||
async ensureMap() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue