summaryrefslogtreecommitdiffstats
path: root/public/javascripts
diff options
context:
space:
mode:
authorEtienne Massip <etienne.massip@gmail.com>2012-02-14 06:22:23 +0000
committerEtienne Massip <etienne.massip@gmail.com>2012-02-14 06:22:23 +0000
commitd8fed7d515bfe4e59b2e66d5b2dc78ca07f5cf20 (patch)
treed80145774919c898f6102b7d504830037a6ab42c /public/javascripts
parentc5317a14ac0696cac5d9ae8d3b3ddd2b61aee01c (diff)
downloadredmine-d8fed7d515bfe4e59b2e66d5b2dc78ca07f5cf20.tar.gz
redmine-d8fed7d515bfe4e59b2e66d5b2dc78ca07f5cf20.zip
Better handling of horizontal position.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8867 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'public/javascripts')
-rw-r--r--public/javascripts/revision_graph.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/public/javascripts/revision_graph.js b/public/javascripts/revision_graph.js
index fd16db433..b4e03a48a 100644
--- a/public/javascripts/revision_graph.js
+++ b/public/javascripts/revision_graph.js
@@ -21,11 +21,12 @@ function drawRevisionGraph(holder, commits_hash, graph_space) {
var top = revisionGraph.set();
// init dimensions
- var graph_offset = $(holder).getLayout().get('top'),
- graph_width = (graph_space + 1) * XSTEP,
- graph_height = commit_table_rows[max_rdmid].getLayout().get('top') + commit_table_rows[max_rdmid].getLayout().get('height') - graph_offset;
+ var graph_x_offset = Element.select(commit_table_rows.first(),'td').first().getLayout().get('left') - $(holder).getLayout().get('left'),
+ graph_y_offset = $(holder).getLayout().get('top'),
+ graph_right_side = graph_x_offset + (graph_space + 1) * XSTEP,
+ graph_bottom = commit_table_rows.last().getLayout().get('top') + commit_table_rows.last().getLayout().get('height') - graph_y_offset;
- revisionGraph.setSize(graph_width, graph_height);
+ revisionGraph.setSize(graph_right_side, graph_bottom);
// init colors
var colors = [];
@@ -40,8 +41,8 @@ function drawRevisionGraph(holder, commits_hash, graph_space) {
commits.each(function(commit) {
- y = commit_table_rows[max_rdmid - commit.rdmid].getLayout().get('top') - graph_offset + CIRCLE_INROW_OFFSET;
- x = XSTEP / 2 + XSTEP * commit.space;
+ y = commit_table_rows[max_rdmid - commit.rdmid].getLayout().get('top') - graph_y_offset + CIRCLE_INROW_OFFSET;
+ x = graph_x_offset + XSTEP / 2 + XSTEP * commit.space;
revisionGraph.circle(x, y, 3).attr({fill: colors[commit.space], stroke: 'none'});
@@ -67,8 +68,8 @@ function drawRevisionGraph(holder, commits_hash, graph_space) {
parent_commit = commits_by_scmid.get(parent_scmid);
if (parent_commit) {
- parent_y = commit_table_rows[max_rdmid - parent_commit.rdmid].getLayout().get('top') - graph_offset + CIRCLE_INROW_OFFSET;
- parent_x = XSTEP / 2 + XSTEP * parent_commit.space;
+ parent_y = commit_table_rows[max_rdmid - parent_commit.rdmid].getLayout().get('top') - graph_y_offset + CIRCLE_INROW_OFFSET;
+ parent_x = graph_x_offset + XSTEP / 2 + XSTEP * parent_commit.space;
if (parent_commit.space == commit.space) {
// vertical path
@@ -86,7 +87,7 @@ function drawRevisionGraph(holder, commits_hash, graph_space) {
// vertical path ending at the bottom of the revisionGraph
path = revisionGraph.path([
'M', x, y,
- 'V', graph_height]);
+ 'V', graph_bottom]);
}
path.attr({stroke: colors[commit.space], "stroke-width": 1.5});
});