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