1
0
mirror of https://github.com/Luzifer/mapshare.git synced 2024-09-19 15:22:58 +00:00

Allow to configure zoom through URL parameter

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2020-09-09 16:57:05 +02:00
parent 8949f09b90
commit 0c8301a53a
Signed by: luzifer
GPG Key ID: DC2729FDD34BE99E

View File

@ -56,6 +56,13 @@ const i18n = new VueI18n({
window.app = new Vue({
computed: {
zoom() {
const params = new URLSearchParams(window.location.search)
return params.has('zoom') ? parseInt(params.get('zoom')) : 13
}
},
created() {
// Use defaults with custom icon paths
this.icon = L.icon({
@ -99,7 +106,7 @@ window.app = new Vue({
methods: {
initMap() {
this.map = L.map('map')
.setView([0, 0], 13)
.setView([0, 0], this.zoom)
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',