mirror of
https://github.com/pablorevilla-meshtastic/meshview.git
synced 2026-03-04 23:27:46 +01:00
Use my new found fitBounds powers on the node map.
This commit is contained in:
@@ -79,17 +79,20 @@
|
||||
<script>
|
||||
var trace = {{trace | tojson}};
|
||||
var map = L.map('map').setView(trace[0], 13);
|
||||
var markers = L.featureGroup();
|
||||
markers.addTo(map);
|
||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||
}).addTo(map);
|
||||
L.polyline(trace).addTo(map);
|
||||
L.marker(trace[0]).addTo(map);
|
||||
L.marker(trace[0]).addTo(markers);
|
||||
{% for n in neighbors %}
|
||||
var m = L.circleMarker({{n.location | tojson}});
|
||||
m.bindPopup('SNR: {{n.snr}}<br/><a href="/packet_list/{{n.node_id}}">[{{n.short_name}}] {{n.long_name}} {{n.node_id | node_id_to_hex}}</a>');
|
||||
m.addTo(map);
|
||||
m.addTo(markers);
|
||||
L.polyline([trace[0], {{n.location | tojson}}], {color: 'red'}).addTo(map);
|
||||
map.fitBounds(markers.getBounds().pad(.7));
|
||||
{% endfor %}
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user