Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Raibaz/sigma.js into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
jacomyal committed Apr 4, 2012
2 parents 6b6dd1d + 1542414 commit 8279471
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/core/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,11 @@ function Graph() {
Math.min(w / Math.max(xMax - xMin, 1),
h / Math.max(yMax - yMin, 1));

xMax += self.p.maxNodeSize;
xMin -= self.p.maxNodeSize;
yMax += self.p.maxNodeSize;
yMin -= self.p.maxNodeSize;

// Size homothetic parameters:
var a, b;
if (!self.p.maxNodeSize && !self.p.minNodeSize) {
Expand Down Expand Up @@ -479,6 +484,17 @@ function Graph() {
if (!node['fixed']) {
node['displayX'] = (node['x'] - (xMax + xMin) / 2) * scale + w / 2;
node['displayY'] = (node['y'] - (yMax + yMin) / 2) * scale + h / 2;

if(node['displayX'] < self.p.maxNodeSize) {
node['displayX'] += self.p.maxNodeSize;
} else if(node['displayX'] >= (w - self.p.maxNodeSize)) {
node['displayX'] -= self.p.maxNodeSize;
}
if(node['displayY'] < self.p.maxNodeSize) {
node['displayY'] += self.p.maxNodeSize;
} else if(node['displayY'] >= (h - self.p.maxNodeSize)) {
node['displayY'] -= self.p.maxNodeSize;
}
}
});

Expand Down

0 comments on commit 8279471

Please sign in to comment.