Browse Source

- Improved cleaning up of the physics configuration on destroy and in options.

v3_develop
Alex de Mulder 10 years ago
parent
commit
8e80076825
5 changed files with 2406 additions and 2367 deletions
  1. +1
    -0
      HISTORY.md
  2. +2386
    -2367
      dist/vis.js
  3. +3
    -0
      lib/network/Network.js
  4. +3
    -0
      lib/network/mixins/MixinLoader.js
  5. +13
    -0
      lib/network/mixins/physics/PhysicsMixin.js

+ 1
- 0
HISTORY.md View File

@ -13,6 +13,7 @@ http://visjs.org
- Made physics more stable (albeit a little slower). - Made physics more stable (albeit a little slower).
- Added a check so only one 'activator' overlay is created on clickToUse. - Added a check so only one 'activator' overlay is created on clickToUse.
- Made global color options for edges overrule the inheritColors. - Made global color options for edges overrule the inheritColors.
- Improved cleaning up of the physics configuration on destroy and in options.
### Graph2d ### Graph2d

+ 2386
- 2367
dist/vis.js
File diff suppressed because it is too large
View File


+ 3
- 0
lib/network/Network.js View File

@ -852,6 +852,9 @@ Network.prototype.destroy = function() {
this.redraw = function () {}; this.redraw = function () {};
this.timer = false; this.timer = false;
// cleanup physicsConfiguration if it exists
this._cleanupPhysicsConfiguration();
// remove keybindings // remove keybindings
this.keycharm.reset(); this.keycharm.reset();

+ 3
- 0
lib/network/mixins/MixinLoader.js View File

@ -47,6 +47,9 @@ exports._loadPhysicsSystem = function () {
if (this.constants.configurePhysics == true) { if (this.constants.configurePhysics == true) {
this._loadPhysicsConfiguration(); this._loadPhysicsConfiguration();
} }
else {
this._cleanupPhysicsConfiguration();
}
}; };

+ 13
- 0
lib/network/mixins/physics/PhysicsMixin.js View File

@ -305,6 +305,17 @@ exports._calculateSpringForce = function (node1, node2, edgeLength) {
}; };
exports._cleanupPhysicsConfiguration = function() {
if (this.physicsConfiguration !== undefined) {
while (this.physicsConfiguration.hasChildNodes()) {
this.physicsConfiguration.removeChild(this.physicsConfiguration.firstChild);
}
this.physicsConfiguration.parentNode.removeChild(this.physicsConfiguration);
this.physicsConfiguration = undefined;
}
}
/** /**
* Load the HTML for the physics config and bind it * Load the HTML for the physics config and bind it
* @private * @private
@ -706,3 +717,5 @@ function showValueOfRange (id,map,constantsVariableName) {
this.moving = true; this.moving = true;
this.start(); this.start();
} }

Loading…
Cancel
Save