diff options
Diffstat (limited to 'web/js/nms-map.js')
-rw-r--r-- | web/js/nms-map.js | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/web/js/nms-map.js b/web/js/nms-map.js index 224b3db..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; @@ -273,13 +285,13 @@ nmsMap._drawSwitch = function(sw) var color = nmsMap._color[sw]; if(this._highlightActive) { if(nmsMap._highlight[sw]) { - color = green; + color = nmsColor.green; } else { - color = white; + color = nmsColor.white; } } if (color == undefined) { - color = blue; + color = nmsColor.blue; } this._c.switch.ctx.fillStyle = color; this._drawBox(this._c.switch.ctx, box['x'],box['y'],box['width'],box['height']); @@ -311,7 +323,7 @@ nmsMap._drawText = function(ctx, text, box, align) { if ((box['width'] + 10 )< box['height']) rotate = true; - + this._clearBox(ctx,box); ctx.save(); ctx.scale(this.scale, this.scale); @@ -320,7 +332,7 @@ nmsMap._drawText = function(ctx, text, box, align) { ctx.fillStyle = "white"; ctx.strokeStyle = "black"; ctx.translate(box.x + this._settings.textMargin, box.y + box.height - this._settings.textMargin); - + if (rotate) { ctx.translate(box.width - this._settings.textMargin * 2,0); ctx.rotate(Math.PI * 3/2); @@ -361,8 +373,8 @@ nmsMap._setLinknetColor = function(l, color1, color2) nmsMap._drawLinknet = function(l) { try { - var color1 = blue; - var color2 = blue; + var color1 = nmsColor.blue; + var color2 = nmsColor.blue; try { color1 = nmsMap._linknets[l].sysname1; color2 = nmsMap._linknets[l].sysname2; @@ -408,7 +420,7 @@ nmsMap._drawBox = function(ctx, x, y, boxw, boxh) { }; nmsMap._connectSwitches = function(sw1, sw2, color1, color2) { - nmsMap._connectBoxes(this._getBox(sw1), this._getBox(sw2), + nmsMap._connectBoxes(nmsMap._getBox(sw1), nmsMap._getBox(sw2), color1, color2); }; @@ -419,9 +431,9 @@ nmsMap._connectSwitches = function(sw1, sw2, color1, color2) { nmsMap._connectBoxes = function(box1, box2,color1, color2) { var ctx = nmsMap._c.link.ctx; if (color1 == undefined) - color1 = blue; + color1 = nmsColor.blue; if (color2 == undefined) - color2 = blue; + color2 = nmsColor.blue; var x0 = Math.floor(box1.x + box1.width/2); var y0 = Math.floor(box1.y + box1.height/2); var x1 = Math.floor(box2.x + box2.width/2); |