Skip to content

Commit

Permalink
Merge pull request #524 from Rdornier/index-time-offset
Browse files Browse the repository at this point in the history
Enable time index offset
  • Loading branch information
will-moore authored Dec 8, 2023
2 parents f489a75 + a951bad commit 797a756
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/js/models/panel_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,10 @@
deltaT = this.get('deltaT')[theT] || 0,
text = "", h, m, s;

var shiftIdx;
if (ref_idx) {
var shift = this.get('deltaT')[parseInt(ref_idx) - 1];
shiftIdx = parseInt(ref_idx)
var shift = this.get('deltaT')[shiftIdx - 1];
deltaT = shift==null ? deltaT : deltaT - shift;
}
var isNegative = (deltaT < 0);
Expand All @@ -318,7 +320,9 @@
var padlen = dec_prec>0 ? dec_prec+3 : 2;
if (format === "index") {
isNegative = false;
text = "" + (theT + 1);
if(!isNaN(shiftIdx) && !(this.get('deltaT')[shiftIdx - 1] == null))
text = "" + (theT - shiftIdx + 1);
else text = "" + (theT + 1);
} else if (['milliseconds', 'ms'].includes(format)) {
text = (deltaT*1000).toFixed(dec_prec) + " ms";
} else if (['seconds', 'secs', 's'].includes(format)) {
Expand Down

0 comments on commit 797a756

Please sign in to comment.