Browse Source

- Altered the Manipulation Mixin to be succesfully destroyed from memory when calling destroy();

v3_develop
Alex de Mulder 9 years ago
parent
commit
0e045a5705
6 changed files with 44 additions and 42 deletions
  1. +2
    -0
      HISTORY.md
  2. +15
    -15
      dist/vis.js
  3. +1
    -1
      dist/vis.map
  4. +11
    -11
      dist/vis.min.js
  5. +6
    -8
      lib/network/Network.js
  6. +9
    -7
      lib/network/mixins/ManipulationMixin.js

+ 2
- 0
HISTORY.md View File

@ -8,6 +8,8 @@ http://visjs.org
- reverted change in image class, fixed bug #552
- improved (not neccesarily fixed) the fontFill offset between different browsers. #365
- Fixed dashed lines on firefox on Unix systems
- Altered the Manipulation Mixin to be succesfully destroyed from memory when calling destroy();
## 20145-01-09, version 3.8.0

+ 15
- 15
dist/vis.js View File

@ -23563,18 +23563,16 @@ return /******/ (function(modules) { // webpackBootstrap
// clear events
this.off();
// remove all elements from the container element.
while (this.frame.hasChildNodes()) {
this.frame.removeChild(this.frame.firstChild);
}
this._recursiveDOMDelete(this.containerElement);
}
// remove all elements from the container element.
while (this.containerElement.hasChildNodes()) {
this.containerElement.removeChild(this.containerElement.firstChild);
Network.prototype._recursiveDOMDelete = function(DOMobject) {
while (DOMobject.hasChildNodes() == true) {
this._recursiveDOMDelete(DOMobject.firstChild);
DOMobject.removeChild(DOMobject.firstChild);
}
}
/**
* Get the pointer location from a touch location
* @param {{pageX: Number, pageY: Number}} touch
@ -32916,9 +32914,7 @@ return /******/ (function(modules) { // webpackBootstrap
* @private
*/
exports._clearManipulatorBar = function() {
while (this.manipulationDiv.hasChildNodes()) {
this.manipulationDiv.removeChild(this.manipulationDiv.firstChild);
}
this._recursiveDOMDelete(this.manipulationDiv);
this.manipulationDOM = {};
this._manipulationReleaseOverload = function () {};
@ -32938,6 +32934,7 @@ return /******/ (function(modules) { // webpackBootstrap
for (var functionName in this.cachedFunctions) {
if (this.cachedFunctions.hasOwnProperty(functionName)) {
this[functionName] = this.cachedFunctions[functionName];
delete this.cachedFunctions[functionName];
}
}
};
@ -33083,7 +33080,8 @@ return /******/ (function(modules) { // webpackBootstrap
}
this.closeDiv.onclick = this._toggleEditMode.bind(this);
this.boundFunction = this._createManipulatorBar.bind(this);
var me = this;
this.boundFunction = me._createManipulatorBar;
this.on('select', this.boundFunction);
}
else {
@ -33146,7 +33144,8 @@ return /******/ (function(modules) { // webpackBootstrap
this.manipulationDOM['backSpan'].onclick = this._createManipulatorBar.bind(this);
// we use the boundFunction so we can reference it when we unbind it from the "select" event.
this.boundFunction = this._addNode.bind(this);
var me = this;
this.boundFunction = me._addNode;
this.on('select', this.boundFunction);
};
@ -33195,10 +33194,11 @@ return /******/ (function(modules) { // webpackBootstrap
this.manipulationDiv.appendChild(this.manipulationDOM['descriptionSpan']);
// bind the icon
this.manipulationDOM['backSpan'].onclick = this._createManipulatorBar.bind(this);
var me = this; // we use me so we don't have to use bind(this). If we use bind, we cannot clean up after it.
this.manipulationDOM['backSpan'].onclick = me._createManipulatorBar;
// we use the boundFunction so we can reference it when we unbind it from the "select" event.
this.boundFunction = this._handleConnect.bind(this);
this.boundFunction = me._handleConnect;
this.on('select', this.boundFunction);
// temporarily overload functions

+ 1
- 1
dist/vis.map
File diff suppressed because it is too large
View File


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


+ 6
- 8
lib/network/Network.js View File

@ -876,18 +876,16 @@ Network.prototype.destroy = function() {
// clear events
this.off();
// remove all elements from the container element.
while (this.frame.hasChildNodes()) {
this.frame.removeChild(this.frame.firstChild);
}
this._recursiveDOMDelete(this.containerElement);
}
// remove all elements from the container element.
while (this.containerElement.hasChildNodes()) {
this.containerElement.removeChild(this.containerElement.firstChild);
Network.prototype._recursiveDOMDelete = function(DOMobject) {
while (DOMobject.hasChildNodes() == true) {
this._recursiveDOMDelete(DOMobject.firstChild);
DOMobject.removeChild(DOMobject.firstChild);
}
}
/**
* Get the pointer location from a touch location
* @param {{pageX: Number, pageY: Number}} touch

+ 9
- 7
lib/network/mixins/ManipulationMixin.js View File

@ -8,9 +8,7 @@ var Edge = require('../Edge');
* @private
*/
exports._clearManipulatorBar = function() {
while (this.manipulationDiv.hasChildNodes()) {
this.manipulationDiv.removeChild(this.manipulationDiv.firstChild);
}
this._recursiveDOMDelete(this.manipulationDiv);
this.manipulationDOM = {};
this._manipulationReleaseOverload = function () {};
@ -30,6 +28,7 @@ exports._restoreOverloadedFunctions = function() {
for (var functionName in this.cachedFunctions) {
if (this.cachedFunctions.hasOwnProperty(functionName)) {
this[functionName] = this.cachedFunctions[functionName];
delete this.cachedFunctions[functionName];
}
}
};
@ -175,7 +174,8 @@ exports._createManipulatorBar = function() {
}
this.closeDiv.onclick = this._toggleEditMode.bind(this);
this.boundFunction = this._createManipulatorBar.bind(this);
var me = this;
this.boundFunction = me._createManipulatorBar;
this.on('select', this.boundFunction);
}
else {
@ -238,7 +238,8 @@ exports._createAddNodeToolbar = function() {
this.manipulationDOM['backSpan'].onclick = this._createManipulatorBar.bind(this);
// we use the boundFunction so we can reference it when we unbind it from the "select" event.
this.boundFunction = this._addNode.bind(this);
var me = this;
this.boundFunction = me._addNode;
this.on('select', this.boundFunction);
};
@ -287,10 +288,11 @@ exports._createAddEdgeToolbar = function() {
this.manipulationDiv.appendChild(this.manipulationDOM['descriptionSpan']);
// bind the icon
this.manipulationDOM['backSpan'].onclick = this._createManipulatorBar.bind(this);
var me = this; // we use me so we don't have to use bind(this). If we use bind, we cannot clean up after it.
this.manipulationDOM['backSpan'].onclick = me._createManipulatorBar;
// we use the boundFunction so we can reference it when we unbind it from the "select" event.
this.boundFunction = this._handleConnect.bind(this);
this.boundFunction = me._handleConnect;
this.on('select', this.boundFunction);
// temporarily overload functions

Loading…
Cancel
Save