Skip to content

Commit

Permalink
Quick (or, rather, temporary) fix for a bug when there are two nodes,…
Browse files Browse the repository at this point in the history
… and one's a parent of another - currently they will be displayed on the far left of the canvas
  • Loading branch information
grigoryk committed Nov 26, 2010
1 parent 9a8f463 commit ba51f55
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dracula_graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,14 @@ Graph.Layout.Tree.prototype = {
* Position nodes within their depth levels
*/
layoutHorizontally: function() {
var node, c;
var node, c, f;

for (i = 0; i <= this.depth; i++) {
c = this.levels[i].length - 1;
for (j in this.levels[i]) {
node = this.levels[i][j];
node.layoutPosX = (j - c) * i;
f = (j - c) | 1;
node.layoutPosX = f * i;
c--;
}
}
Expand Down

3 comments on commit ba51f55

@Teutonick
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont work ((

@grigoryk
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fix to a different bug :) Fix to the one you reported is coming soon.

@Teutonick
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sory (( dont understood at once =)

Please sign in to comment.