From 67bda4ff16952cde68b294160b7d126da9e2abe7 Mon Sep 17 00:00:00 2001 From: Alex de Mulder Date: Sun, 24 May 2015 16:51:44 +0200 Subject: [PATCH] - Fixed #866, manipulation can now be set to false without crashing. --- HISTORY.md | 15 ++++++++++++++ dist/vis.js | 24 +++++++++++++++++------ lib/network/modules/ManipulationSystem.js | 6 +++--- lib/util.js | 12 +++++++++--- 4 files changed, 45 insertions(+), 12 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 56a3270a..2f2bed8e 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,6 +1,21 @@ # vis.js history http://visjs.org +## UNRELEASED, version 4.0.1 + +### Network + +- Fixed #866, manipulation can now be set to false without crashing. +- Fixed #860, edit node mode now works as it should. +- Fixed #859, images now resize again when they are loaded. +- Fixed dynamic edges not correctly handling non-existent nodes. +- Accepted pull from @killerDJO for fixing selected and hover colors for edges. +- Fixed bug with rightmouse button, scroll center and popup positions using the wrong coordinates. + +### Graph2d & Timeline + +- Fixed #858, removed usage of deprictated unsubscribe from dataset. + ## 2015-05-22, version 4.0.0 diff --git a/dist/vis.js b/dist/vis.js index a507c014..06f1f053 100644 --- a/dist/vis.js +++ b/dist/vis.js @@ -806,10 +806,16 @@ return /******/ (function(modules) { // webpackBootstrap return object instanceof Number || typeof object == 'number'; }; + /** + * Remove everything in the DOM object + * @param DOMobject + */ exports.recursiveDOMDelete = function (DOMobject) { - while (DOMobject.hasChildNodes() == true) { - exports.recursiveDOMDelete(DOMobject.firstChild); - DOMobject.removeChild(DOMobject.firstChild); + if (DOMobject) { + while (DOMobject.hasChildNodes() === true) { + exports.recursiveDOMDelete(DOMobject.firstChild); + DOMobject.removeChild(DOMobject.firstChild); + } } }; @@ -26964,9 +26970,15 @@ return /******/ (function(modules) { // webpackBootstrap util.recursiveDOMDelete(this.closeDiv); // remove the manipulation divs - this.canvas.frame.removeChild(this.manipulationDiv); - this.canvas.frame.removeChild(this.editModeDiv); - this.canvas.frame.removeChild(this.closeDiv); + if (this.manipulationDiv) { + this.canvas.frame.removeChild(this.manipulationDiv); + } + if (this.editModeDiv) { + this.canvas.frame.removeChild(this.editModeDiv); + } + if (this.closeDiv) { + this.canvas.frame.removeChild(this.manipulationDiv); + } // set the references to undefined this.manipulationDiv = undefined; diff --git a/lib/network/modules/ManipulationSystem.js b/lib/network/modules/ManipulationSystem.js index 7e45fc72..48f9e42b 100644 --- a/lib/network/modules/ManipulationSystem.js +++ b/lib/network/modules/ManipulationSystem.js @@ -632,9 +632,9 @@ class ManipulationSystem { util.recursiveDOMDelete(this.closeDiv); // remove the manipulation divs - this.canvas.frame.removeChild(this.manipulationDiv); - this.canvas.frame.removeChild(this.editModeDiv); - this.canvas.frame.removeChild(this.closeDiv); + if (this.manipulationDiv) {this.canvas.frame.removeChild(this.manipulationDiv);} + if (this.editModeDiv) {this.canvas.frame.removeChild(this.editModeDiv);} + if (this.closeDiv) {this.canvas.frame.removeChild(this.manipulationDiv);} // set the references to undefined this.manipulationDiv = undefined; diff --git a/lib/util.js b/lib/util.js index 7787d844..91e55e95 100644 --- a/lib/util.js +++ b/lib/util.js @@ -17,10 +17,16 @@ exports.isNumber = function(object) { }; +/** + * Remove everything in the DOM object + * @param DOMobject + */ exports.recursiveDOMDelete = function(DOMobject) { - while (DOMobject.hasChildNodes() == true) { - exports.recursiveDOMDelete(DOMobject.firstChild); - DOMobject.removeChild(DOMobject.firstChild); + if (DOMobject) { + while (DOMobject.hasChildNodes() === true) { + exports.recursiveDOMDelete(DOMobject.firstChild); + DOMobject.removeChild(DOMobject.firstChild); + } } };