diff --git a/htdocs/lib/AprsMarker.js b/htdocs/lib/AprsMarker.js index 339ea6b2..381c4ea9 100644 --- a/htdocs/lib/AprsMarker.js +++ b/htdocs/lib/AprsMarker.js @@ -2,6 +2,18 @@ function AprsMarker() {} AprsMarker.prototype = new google.maps.OverlayView(); +AprsMarker.prototype.isFacingEast = function(symbol) { + var candidates = '' + if (symbol.table === '/') { + // primary table + candidates = '(*<=>CFPUXYabefghjkpsuv['; + } else { + // alternate table + candidates = 'hkluv'; + } + return candidates.includes(symbol.symbol); +}; + AprsMarker.prototype.draw = function() { var div = this.div; var overlay = this.overlay; @@ -16,9 +28,15 @@ AprsMarker.prototype.draw = function() { } if (this.course) { - if (this.course > 180) { + if (this.symbol && !this.isFacingEast(this.symbol)) { + // assume symbol points to the north + div.style.transform = 'rotate(' + this.course + ' deg)'; + } else if (this.course > 180) { + // symbol is pointing east + // don't rotate more than 180 degrees, rather mirror div.style.transform = 'scalex(-1) rotate(' + (270 - this.course) + 'deg)' } else { + // symbol is pointing east div.style.transform = 'rotate(' + (this.course - 90) + 'deg)'; } } else {