aboutsummaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2024-10-05 15:35:42 +0100
committerdiogo464 <[email protected]>2024-10-05 15:35:42 +0100
commitb813dda8225ccca4a000c390683a1136aaabed17 (patch)
tree416198f1bb3291c350ebea0d27248e7651b4d406 /content
parentd59cbc1f77fd05fdbb686dc3f2ed243060cf2b56 (diff)
fixed marker heading line direction
Diffstat (limited to 'content')
-rw-r--r--content/static/main.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/content/static/main.js b/content/static/main.js
index bd91690..216cbea 100644
--- a/content/static/main.js
+++ b/content/static/main.js
@@ -132,12 +132,14 @@ function lib_add_location_logs_to_map(map, locations) {
132 for (const location of locations) { 132 for (const location of locations) {
133 const len = 0.0002; 133 const len = 0.0002;
134 const lat = Math.sin((location.heading + 90) * 2 * Math.PI / 360) * len; 134 const lat = Math.sin((location.heading + 90) * 2 * Math.PI / 360) * len;
135 const lon = Math.cos((location.heading + 90) * 2 * Math.PI / 360) * len; 135 const lon = Math.cos((location.heading - 90) * 2 * Math.PI / 360) * len;
136 const line_coords = [ 136 const line_coords = [
137 [location.latitude, location.longitude], 137 [location.latitude, location.longitude],
138 [location.latitude + lat, location.longitude + lon], 138 [location.latitude + lat, location.longitude + lon],
139 ]; 139 ];
140 L.circle([location.latitude, location.longitude], { radius: location.accuracy }).addTo(map); 140 L.circle([location.latitude, location.longitude], { radius: location.accuracy })
141 .bindPopup(`${location.heading}`)
142 .addTo(map);
141 L.polyline(line_coords, { color: 'blue' }).addTo(map) 143 L.polyline(line_coords, { color: 'blue' }).addTo(map)
142 } 144 }
143} 145}