Frontend: Always show marker on map, if query contains lat & long

This commit is contained in:
Michael Mayer 2019-05-30 02:02:47 +02:00
parent 89b1858f3b
commit ec0559136b

View File

@ -76,8 +76,6 @@
this.$viewer.show(this.results, index)
},
currentPositionSuccess(position) {
this.center = L.latLng(position.coords.latitude, position.coords.longitude);
this.position = L.latLng(position.coords.latitude, position.coords.longitude);
this.query.lat = position.coords.latitude;
this.query.long = position.coords.longitude;
this.query.q = "";
@ -174,7 +172,16 @@
this.$alert.info(photos.length + ' photos found');
}
},
updateQuery() {
this.$router.replace({query: this.query});
if(this.query.lat && this.query.long) {
this.position = L.latLng(this.query.lat, this.query.long);
this.center = L.latLng(this.query.lat, this.query.long);
} else {
this.position = null;
}
},
search() {
// Don't query the same data more than once
if (JSON.stringify(this.lastQuery) === JSON.stringify(this.query)) return;
@ -183,6 +190,8 @@
this.offset = 0;
this.updateQuery();
this.$router.replace({query: this.query});
const params = {