Browse Source

Merge remote-tracking branch 'origin/develop' into develop

css_transitions
josdejong 10 years ago
parent
commit
1324ebc6e3
2 changed files with 33 additions and 13 deletions
  1. +17
    -7
      dist/vis.js
  2. +16
    -6
      src/graph/Graph.js

+ 17
- 7
dist/vis.js View File

@ -5,7 +5,7 @@
* A dynamic, browser-based visualization library. * A dynamic, browser-based visualization library.
* *
* @version 0.7.2-SNAPSHOT * @version 0.7.2-SNAPSHOT
* @date 2014-03-27
* @date 2014-03-31
* *
* @license * @license
* Copyright (C) 2011-2014 Almende B.V, http://almende.com * Copyright (C) 2011-2014 Almende B.V, http://almende.com
@ -16308,6 +16308,9 @@ Graph.prototype._getRange = function() {
if (maxY < (node.y)) {maxY = node.y;} if (maxY < (node.y)) {maxY = node.y;}
} }
} }
if (minX == 1e9 && maxX == -1e9 && minY == 1e9 && maxY == -1e9) {
minY = 0, maxY = 0, minX = 0, maxX = 0;
}
return {minX: minX, maxX: maxX, minY: minY, maxY: maxY}; return {minX: minX, maxX: maxX, minY: minY, maxY: maxY};
}; };
@ -17018,6 +17021,7 @@ Graph.prototype._zoom = function(scale, pointer) {
this.updateClustersDefault(); this.updateClustersDefault();
this._redraw(); this._redraw();
return scale; return scale;
}; };
@ -17795,11 +17799,13 @@ Graph.prototype._discreteStepNodes = function() {
var interval = this.physicsDiscreteStepsize; var interval = this.physicsDiscreteStepsize;
var nodes = this.nodes; var nodes = this.nodes;
var nodeId; var nodeId;
var nodesPresent = false;
if (this.constants.maxVelocity > 0) { if (this.constants.maxVelocity > 0) {
for (nodeId in nodes) { for (nodeId in nodes) {
if (nodes.hasOwnProperty(nodeId)) { if (nodes.hasOwnProperty(nodeId)) {
nodes[nodeId].discreteStepLimited(interval, this.constants.maxVelocity); nodes[nodeId].discreteStepLimited(interval, this.constants.maxVelocity);
nodesPresent = true;
} }
} }
} }
@ -17807,15 +17813,19 @@ Graph.prototype._discreteStepNodes = function() {
for (nodeId in nodes) { for (nodeId in nodes) {
if (nodes.hasOwnProperty(nodeId)) { if (nodes.hasOwnProperty(nodeId)) {
nodes[nodeId].discreteStep(interval); nodes[nodeId].discreteStep(interval);
nodesPresent = true;
} }
} }
} }
var vminCorrected = this.constants.minVelocity / Math.max(this.scale,0.05);
if (vminCorrected > 0.5*this.constants.maxVelocity) {
this.moving = true;
}
else {
this.moving = this._isMoving(vminCorrected);
if (nodesPresent == true) {
var vminCorrected = this.constants.minVelocity / Math.max(this.scale,0.05);
if (vminCorrected > 0.5*this.constants.maxVelocity) {
this.moving = true;
}
else {
this.moving = this._isMoving(vminCorrected);
}
} }
}; };

+ 16
- 6
src/graph/Graph.js View File

@ -303,6 +303,9 @@ Graph.prototype._getRange = function() {
if (maxY < (node.y)) {maxY = node.y;} if (maxY < (node.y)) {maxY = node.y;}
} }
} }
if (minX == 1e9 && maxX == -1e9 && minY == 1e9 && maxY == -1e9) {
minY = 0, maxY = 0, minX = 0, maxX = 0;
}
return {minX: minX, maxX: maxX, minY: minY, maxY: maxY}; return {minX: minX, maxX: maxX, minY: minY, maxY: maxY};
}; };
@ -1013,6 +1016,7 @@ Graph.prototype._zoom = function(scale, pointer) {
this.updateClustersDefault(); this.updateClustersDefault();
this._redraw(); this._redraw();
return scale; return scale;
}; };
@ -1790,11 +1794,13 @@ Graph.prototype._discreteStepNodes = function() {
var interval = this.physicsDiscreteStepsize; var interval = this.physicsDiscreteStepsize;
var nodes = this.nodes; var nodes = this.nodes;
var nodeId; var nodeId;
var nodesPresent = false;
if (this.constants.maxVelocity > 0) { if (this.constants.maxVelocity > 0) {
for (nodeId in nodes) { for (nodeId in nodes) {
if (nodes.hasOwnProperty(nodeId)) { if (nodes.hasOwnProperty(nodeId)) {
nodes[nodeId].discreteStepLimited(interval, this.constants.maxVelocity); nodes[nodeId].discreteStepLimited(interval, this.constants.maxVelocity);
nodesPresent = true;
} }
} }
} }
@ -1802,15 +1808,19 @@ Graph.prototype._discreteStepNodes = function() {
for (nodeId in nodes) { for (nodeId in nodes) {
if (nodes.hasOwnProperty(nodeId)) { if (nodes.hasOwnProperty(nodeId)) {
nodes[nodeId].discreteStep(interval); nodes[nodeId].discreteStep(interval);
nodesPresent = true;
} }
} }
} }
var vminCorrected = this.constants.minVelocity / Math.max(this.scale,0.05);
if (vminCorrected > 0.5*this.constants.maxVelocity) {
this.moving = true;
}
else {
this.moving = this._isMoving(vminCorrected);
if (nodesPresent == true) {
var vminCorrected = this.constants.minVelocity / Math.max(this.scale,0.05);
if (vminCorrected > 0.5*this.constants.maxVelocity) {
this.moving = true;
}
else {
this.moving = this._isMoving(vminCorrected);
}
} }
}; };

Loading…
Cancel
Save