From 0c8301a53a32812c6a28a0a9722616a2a86aa413 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Wed, 9 Sep 2020 16:57:05 +0200 Subject: [PATCH] Allow to configure zoom through URL parameter Signed-off-by: Knut Ahlers --- frontend/app.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/app.js b/frontend/app.js index d221fa4..652cc5c 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -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: '© OpenStreetMap contributors',