mirror of
https://github.com/jketterl/openwebrx.git
synced 2026-01-06 08:40:30 +01:00
differentiate aprs symbol rotation
* rotate based on symbol graphics alignment * inspired by @luarvique * references #352
This commit is contained in:
parent
feb309054a
commit
03306baad1
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue