changeset 5117:1cc64983363a stable

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.
author Mads Kiilerich <madski@unity3d.com>
date Wed, 13 May 2015 01:16:48 +0200
parents a9d2e2958514
children beeb69476cc4
files kallithea/public/js/graph.js
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/public/js/graph.js	Thu May 07 16:23:45 2015 +0200
+++ b/kallithea/public/js/graph.js	Wed May 13 01:16:48 2015 +0200
@@ -89,7 +89,7 @@
 		}
 
 		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 @@
 				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 @@
 				}
 				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 @@
 			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)