diff --git a/html/index.html b/html/index.html
index 4ca6208..785b82c 100644
--- a/html/index.html
+++ b/html/index.html
@@ -146,11 +146,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/html/planeObject.js b/html/planeObject.js
index 4cac4a7..130c4a7 100644
--- a/html/planeObject.js
+++ b/html/planeObject.js
@@ -808,7 +808,7 @@ PlaneObject.prototype.updateIcon = function() {
return true;
};
-PlaneObject.prototype.processTrace = function(show) {
+PlaneObject.prototype.processTrace = function(legStart, legEnd) {
this.checkLayers();
var trace = null;
var timeZero, _now, _last = 0;
@@ -837,7 +837,6 @@ PlaneObject.prototype.processTrace = function(show) {
}
for (var j = 0; j < 2; j++) {
- var start = 0;
if (j == 0) {
if (!this.fullTrace || !this.fullTrace.trace)
continue;
@@ -857,6 +856,8 @@ PlaneObject.prototype.processTrace = function(show) {
}
trace = this.recentTrace.trace;
}
+ var start = 0;
+ var end = trace.length;
if (lastLeg && !showTrace) {
for (var i = trace.length - 1; i >= 0; i--) {
@@ -867,7 +868,12 @@ PlaneObject.prototype.processTrace = function(show) {
}
}
- for (var i = start; i < trace.length; i++) {
+ if (legStart != null)
+ start = legStart;
+ if (legEnd != null)
+ end = legEnd;
+
+ for (var i = start; i < end; i++) {
const state = trace[i];
const timestamp = timeZero + state[0];
const lat = state[1];
@@ -908,6 +914,8 @@ PlaneObject.prototype.processTrace = function(show) {
}
for (var i = 0; i < this.trace.length; i++) {
+ if (showTrace)
+ break;
const state = this.trace[i];
if (_now >= state.now)
continue;
@@ -933,20 +941,15 @@ PlaneObject.prototype.processTrace = function(show) {
tempPlane.prev_position = this.position;
}
- if (tempPlane.last_message_time > this.last_message_time) {
+ if (tempPlane.last_message_time > this.last_message_time && !showTrace) {
var newSegs = this.track_linesegs;
Object.assign(this, tempPlane);
this.track_linesegs = newSegs;
}
- if (show) {
- this.selected = true;
- this.visible = true;
- this.updated = true;
- }
if (showTrace) {
- if (this.track_linesegs.length > 0) {
+ if (this.track_linesegs.length > 0 && this.position) {
const proj = ol.proj.fromLonLat(this.position);
this.track_linesegs[this.track_linesegs.length - 1].fixed.appendCoordinate(proj);
this.track_linesegs.push({ fixed: new ol.geom.LineString([proj]),
diff --git a/html/script.js b/html/script.js
index 8de21c9..0690fc2 100644
--- a/html/script.js
+++ b/html/script.js
@@ -86,6 +86,7 @@ var airport = null;
var labelFill = null;
var blackFill = null;
var labelStroke = null;
+var legSel = -1;
var shareLink = '';
@@ -811,6 +812,9 @@ function init_page() {
$("#trace_back_1d").click(function() {shiftTrace(-1)});
$("#trace_jump_1d").click(function() {shiftTrace(1)});
+ $("#leg_prev").click(function() {legShift(-1)});
+ $("#leg_next").click(function() {legShift(1)});
+
$("#altitude_filter_reset_button").click(onResetAltitudeFilter);
$("#callsign_filter_reset_button").click(onResetCallsignFilter);
@@ -2865,7 +2869,7 @@ function toggleLastLeg() {
localStorage['lastLeg'] = "true";
$('#lastLeg_checkbox').addClass('settingsCheckboxChecked');
}
- if (SelectedPlane)
+ if (SelectedPlane && !showTrace)
SelectedPlane.processTrace();
}
@@ -3782,12 +3786,16 @@ function toggleLargeMode() {
function toggleShowTrace() {
if (!showTrace) {
showTrace = true;
+ legSel = -1;
+ $('#leg_sel').text('Legs: All');
toggleIsolation("on", null);
shiftTrace();
$('#history_collapse')[0].style.display = "block";
$('#show_trace').addClass("active");
} else {
showTrace = false;
+ legSel = -1;
+ $('#leg_sel').text('Legs: All');
toggleIsolation(null, "off");
//var string = pathName + '?icao=' + SelectedPlane.icao;
//window.history.replaceState("object or string", "Title", string);
@@ -3802,6 +3810,42 @@ function toggleShowTrace() {
}
}
+function legShift(offset) {
+ legSel += offset;
+ if (legSel <= -1) {
+ legSel = -1;
+ $('#leg_sel').text('Legs: All');
+ SelectedPlane.processTrace();
+ return;
+ }
+
+ var trace = SelectedPlane.fullTrace.trace;
+ var legStart = 0;
+ var legEnd = trace.length;
+ var count = 0;
+ for (var i = 1; i < trace.length; i++) {
+ if (trace[i][6] & 2) {
+ count++;
+ }
+ }
+ if (legSel > count)
+ legSel = count;
+
+ count = 0;
+ for (var i = 1; i < trace.length; i++) {
+ if (trace[i][6] & 2) {
+ if (count == legSel - 1)
+ legStart = i;
+ if (count == legSel)
+ legEnd = i; // exclusive
+ count++;
+ }
+ }
+ $('#leg_sel').text('Leg: ' + (legSel + 1));
+ SelectedPlane.processTrace(legStart, legEnd);
+
+}
+
function shiftTrace(offset) {
if (traceDateString && !traceDate) {
var numbers = traceDateString.split('-');
diff --git a/html/style.css b/html/style.css
index b9ef4f4..6e95a05 100644
--- a/html/style.css
+++ b/html/style.css
@@ -272,7 +272,7 @@ div#loader { z-index: 99; position: absolute; left: 0; top: 0; bottom: 0; right:
padding: calc( 4px * var(--SCALE)) calc( 15px * var(--SCALE)) calc( 4px * var(--SCALE)) calc( 15px * var(--SCALE));
color: #FFFFFF;
font-weight: normal;
- font-size: var(--FS1);
+ font-size: var(--FS2);
}
.sidebarButton:hover {
@@ -291,7 +291,7 @@ div#loader { z-index: 99; position: absolute; left: 0; top: 0; bottom: 0; right:
}
.formButton {
- font-size: var(--FS1);
+ font-size: var(--FS2);
}
select.error, textarea.error, input.error {