Replace map initial center/zoom config with auto fitting

Closes #23
This commit is contained in:
Linus Groh
2020-03-01 20:28:15 +00:00
parent bb81daaea4
commit 3b18ab58ed
4 changed files with 13 additions and 32 deletions

View File

@@ -17,10 +17,6 @@ const DEFAULT_CONFIG = {
map: {
attribution:
'&copy; <a href="https://osm.org/copyright">OpenStreetMap</a> contributors',
center: {
lat: 0,
lng: 0,
},
circle: {
color: null,
fillColor: null,
@@ -65,7 +61,6 @@ const DEFAULT_CONFIG = {
fillColor: "transparent",
},
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
zoom: 19,
},
onLocationChange: {
reloadHistory: false,

View File

@@ -23,8 +23,11 @@ export default new Vuex.Store({
startDateTime: config.startDateTime.toISOString().slice(0, 19),
endDateTime: config.endDateTime.toISOString().slice(0, 19),
map: {
center: config.map.center,
zoom: config.map.zoom,
center: {
lat: 0,
lng: 0,
},
zoom: 19,
layers: config.map.layers,
},
distanceTravelled: null,

View File

@@ -232,5 +232,13 @@ export default {
}));
},
},
watch: {
lastLocations() {
this.fitView();
},
locationHistory() {
this.fitView();
},
},
};
</script>