|
|
@ -16151,6 +16151,7 @@ function Graph (container, data, options) { |
|
|
|
nodeSpacing: 100, |
|
|
|
direction: "UD" // UD, DU, LR, RL
|
|
|
|
}, |
|
|
|
freezeForStabilization: false, |
|
|
|
smoothCurves: true, |
|
|
|
maxVelocity: 10, |
|
|
|
minVelocity: 0.1, // px/s
|
|
|
@ -16479,6 +16480,7 @@ Graph.prototype.setOptions = function (options) { |
|
|
|
if (options.stabilize !== undefined) {this.stabilize = options.stabilize;} |
|
|
|
if (options.selectable !== undefined) {this.selectable = options.selectable;} |
|
|
|
if (options.smoothCurves !== undefined) {this.constants.smoothCurves = options.smoothCurves;} |
|
|
|
if (options.freezeForStabilization !== undefined) {this.constants.freezeForStabilization = options.freezeForStabilization;} |
|
|
|
if (options.configurePhysics !== undefined){this.constants.configurePhysics = options.configurePhysics;} |
|
|
|
if (options.stabilizationIterations !== undefined) {this.constants.stabilizationIterations = options.stabilizationIterations;} |
|
|
|
|
|
|
@ -17721,6 +17723,10 @@ Graph.prototype._drawEdges = function(ctx) { |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
Graph.prototype._stabilize = function() { |
|
|
|
if (this.constants.freezeForStabilization == true) { |
|
|
|
this._freezeDefinedNodes(); |
|
|
|
} |
|
|
|
|
|
|
|
// find stable position
|
|
|
|
var count = 0; |
|
|
|
while (this.moving && count < this.constants.stabilizationIterations) { |
|
|
@ -17728,11 +17734,14 @@ Graph.prototype._stabilize = function() { |
|
|
|
count++; |
|
|
|
} |
|
|
|
this.zoomExtent(false,true); |
|
|
|
if (this.constants.freezeForStabilization == true) { |
|
|
|
this._restoreFrozenNodes(); |
|
|
|
} |
|
|
|
this.emit("stabilized",{iterations:count}); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Graph.prototype.freezeDefinedNodes = function() { |
|
|
|
Graph.prototype._freezeDefinedNodes = function() { |
|
|
|
var nodes = this.nodes; |
|
|
|
for (var id in nodes) { |
|
|
|
if (nodes.hasOwnProperty(id)) { |
|
|
@ -17746,7 +17755,7 @@ Graph.prototype.freezeDefinedNodes = function() { |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
Graph.prototype.restoreFrozenNodes = function() { |
|
|
|
Graph.prototype._restoreFrozenNodes = function() { |
|
|
|
var nodes = this.nodes; |
|
|
|
for (var id in nodes) { |
|
|
|
if (nodes.hasOwnProperty(id)) { |
|
|
|