Track which map bounds are already done

This commit is contained in:
Edward Betts 2021-10-22 12:06:10 +01:00
parent 74f82ecbb0
commit b18162fb1a

View file

@ -1473,6 +1473,13 @@ export default {
} }
}, },
load_wikidata_items(bounds) { load_wikidata_items(bounds) {
bounds ||= this.map.getBounds();
var this_update = this.map_update_number += 1;
for(const b of this.bounds_done) {
if (b.contains(bounds)) return; // already done
}
this.load_button_pressed = true; this.load_button_pressed = true;
this.wikidata_loaded = false; this.wikidata_loaded = false;
this.osm_loaded = false; this.osm_loaded = false;
@ -1607,6 +1614,8 @@ export default {
if (!item.wikidata) missing_qids.push(qid); if (!item.wikidata) missing_qids.push(qid);
} }
this.bounds_done.push(this.map.getBounds());
if (missing_qids.length == 0) { if (missing_qids.length == 0) {
this.update_wikidata(); this.update_wikidata();
this.check_for_missing_done = true; this.check_for_missing_done = true;