mirror of
https://github.com/meshcore-dev/map.meshcore.dev.git
synced 2026-04-20 22:13:50 +00:00
sync
This commit is contained in:
commit
3a6cc00b78
1 changed files with 14 additions and 1 deletions
15
src/map.js
15
src/map.js
|
|
@ -1,5 +1,7 @@
|
||||||
import { createApp, reactive, ref, computed, watch, onMounted, toRaw } from '../lib/vue.esm-browser.js';
|
import { createApp, reactive, ref, computed, watch, onMounted, toRaw } from '../lib/vue.esm-browser.js';
|
||||||
import * as ntools from './node-utils.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';
|
const apiUrl = 'https://map.meshcore.dev/api/v1/nodes';
|
||||||
|
|
||||||
let presets = [];
|
let presets = [];
|
||||||
|
|
@ -241,13 +243,18 @@ const baseMaps = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let params = { lat: 7, lon: 25, zoom: 3 };
|
||||||
let params = { lat: 7, lon: 25, zoom: 3 };
|
let params = { lat: 7, lon: 25, zoom: 3 };
|
||||||
|
|
||||||
const urlParams = Object.fromEntries(new URLSearchParams(location.search));
|
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)) {
|
if(Number(urlParams.lat) && Number(urlParams.lon) && Number(urlParams.zoom)) {
|
||||||
params = urlParams
|
params = urlParams
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// console.log(params);
|
||||||
|
|
||||||
const map = window.leafletMap = leaflet.map('map', {
|
const map = window.leafletMap = leaflet.map('map', {
|
||||||
minZoom: 2,
|
minZoom: 2,
|
||||||
maxBounds: [
|
maxBounds: [
|
||||||
|
|
@ -278,6 +285,9 @@ const icons = Object.fromEntries(['none', 'recent', 'stale', 'old', 'extinct'].m
|
||||||
createApp({
|
createApp({
|
||||||
setup() {
|
setup() {
|
||||||
const app = window.app = reactive({
|
const app = window.app = reactive({
|
||||||
|
nodes: [],
|
||||||
|
nodesByType: {},
|
||||||
|
filteredNodes: [],
|
||||||
nodes: [],
|
nodes: [],
|
||||||
nodesByType: {},
|
nodesByType: {},
|
||||||
filteredNodes: [],
|
filteredNodes: [],
|
||||||
|
|
@ -465,6 +475,9 @@ createApp({
|
||||||
app.urlParams.zoom = zoom;
|
app.urlParams.zoom = zoom;
|
||||||
app.urlParams.lat = pos.lat.toFixed(4);
|
app.urlParams.lat = pos.lat.toFixed(4);
|
||||||
app.urlParams.lon = pos.lng.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(() => {
|
onMounted(() => {
|
||||||
|
|
@ -492,4 +505,4 @@ createApp({
|
||||||
clearFilters
|
clearFilters
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}).mount('#app')
|
}).mount('#app')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue