]> source.dussan.org Git - redmine.git/commitdiff
Better handling of horizontal position.
authorEtienne Massip <etienne.massip@gmail.com>
Tue, 14 Feb 2012 06:22:23 +0000 (06:22 +0000)
committerEtienne Massip <etienne.massip@gmail.com>
Tue, 14 Feb 2012 06:22:23 +0000 (06:22 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8867 e93f8b46-1217-0410-a6f0-8f06a7374b81

public/javascripts/revision_graph.js
public/stylesheets/scm.css

index fd16db4330e2c36faffa2d223bd9920cfe18accb..b4e03a48aed3d4d159242bbe0e1cd96fea2d2981 100644 (file)
@@ -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});
         });
index f1d795f0bf6daac43e354b3d956410ab9a3583ea..84b1264043aad02ad2938248f825378f32439218 100644 (file)
@@ -4,7 +4,7 @@ table.revision-info td {
     padding: 0px;
 }
 
-div.revision-graph { position: absolute; overflow:hidden; }
+div.revision-graph { position: absolute; }
 
 div.changeset-changes ul { margin: 0; padding: 0; }
 div.changeset-changes ul > ul { margin-left: 18px; padding: 0; }