# HG changeset patch # User Marcin Kuzminski # Date 2011-07-16 12:33:40 # Node ID 864e4daef963e744a8ad2b1f7c6cbc5887982555 # Parent e5467730682bced84970576f21b47b83aec1c9a6 improved rendering of dag (they are not trimmed anymore when number of heads exceeds 5) diff --git a/rhodecode/public/css/style.css b/rhodecode/public/css/style.css --- a/rhodecode/public/css/style.css +++ b/rhodecode/public/css/style.css @@ -1736,15 +1736,14 @@ overflow:hidden; } #graph_nodes { -width:160px; float:left; -margin-left:-50px; margin-top:5px; } #graph_content { width:800px; float:left; + } #graph_content .container_header { 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 @@ -58,10 +58,10 @@ function BranchRenderer() { this.ctx.fillStyle = s; } - this.render = function(data) { + this.render = function(data,pad) { var idx = 1; var rela = document.getElementById('graph'); - var pad = 160; + var pad = pad; var scale = 22; for (var i in data) { diff --git a/rhodecode/templates/changelog/changelog.html b/rhodecode/templates/changelog/changelog.html --- a/rhodecode/templates/changelog/changelog.html +++ b/rhodecode/templates/changelog/changelog.html @@ -139,21 +139,31 @@ ${c.repo_name} ${_('Changelog')} - ${c.r } }); - function set_canvas() { + function set_canvas(heads) { var c = document.getElementById('graph_nodes'); var t = document.getElementById('graph_content'); canvas = document.getElementById('graph_canvas'); var div_h = t.clientHeight; c.style.height=div_h+'px'; canvas.setAttribute('height',div_h); - canvas.setAttribute('width',160); + c.style.height=max_w+'px'; + canvas.setAttribute('width',max_w); }; - set_canvas(); + var heads = 1; + var max_heads = 0; var jsdata = ${c.jsdata|n}; + + for( var i=0;imax_heads){ + max_heads = m; + } + } + var max_w = Math.max(100,max_heads*25); + set_canvas(max_w); + var r = new BranchRenderer(); - r.render(jsdata); - - + r.render(jsdata,max_w); });