Skip to content

Commit

Permalink
Fix web page for angle > 180
Browse files Browse the repository at this point in the history
  • Loading branch information
elmot committed Jun 22, 2024
1 parent 2e5f1e8 commit 34c8f86
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main/root.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@
function drawAwa(angle) {
const arrowStyle = document.getElementById("windArrow").style
if (typeof angle === 'number') {
document.getElementById("awa").innerText = Math.abs(angle).toString()
angle = (3600 + angle) % 360 // to be in [0...359] in any case
const textAngle = (angle > 180 ? (360 - angle) : angle).toString()
document.getElementById("awa").innerText = textAngle
arrowStyle.rotate = angle + "deg"
arrowStyle.visibility = "visible"
} else {
Expand Down

0 comments on commit 34c8f86

Please sign in to comment.