|
@ -209,27 +209,21 @@ Network.prototype._updateVisibleIndices = function() { |
|
|
Network.prototype.bindEventListeners = function() { |
|
|
Network.prototype.bindEventListeners = function() { |
|
|
// this event will trigger a rebuilding of the cache everything. Used when nodes or edges have been added or removed.
|
|
|
// this event will trigger a rebuilding of the cache everything. Used when nodes or edges have been added or removed.
|
|
|
this.body.emitter.on("_dataChanged", (params) => { |
|
|
this.body.emitter.on("_dataChanged", (params) => { |
|
|
var t0 = new Date().valueOf(); |
|
|
|
|
|
// update shortcut lists
|
|
|
// update shortcut lists
|
|
|
this._updateVisibleIndices(); |
|
|
this._updateVisibleIndices(); |
|
|
this.physics.updatePhysicsIndices(); |
|
|
this.physics.updatePhysicsIndices(); |
|
|
|
|
|
|
|
|
// call the dataUpdated event because the only difference between the two is the updating of the indices
|
|
|
// call the dataUpdated event because the only difference between the two is the updating of the indices
|
|
|
this.body.emitter.emit("_dataUpdated"); |
|
|
this.body.emitter.emit("_dataUpdated"); |
|
|
|
|
|
|
|
|
console.log("_dataChanged took:", new Date().valueOf() - t0); |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// this is called when options of EXISTING nodes or edges have changed.
|
|
|
// this is called when options of EXISTING nodes or edges have changed.
|
|
|
this.body.emitter.on("_dataUpdated", () => { |
|
|
this.body.emitter.on("_dataUpdated", () => { |
|
|
var t0 = new Date().valueOf(); |
|
|
|
|
|
// update values
|
|
|
// update values
|
|
|
this._updateValueRange(this.body.nodes); |
|
|
this._updateValueRange(this.body.nodes); |
|
|
this._updateValueRange(this.body.edges); |
|
|
this._updateValueRange(this.body.edges); |
|
|
// start simulation (can be called safely, even if already running)
|
|
|
// start simulation (can be called safely, even if already running)
|
|
|
this.body.emitter.emit("startSimulation"); |
|
|
this.body.emitter.emit("startSimulation"); |
|
|
|
|
|
|
|
|
console.log("_dataUpdated took:", new Date().valueOf() - t0); |
|
|
|
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|