@@ -1,15 +1,11 | |||||
1 | var revisionGraph = null; |
|
1 | var revisionGraph = null; | |
2 |
|
2 | |||
3 | function drawRevisionGraph(holder, commits_hash, graph_space) { |
|
3 | function drawRevisionGraph(holder, commits_hash, graph_space) { | |
4 |
|
||||
5 | var XSTEP = 20, |
|
4 | var XSTEP = 20, | |
6 | CIRCLE_INROW_OFFSET = 10; |
|
5 | CIRCLE_INROW_OFFSET = 10; | |
7 |
|
||||
8 | var commits_by_scmid = commits_hash, |
|
6 | var commits_by_scmid = commits_hash, | |
9 | commits = $.map(commits_by_scmid, function(val,i){return val;}); |
|
7 | commits = $.map(commits_by_scmid, function(val,i){return val;}); | |
10 |
|
||||
11 | var max_rdmid = commits.length - 1; |
|
8 | var max_rdmid = commits.length - 1; | |
12 |
|
||||
13 | var commit_table_rows = $('table.changesets tr.changeset'); |
|
9 | var commit_table_rows = $('table.changesets tr.changeset'); | |
14 |
|
10 | |||
15 | // create graph |
|
11 | // create graph | |
@@ -19,7 +15,6 function drawRevisionGraph(holder, commits_hash, graph_space) { | |||||
19 | revisionGraph = Raphael(holder); |
|
15 | revisionGraph = Raphael(holder); | |
20 |
|
16 | |||
21 | var top = revisionGraph.set(); |
|
17 | var top = revisionGraph.set(); | |
22 |
|
||||
23 | // init dimensions |
|
18 | // init dimensions | |
24 | var graph_x_offset = commit_table_rows.first().find('td').first().position().left - $(holder).position().left, |
|
19 | var graph_x_offset = commit_table_rows.first().find('td').first().position().left - $(holder).position().left, | |
25 | graph_y_offset = $(holder).position().top, |
|
20 | graph_y_offset = $(holder).position().top, | |
@@ -39,26 +34,20 function drawRevisionGraph(holder, commits_hash, graph_space) { | |||||
39 | var x, y, parent_x, parent_y; |
|
34 | var x, y, parent_x, parent_y; | |
40 | var path, title; |
|
35 | var path, title; | |
41 | var revision_dot_overlay; |
|
36 | var revision_dot_overlay; | |
42 |
|
||||
43 | $.each(commits, function(index, commit) { |
|
37 | $.each(commits, function(index, commit) { | |
44 |
|
||||
45 | y = commit_table_rows.eq(max_rdmid - commit.rdmid).position().top - graph_y_offset + CIRCLE_INROW_OFFSET; |
|
38 | y = commit_table_rows.eq(max_rdmid - commit.rdmid).position().top - graph_y_offset + CIRCLE_INROW_OFFSET; | |
46 | x = graph_x_offset + XSTEP / 2 + XSTEP * commit.space; |
|
39 | x = graph_x_offset + XSTEP / 2 + XSTEP * commit.space; | |
47 |
|
||||
48 | revisionGraph.circle(x, y, 3) |
|
40 | revisionGraph.circle(x, y, 3) | |
49 | .attr({ |
|
41 | .attr({ | |
50 | fill: colors[commit.space], |
|
42 | fill: colors[commit.space], | |
51 | stroke: 'none', |
|
43 | stroke: 'none', | |
52 | }).toFront(); |
|
44 | }).toFront(); | |
53 |
|
||||
54 | // paths to parents |
|
45 | // paths to parents | |
55 | $.each(commit.parent_scmids, function(index, parent_scmid) { |
|
46 | $.each(commit.parent_scmids, function(index, parent_scmid) { | |
56 | parent_commit = commits_by_scmid[parent_scmid]; |
|
47 | parent_commit = commits_by_scmid[parent_scmid]; | |
57 |
|
||||
58 | if (parent_commit) { |
|
48 | if (parent_commit) { | |
59 | parent_y = commit_table_rows.eq(max_rdmid - parent_commit.rdmid).position().top - graph_y_offset + CIRCLE_INROW_OFFSET; |
|
49 | parent_y = commit_table_rows.eq(max_rdmid - parent_commit.rdmid).position().top - graph_y_offset + CIRCLE_INROW_OFFSET; | |
60 | parent_x = graph_x_offset + XSTEP / 2 + XSTEP * parent_commit.space; |
|
50 | parent_x = graph_x_offset + XSTEP / 2 + XSTEP * parent_commit.space; | |
61 |
|
||||
62 | if (parent_commit.space == commit.space) { |
|
51 | if (parent_commit.space == commit.space) { | |
63 | // vertical path |
|
52 | // vertical path | |
64 | path = revisionGraph.path([ |
|
53 | path = revisionGraph.path([ | |
@@ -79,7 +68,6 function drawRevisionGraph(holder, commits_hash, graph_space) { | |||||
79 | } |
|
68 | } | |
80 | path.attr({stroke: colors[commit.space], "stroke-width": 1.5}).toBack(); |
|
69 | path.attr({stroke: colors[commit.space], "stroke-width": 1.5}).toBack(); | |
81 | }); |
|
70 | }); | |
82 |
|
||||
83 | revision_dot_overlay = revisionGraph.circle(x, y, 10); |
|
71 | revision_dot_overlay = revisionGraph.circle(x, y, 10); | |
84 | revision_dot_overlay |
|
72 | revision_dot_overlay | |
85 | .attr({ |
|
73 | .attr({ | |
@@ -94,9 +82,7 function drawRevisionGraph(holder, commits_hash, graph_space) { | |||||
94 | title.appendChild(document.createTextNode(commit.refs)); |
|
82 | title.appendChild(document.createTextNode(commit.refs)); | |
95 | revision_dot_overlay.node.appendChild(title); |
|
83 | revision_dot_overlay.node.appendChild(title); | |
96 | } |
|
84 | } | |
97 |
|
||||
98 | top.push(revision_dot_overlay); |
|
85 | top.push(revision_dot_overlay); | |
99 | }); |
|
86 | }); | |
100 |
|
||||
101 | top.toFront(); |
|
87 | top.toFront(); | |
102 | }; |
|
88 | }; |
General Comments 0
You need to be logged in to leave comments.
Login now