diff --git a/src/map.js b/src/map.js index 0413227..50eeb33 100644 --- a/src/map.js +++ b/src/map.js @@ -1,5 +1,7 @@ import { createApp, reactive, ref, computed, watch, onMounted, toRaw } from '../lib/vue.esm-browser.js'; import * as ntools from './node-utils.js'; +import { createApp, reactive, ref, computed, watch, onMounted, toRaw } from '../lib/vue.esm-browser.js'; +import * as ntools from './node-utils.js'; const apiUrl = 'https://map.meshcore.dev/api/v1/nodes'; let presets = []; @@ -241,13 +243,18 @@ const baseMaps = { }), }; +let params = { lat: 7, lon: 25, zoom: 3 }; let params = { lat: 7, lon: 25, zoom: 3 }; const urlParams = Object.fromEntries(new URLSearchParams(location.search)); +if(Number(urlParams.lat) && Number(urlParams.lon) && Number(urlParams.zoom)) { + params = urlParams if(Number(urlParams.lat) && Number(urlParams.lon) && Number(urlParams.zoom)) { params = urlParams } +// console.log(params); + const map = window.leafletMap = leaflet.map('map', { minZoom: 2, maxBounds: [ @@ -278,6 +285,9 @@ const icons = Object.fromEntries(['none', 'recent', 'stale', 'old', 'extinct'].m createApp({ setup() { const app = window.app = reactive({ + nodes: [], + nodesByType: {}, + filteredNodes: [], nodes: [], nodesByType: {}, filteredNodes: [], @@ -465,6 +475,9 @@ createApp({ app.urlParams.zoom = zoom; app.urlParams.lat = pos.lat.toFixed(4); app.urlParams.lon = pos.lng.toFixed(4); + app.urlParams.zoom = zoom; + app.urlParams.lat = pos.lat.toFixed(4); + app.urlParams.lon = pos.lng.toFixed(4); }); onMounted(() => { @@ -492,4 +505,4 @@ createApp({ clearFilters } }, -}).mount('#app') \ No newline at end of file +}).mount('#app')