diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2011-10-01 20:49:36 +0000 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-09-27 13:27:51 +0000 |
commit | 921ced43c48c1d170452a7b251b94cc96ec8dd44 (patch) | |
tree | 3c4a89176ea67fe4c7bf7b375488361a823c95fa /mercurial/templates/static/mercurial.js | |
parent | 9039c805b0a7e36220101323f82735f08a104b37 (diff) | |
download | mercurial-tarball-master.tar.gz |
Imported from /srv/lorry/lorry-area/mercurial-tarball/mercurial-1.9.3.tar.gz.HEADmercurial-1.9.3master
Diffstat (limited to 'mercurial/templates/static/mercurial.js')
-rw-r--r-- | mercurial/templates/static/mercurial.js | 57 |
1 files changed, 15 insertions, 42 deletions
diff --git a/mercurial/templates/static/mercurial.js b/mercurial/templates/static/mercurial.js index 70347d7..3bc27a4 100644 --- a/mercurial/templates/static/mercurial.js +++ b/mercurial/templates/static/mercurial.js @@ -58,44 +58,25 @@ function Graph() { // Set the colour. // - // If color is a string, expect an hexadecimal RGB - // value and apply it unchanged. If color is a number, - // pick a distinct colour based on an internal wheel; - // the bg parameter provides the value that should be - // assigned to the 'zero' colours and the fg parameter - // provides the multiplier that should be applied to - // the foreground colours. - var s; - if(typeof color == "string") { - s = "#" + color; - } else { //typeof color == "number" - color %= colors.length; - var red = (colors[color][0] * fg) || bg; - var green = (colors[color][1] * fg) || bg; - var blue = (colors[color][2] * fg) || bg; - red = Math.round(red * 255); - green = Math.round(green * 255); - blue = Math.round(blue * 255); - s = 'rgb(' + red + ', ' + green + ', ' + blue + ')'; - } + // Picks a distinct colour based on an internal wheel; the bg + // parameter provides the value that should be assigned to the 'zero' + // colours and the fg parameter provides the multiplier that should be + // applied to the foreground colours. + + color %= colors.length; + var red = (colors[color][0] * fg) || bg; + var green = (colors[color][1] * fg) || bg; + var blue = (colors[color][2] * fg) || bg; + red = Math.round(red * 255); + green = Math.round(green * 255); + blue = Math.round(blue * 255); + var s = 'rgb(' + red + ', ' + green + ', ' + blue + ')'; this.ctx.strokeStyle = s; this.ctx.fillStyle = s; return s; } - this.edge = function(x0, y0, x1, y1, color, width) { - - this.setColor(color, 0.0, 0.65); - if(width >= 0) - this.ctx.lineWidth = width; - this.ctx.beginPath(); - this.ctx.moveTo(x0, y0); - this.ctx.lineTo(x1, y1); - this.ctx.stroke(); - - } - this.render = function(data) { var backgrounds = ''; @@ -112,20 +93,13 @@ function Graph() { var edges = cur[2]; var fold = false; - var prevWidth = this.ctx.lineWidth; for (var j in edges) { line = edges[j]; start = line[0]; end = line[1]; color = line[2]; - var width = line[3]; - if(width < 0) - width = prevWidth; - var branchcolor = line[4]; - if(branchcolor) - color = branchcolor; - + if (end > this.columns || start > this.columns) { this.columns += 1; } @@ -139,10 +113,9 @@ function Graph() { x1 = this.cell[0] + this.box_size * end + this.box_size / 2; y1 = this.bg[1] + this.bg_height / 2; - this.edge(x0, y0, x1, y1, color, width); + this.edge(x0, y0, x1, y1, color); } - this.ctx.lineWidth = prevWidth; // Draw the revision node in the right column |