diff --git a/rhodecode/public/js/graph.js b/rhodecode/public/js/graph.js --- a/rhodecode/public/js/graph.js +++ b/rhodecode/public/js/graph.js @@ -63,18 +63,16 @@ function BranchRenderer() { var rela = document.getElementById('graph'); var pad = pad; var scale = 22; - + for (var i in data) { this.scale(scale); + var row = document.getElementById("chg_"+idx); - var next = document.getElementById("chg_"+idx+1); + if (row == null) + continue; + var next = document.getElementById("chg_"+(idx+1)); var extra = 0; - //skip this since i don't have DATE in my app - //if (next.is('.changesets-date')) { - // extra = next.outerHeight(); - //} - this.cell[1] += row.clientWidth; this.bg[1] += this.bg_height; @@ -82,7 +80,10 @@ function BranchRenderer() { nodeid = cur[0]; node = cur[1]; in_l = cur[2]; - + + var rowY = row.offsetTop + row.offsetHeight/2 - rela.offsetTop; + var nextY = (next == null) ? rowY + row.offsetHeight/2 : next.offsetTop + next.offsetHeight/2 - rela.offsetTop; + for (var j in in_l) { line = in_l[j]; @@ -99,17 +100,26 @@ function BranchRenderer() { } this.setColor(color, 0.0, 0.65); + - y = row.offsetTop-rela.offsetTop+4; x = pad-((this.cell[0] + this.box_size * start - 1) + this.bg_height-2); this.ctx.lineWidth=this.line_width; this.ctx.beginPath(); - this.ctx.moveTo(x, y); + this.ctx.moveTo(x, rowY); - y += row.offsetHeight; - x = pad-((1 + this.box_size * end) + this.bg_height-2); - this.ctx.lineTo(x,y+extra,3); + + if (start == end) + { + x = pad-((1 + this.box_size * end) + this.bg_height-2); + this.ctx.lineTo(x,nextY+extra,3); + } + else + { + var x2 = pad-((1 + this.box_size * end) + this.bg_height-2); + var ymid = (rowY+nextY) / 2; + this.ctx.bezierCurveTo (x,ymid,x2,ymid,x2,nextY); + } this.ctx.stroke(); } @@ -117,12 +127,12 @@ function BranchRenderer() { color = node[1] radius = this.dot_radius; - y = row.offsetTop-rela.offsetTop+4; + x = pad-(Math.round(this.cell[0] * scale/2 * column + radius) + 15 - (column*4)); this.ctx.beginPath(); this.setColor(color, 0.25, 0.75); - this.ctx.arc(x, y, radius, 0, Math.PI * 2, true); + this.ctx.arc(x, rowY, radius, 0, Math.PI * 2, true); this.ctx.fill(); idx++;