Changeset - 1cc64983363a
[Not reviewed]
stable
0 1 0
Mads Kiilerich - 11 years ago 2015-05-13 01:16:48
madski@unity3d.com
graph: fix graph drawing if there is less than one pixel available per branch

The branch width would be rounded down and the graph would be 0 pixels wide and
thus even more unreadable than it should have been.
1 file changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/public/js/graph.js
Show inline comments
 
@@ -89,7 +89,7 @@ function BranchRenderer(canvas_id, conte
 
		}
 

	
 
		var edge_pad = this.dot_radius + 2;
 
		var box_size = Math.min(18, Math.floor((canvasWidth - edge_pad*2)/(lineCount)));
 
		var box_size = Math.min(18, (canvasWidth - edge_pad * 2) / lineCount);
 
		var base_x = canvasWidth - edge_pad;
 

	
 
		for (var i=0; i < data.length; ++i) {
 
@@ -115,7 +115,7 @@ function BranchRenderer(canvas_id, conte
 
				end = line[1];
 
				color = line[2];
 
				
 
				x = base_x - box_size * start;
 
				x = Math.floor(base_x - box_size * start);
 

	
 
				// figure out if this is a dead-end;
 
				// we want to fade away this line
 
@@ -165,7 +165,7 @@ function BranchRenderer(canvas_id, conte
 
				}
 
				else
 
				{
 
					var x2 = base_x - box_size * end;
 
					var x2 = Math.floor(base_x - box_size * end);
 
					var ymid = (rowY+nextY) / 2;
 
					this.ctx.bezierCurveTo (x,ymid,x2,ymid,x2,nextY);
 
				}
 
@@ -175,7 +175,7 @@ function BranchRenderer(canvas_id, conte
 
			column = node[0];
 
			color = node[1];
 
			
 
			x = base_x - box_size * column;
 
			x = Math.floor(base_x - box_size * column);
 
		
 
			this.setColor(color, 0.25, 0.75);
 
			if (closing)
0 comments (0 inline, 0 general)