Changeset - 493f5f62be18
[Not reviewed]
default
0 1 0
Aras Pranckevicius - 12 years ago 2013-12-23 10:27:35
aras@unity3d.com
graph: fade out lines of dead-end branches
1 file changed with 24 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/public/js/graph.js
Show inline comments
 
@@ -75,7 +75,7 @@ function BranchRenderer(canvas_id, conte
 
		var box_size = Math.min(18, Math.floor((canvasWidth - edge_pad*2)/(lineCount)));
 
		var base_x = canvasWidth - edge_pad;
 

	
 
		for (var i in data) {
 
		for (var i=0; i < data.length; ++i) {
 

	
 
			var row = document.getElementById("chg_"+idx);
 
			if (row == null)
 
@@ -91,7 +91,6 @@ function BranchRenderer(canvas_id, conte
 
			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];
 
				start = line[0];
 
				end = line[1];
 
@@ -99,10 +98,32 @@ function BranchRenderer(canvas_id, conte
 
				
 
				x = base_x - box_size * start;
 

	
 
				// figure out if this is a dead-end;
 
				// we want to fade away this line
 
				var dead_end = true;
 
				if (next != null) {
 
					nextdata = data[i+1];
 
					next_l = nextdata[1];
 
					found = false;
 
					for (var k=0; k < next_l.length; ++k) {
 
						if (next_l[k][0] == end) {
 
							dead_end = false;
 
							break;
 
						}
 
					}
 
				}
 

	
 
				if (dead_end) {
 
					var gradient = this.ctx.createLinearGradient(x,rowY,x,nextY);
 
					gradient.addColorStop(0,this.calcColor(color, 0.0, 0.65));
 
					gradient.addColorStop(1,this.calcColor(color, 1.0, 0.0));
 
					this.ctx.strokeStyle = gradient;
 
					this.ctx.fillStyle = gradient;
 
				}
 
				// if this is a merge of differently
 
				// colored line, make it a gradient towards
 
				// the merged color
 
				if (color != node[1] && start == node[0])
 
				else if (color != node[1] && start == node[0])
 
				{
 
					var gradient = this.ctx.createLinearGradient(x,rowY,x,nextY);
 
					gradient.addColorStop(0,this.calcColor(node[1], 0.0, 0.65));
0 comments (0 inline, 0 general)