diff options
author | Kristian Lyngstol <kristian@bohemians.org> | 2016-05-28 16:42:32 +0200 |
---|---|---|
committer | Kristian Lyngstol <kristian@bohemians.org> | 2016-05-28 16:42:32 +0200 |
commit | e5323ecaf854924cdc6226a5db716d35ae347e9b (patch) | |
tree | 91962661cd90886a8ffd7cd8b1debf50c8e77042 /web/js/nms-map.js | |
parent | 6fbb4fcf563a4cbdd11932e415bd50d7d6279e3b (diff) |
Fix numerous time-travel issues in front and API
Fixes #69 #11 #5
Introduces nmsTime which unifies the time travel code a bit. It still needs
some work, but this is much better.
All conversion is now done by native JavaScript methods, freeing us from
the hell that is parsing it ourself.
One thing should be added: The backend should discard any now=values that
are not 5-minute intervals. We don't want to kill the cache and the
database by extension.
Still need to re-implement the "replay event" shorthand, but that ties in
to #54
Diffstat (limited to 'web/js/nms-map.js')
-rw-r--r-- | web/js/nms-map.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/web/js/nms-map.js b/web/js/nms-map.js index ef86102..26782f8 100644 --- a/web/js/nms-map.js +++ b/web/js/nms-map.js @@ -180,6 +180,19 @@ nmsMap._resizeEvent = function() { nmsMap.drawNow = function () { var now = nmsData.now; + var ctx = nmsMap._c.top.ctx; + if (nmsTime.isRealTime()) { + if (!nmsMap._nowCleared) { + ctx.save(); + ctx.scale(this.scale, this.scale); + ctx.clearRect(0,0,800,100); + ctx.restore(); + nmsMap._nowCleared = true; + nmsMap._lastNow = undefined; + } + return true; + } + nmsMap._nowCleared = false; if(String(now).indexOf('T') == -1) { //If now does not contain 'T' we assume its in epoch format now = new Date(nmsData.now * 1000); } else { @@ -192,7 +205,6 @@ nmsMap.drawNow = function () } nmsMap.stats.nows++; - var ctx = nmsMap._c.top.ctx; ctx.save(); ctx.scale(this.scale, this.scale); ctx.font = (2 * this._settings.fontSize) + "px " + this._settings.fontFace; |