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