change how wind labels work, just one of the extended labels to toggle
This commit is contained in:
@@ -90,7 +90,7 @@ function format_altitude_long(alt, vr, displayUnits) {
|
||||
return "on ground";
|
||||
}
|
||||
|
||||
alt_text = Math.round(convert_altitude(alt, displayUnits)).toLocaleString() + NBSP + get_unit_label("altitude", displayUnits);
|
||||
alt_text = Math.round(convert_altitude(alt, displayUnits)).toString() + NBSP + get_unit_label("altitude", displayUnits);
|
||||
|
||||
if (vr > 192) {
|
||||
return UP_TRIANGLE + NBSP + alt_text;
|
||||
@@ -101,6 +101,22 @@ function format_altitude_long(alt, vr, displayUnits) {
|
||||
}
|
||||
}
|
||||
|
||||
// alt in feet
|
||||
function format_altitude(alt, displayUnits) {
|
||||
let alt_text = "";
|
||||
|
||||
if (alt == null) {
|
||||
return "n/a";
|
||||
} else if (alt === "ground") {
|
||||
return "on ground";
|
||||
}
|
||||
|
||||
alt_text = Math.round(convert_altitude(alt, displayUnits)).toString() + NBSP + get_unit_label("altitude", displayUnits);
|
||||
|
||||
return alt_text;
|
||||
}
|
||||
|
||||
|
||||
// alt ground/airborne
|
||||
function format_onground (alt) {
|
||||
if (alt == null) {
|
||||
|
||||
@@ -819,29 +819,40 @@ PlaneObject.prototype.updateIcon = function() {
|
||||
callsign = NBSP + 'hex: ' + this.icao + NBSP;
|
||||
const unknown = NBSP+NBSP+"?"+NBSP+NBSP;
|
||||
|
||||
let altString = (this.altitude == null) ? unknown : format_altitude_long(this.altitude, this.vert_rate, DisplayUnits);
|
||||
let speedString = (this.speed == null) ? (NBSP+'?'+NBSP) : format_speed_long(this.speed, DisplayUnits).padStart(4, NBSP);
|
||||
|
||||
labelText = "";
|
||||
if (extendedLabels == 2) {
|
||||
if (windLabels) {
|
||||
if (this.wd != null) {
|
||||
labelText += NBSP + this.wd + '°' + NBSP + format_speed_long(this.ws, DisplayUnits) + '\n';
|
||||
}
|
||||
if (extendedLabels == 3) {
|
||||
if (!windLabelsSlim) {
|
||||
labelText += 'Wind' + NBSP;
|
||||
}
|
||||
if (this.wd != null) {
|
||||
labelText += format_track_arrow((this.wd + 180 % 360)) + NBSP + this.wd + '°' + NBSP + format_speed_long(this.ws, DisplayUnits);
|
||||
} else {
|
||||
labelText += (this.registration ? this.registration : unknown) + NBSP + (this.icaoType ? this.icaoType : unknown) + '\n';
|
||||
labelText += 'n/a';
|
||||
}
|
||||
}
|
||||
if (extendedLabels >= 1 ) {
|
||||
const altitude = (this.altitude == null) ? unknown : format_altitude_brief(this.altitude, this.vert_rate, DisplayUnits);
|
||||
if ((!this.onGround || (this.speed && this.speed > 18) || (this.selected && !SelectedAllPlanes))) {
|
||||
let speedString = (this.speed == null) ? (NBSP+'?'+NBSP) : format_speed_long(this.speed, DisplayUnits).padStart(4, NBSP);
|
||||
labelText += speedString + NBSP + NBSP + altitude.padStart(6, NBSP);
|
||||
if (windLabelsSlim) {
|
||||
labelText += '\n' + format_altitude(this.altitude, DisplayUnits);
|
||||
} else {
|
||||
if ((!this.onGround || (this.speed && this.speed > 18) || (this.selected && !SelectedAllPlanes))) {
|
||||
labelText += '\n' + speedString + NBSP + NBSP + altString.padStart(6, NBSP);
|
||||
}
|
||||
labelText += '\n' + callsign;
|
||||
}
|
||||
}
|
||||
if (windLabels && extendedLabels == 2) {
|
||||
if (this.wd == null) {
|
||||
|
||||
if (windLabelsSlim && this.wd == null) {
|
||||
labelText = '';
|
||||
}
|
||||
} else {
|
||||
if (labelText) labelText += '\n';
|
||||
} else if (extendedLabels == 2) {
|
||||
labelText += (this.registration ? this.registration : unknown) + NBSP + (this.icaoType ? this.icaoType : unknown) + '\n';
|
||||
}
|
||||
if (extendedLabels == 1 || extendedLabels == 2) {
|
||||
if ((!this.onGround || (this.speed && this.speed > 18) || (this.selected && !SelectedAllPlanes))) {
|
||||
labelText += speedString + NBSP + NBSP + altString.padStart(6, NBSP) + '\n';
|
||||
}
|
||||
}
|
||||
if (extendedLabels < 3) {
|
||||
labelText += callsign;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,8 +49,8 @@ let grouptype_checkbox;
|
||||
let multiSelect = false;
|
||||
let uat_data = null;
|
||||
let enableLabels = false;
|
||||
let windLabels = false;
|
||||
let extendedLabels = 0;
|
||||
let windLabelsSlim = false;
|
||||
let mapIsVisible = true;
|
||||
let tableInView = false;
|
||||
let onlyMilitary = false;
|
||||
@@ -766,11 +766,11 @@ function initPage() {
|
||||
toggleLabels();
|
||||
}
|
||||
if (usp.has('extendedLabels')) {
|
||||
extendedLabels = parseInt(usp.getFloat('extendedLabels')) + 2;
|
||||
toggleExtendedLabels();
|
||||
extendedLabels = parseInt(usp.getFloat('extendedLabels'));
|
||||
toggleExtendedLabels({ noIncrement: true });
|
||||
} else if (loStore['extendedLabels']) {
|
||||
extendedLabels = parseInt(loStore['extendedLabels']) + 2;
|
||||
toggleExtendedLabels();
|
||||
extendedLabels = parseInt(loStore['extendedLabels']);
|
||||
toggleExtendedLabels({ noIncrement: true });
|
||||
}
|
||||
if (loStore['trackLabels'] == "true" || usp.has('trackLabels')) {
|
||||
toggleTrackLabels();
|
||||
@@ -2183,12 +2183,12 @@ function initMap() {
|
||||
});
|
||||
|
||||
new Toggle({
|
||||
key: "windLabels",
|
||||
display: "Wind Labels (via O toggle)",
|
||||
key: "windLabelsSlim",
|
||||
display: "Smaller wind labels",
|
||||
container: "#settingsLeft",
|
||||
init: windLabels,
|
||||
init: windLabelsSlim,
|
||||
setState: function(state) {
|
||||
windLabels = state;
|
||||
windLabelsSlim = state;
|
||||
if (!loadFinished)
|
||||
return;
|
||||
for (let key in PlanesOrdered) {
|
||||
@@ -2197,6 +2197,7 @@ function initMap() {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
window.addEventListener('keydown', function(e) {
|
||||
active();
|
||||
if (e.defaultPrevented ) {
|
||||
@@ -2226,9 +2227,6 @@ function initMap() {
|
||||
case "e":
|
||||
zoomIn();
|
||||
break;
|
||||
case "W":
|
||||
toggles['windLabels'].toggle();
|
||||
break;
|
||||
case "w":
|
||||
oldCenter = OLMap.getView().getCenter();
|
||||
extent = OLMap.getView().calculateExtent(OLMap.getSize());
|
||||
@@ -2279,7 +2277,7 @@ function initMap() {
|
||||
case "t":
|
||||
selectAllPlanes();
|
||||
break;
|
||||
case "g":
|
||||
case "G":
|
||||
nogpsOnly = !nogpsOnly;
|
||||
refreshFilter();
|
||||
break;
|
||||
@@ -4217,12 +4215,15 @@ function toggleLabels() {
|
||||
remakeTrails();
|
||||
}
|
||||
|
||||
function toggleExtendedLabels() {
|
||||
function toggleExtendedLabels(options) {
|
||||
if (isNaN(extendedLabels))
|
||||
extendedLabels = 0;
|
||||
|
||||
extendedLabels++;
|
||||
extendedLabels %= 3;
|
||||
options = options || {};
|
||||
if (!options.noIncrement) {
|
||||
extendedLabels++;
|
||||
}
|
||||
extendedLabels %= 4;
|
||||
//console.log(extendedLabels);
|
||||
loStore['extendedLabels'] = extendedLabels;
|
||||
for (let key in PlanesOrdered) {
|
||||
|
||||
Reference in New Issue
Block a user