|
|
@ -570,7 +570,6 @@ Network.prototype.setData = function(data, disableStart) { |
|
|
|
Network.prototype.setOptions = function (options) { |
|
|
|
if (options) { |
|
|
|
var prop; |
|
|
|
|
|
|
|
var fields = ['nodes','edges','smoothCurves','hierarchicalLayout','clustering','navigation', |
|
|
|
'keyboard','dataManipulation','onAdd','onEdit','onEditEdge','onConnect','onDelete','clickToUse' |
|
|
|
]; |
|
|
@ -688,24 +687,25 @@ Network.prototype.setOptions = function (options) { |
|
|
|
if (options.labels) { |
|
|
|
throw new Error('Option "labels" is deprecated. Use options "locale" and "locales" instead.'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// (Re)loading the mixins that can be enabled or disabled in the options.
|
|
|
|
// load the force calculation functions, grouped under the physics system.
|
|
|
|
this._loadPhysicsSystem(); |
|
|
|
// load the navigation system.
|
|
|
|
this._loadNavigationControls(); |
|
|
|
// load the data manipulation system
|
|
|
|
this._loadManipulationSystem(); |
|
|
|
// configure the smooth curves
|
|
|
|
this._configureSmoothCurves(); |
|
|
|
// (Re)loading the mixins that can be enabled or disabled in the options.
|
|
|
|
// load the force calculation functions, grouped under the physics system.
|
|
|
|
this._loadPhysicsSystem(); |
|
|
|
// load the navigation system.
|
|
|
|
this._loadNavigationControls(); |
|
|
|
// load the data manipulation system
|
|
|
|
this._loadManipulationSystem(); |
|
|
|
// configure the smooth curves
|
|
|
|
this._configureSmoothCurves(); |
|
|
|
|
|
|
|
|
|
|
|
// bind keys. If disabled, this will not do anything;
|
|
|
|
this._createKeyBinds(); |
|
|
|
this.setSize(this.constants.width, this.constants.height); |
|
|
|
this.moving = true; |
|
|
|
this.start(); |
|
|
|
// bind keys. If disabled, this will not do anything;
|
|
|
|
this._createKeyBinds(); |
|
|
|
|
|
|
|
this.setSize(this.constants.width, this.constants.height); |
|
|
|
this.moving = true; |
|
|
|
this.start(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -732,11 +732,9 @@ Network.prototype._create = function () { |
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
this.frame.canvas = document.createElement("canvas"); |
|
|
|
|
|
|
|
this.frame.canvas.style.position = 'relative'; |
|
|
|
this.frame.appendChild(this.frame.canvas); |
|
|
|
|
|
|
|
|
|
|
|
if (!this.frame.canvas.getContext) { |
|
|
|
var noCanvas = document.createElement( 'DIV' ); |
|
|
|
noCanvas.style.color = 'red'; |
|
|
@ -746,17 +744,13 @@ Network.prototype._create = function () { |
|
|
|
this.frame.canvas.appendChild(noCanvas); |
|
|
|
} |
|
|
|
else { |
|
|
|
|
|
|
|
var ctx = this.frame.canvas.getContext("2d"); |
|
|
|
|
|
|
|
this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || |
|
|
|
ctx.mozBackingStorePixelRatio || |
|
|
|
ctx.msBackingStorePixelRatio || |
|
|
|
ctx.oBackingStorePixelRatio || |
|
|
|
ctx.backingStorePixelRatio || 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.frame.canvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); |
|
|
|
} |
|
|
|
|
|
|
@ -784,7 +778,7 @@ Network.prototype._create = function () { |
|
|
|
this.hammerFrame = Hammer(this.frame, { |
|
|
|
prevent_default: true |
|
|
|
}); |
|
|
|
this.hammerFrame.on('release', me._onRelease.bind(me) ); |
|
|
|
this.hammerFrame.on('release', me._onRelease.bind(me) ); |
|
|
|
|
|
|
|
// add the frame to the container element
|
|
|
|
this.containerElement.appendChild(this.frame); |
|
|
|