mirror of
https://github.com/brianshea2/meshmap.net.git
synced 2025-03-05 21:00:01 -08:00
Compare commits
No commits in common. "a782f282315a371e3b829a385f5ee5c3747ec42a" and "b5ab26a8c271aef01450ae4a27151cf3c0565c1c" have entirely different histories.
a782f28231
...
b5ab26a8c2
|
@ -65,7 +65,7 @@
|
|||
.dark .leaflet-shadow-pane {
|
||||
display: none;
|
||||
}
|
||||
.dark :is(.leaflet-tooltip, .leaflet-popup-content-wrapper, .leaflet-popup-tip) {
|
||||
.dark .leaflet-popup-content-wrapper {
|
||||
box-shadow: none;
|
||||
}
|
||||
.leaflet-top {
|
||||
|
@ -103,7 +103,7 @@
|
|||
const zoomLevelNode = 10
|
||||
const markersByNode = {}
|
||||
const neighborsByNode = {}
|
||||
const nodesBySearchString = {}
|
||||
const nodesBySearchTitle = {}
|
||||
const precisionMargins = [
|
||||
11939464, 5969732, 2984866, 1492433, 746217, 373108, 186554, 93277,
|
||||
46639, 23319, 11660, 5830, 2915, 1457, 729, 364,
|
||||
|
@ -154,11 +154,10 @@
|
|||
// add search control
|
||||
map.addControl(new L.Control.Search({
|
||||
layer: markers,
|
||||
propertyName: 'searchString',
|
||||
initial: false,
|
||||
position: 'topleft',
|
||||
marker: false,
|
||||
moveToLocation: (_, s) => showNode(nodesBySearchString[s]),
|
||||
moveToLocation: (_, title) => showNode(nodesBySearchTitle[title]),
|
||||
}))
|
||||
// add geolocation control
|
||||
L.easyButton({
|
||||
|
@ -234,7 +233,6 @@
|
|||
})
|
||||
}
|
||||
const position = L.latLng([latitude, longitude].map(x => x / 10000000))
|
||||
const tooltipContent = `${html(longName)} (${html(shortName)}) ${since(Math.max(...Object.values(seenBy)))}`
|
||||
const popupContent = `
|
||||
<div class="title">${html(longName)} (${html(shortName)})</div>
|
||||
<div>${nodeLink(nodeNum, id)} | ${html(role)} | ${html(hwModel)}</div>
|
||||
|
@ -285,7 +283,7 @@
|
|||
return
|
||||
}
|
||||
const neighborId = `!${Number(neighborNum).toString(16)}`
|
||||
const neighborContent = `
|
||||
const tooltipContent = `
|
||||
<table><tbody>
|
||||
<tr><th>Neighbor</th><td>${html(id)} <-> ${html(neighborId)}</td></tr>
|
||||
<tr><th>Distance</th><td>${Math.round(map.distance(position, markersByNode[neighborNum].getLatLng())).toLocaleString()} m</td></tr>
|
||||
|
@ -294,16 +292,15 @@
|
|||
</tbody></table>
|
||||
`
|
||||
L.polyline([position, markersByNode[neighborNum].getLatLng()], {weight: 4})
|
||||
.bindTooltip(neighborContent, {sticky: true, opacity: 1.0})
|
||||
.bindTooltip(tooltipContent, {sticky: true, opacity: 1.0})
|
||||
.on('click', () => showNode(neighborNum))
|
||||
.addTo(detailsLayer)
|
||||
})
|
||||
}
|
||||
if (markersByNode[nodeNum] === undefined) {
|
||||
const searchString = `${longName} (${shortName}) ${id}`
|
||||
nodesBySearchString[searchString] = nodeNum
|
||||
markersByNode[nodeNum] = L.marker(position, {alt: 'Node', searchString})
|
||||
.bindTooltip(tooltipContent)
|
||||
const title = `${longName} (${shortName}) ${id}`
|
||||
nodesBySearchTitle[title] = nodeNum
|
||||
markersByNode[nodeNum] = L.marker(position, {alt: 'Node', title})
|
||||
.bindPopup(popupContent, {maxWidth: 500})
|
||||
.on('popupopen', () => {
|
||||
history.replaceState(null, '', `#${nodeNum}`)
|
||||
|
@ -311,7 +308,6 @@
|
|||
})
|
||||
.addTo(markers)
|
||||
} else {
|
||||
markersByNode[nodeNum].setTooltipContent(tooltipContent)
|
||||
markersByNode[nodeNum].setPopupContent(popupContent)
|
||||
markersByNode[nodeNum].setLatLng(position)
|
||||
if (markersByNode[nodeNum].isPopupOpen()) {
|
||||
|
|
Loading…
Reference in a new issue