diff --git a/HISTORY.md b/HISTORY.md index 1e3ade8f..8a7c43d7 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -7,6 +7,7 @@ http://visjs.org - Fixed Phantom Edges during clustering. - Fixed scaling not doing anything to edges. +- Fixed setting font to null so the network won't crash anymore. ## 2015-09-07, version 4.8.1 diff --git a/dist/vis.js b/dist/vis.js index aedcb1a4..d66bfd45 100644 --- a/dist/vis.js +++ b/dist/vis.js @@ -28584,13 +28584,16 @@ return /******/ (function(modules) { // webpackBootstrap } // handle the font options - if (newOptions.font !== undefined) { + if (newOptions.font !== undefined && newOptions.font !== null) { _sharedLabel2['default'].parseOptions(parentOptions.font, newOptions); + } else if (allowDeletion === true && newOptions.font === null) { + parentOptions.font = undefined; + delete parentOptions.font; } // handle the scaling options, specifically the label part if (newOptions.scaling !== undefined) { - util.mergeOptions(parentOptions.scaling, newOptions.scaling, 'label'); + util.mergeOptions(parentOptions.scaling, newOptions.scaling, 'label', allowDeletion); } } }]); @@ -31458,8 +31461,11 @@ return /******/ (function(modules) { // webpackBootstrap } // handle the font settings - if (newOptions.font !== undefined) { + if (newOptions.font !== undefined && newOptions.font !== null) { _sharedLabel2['default'].parseOptions(parentOptions.font, newOptions); + } else if (allowDeletion === true && newOptions.font === null) { + parentOptions.font = undefined; + delete parentOptions.font; } } }]); diff --git a/lib/network/modules/components/Edge.js b/lib/network/modules/components/Edge.js index caafeb0a..72bbccf2 100644 --- a/lib/network/modules/components/Edge.js +++ b/lib/network/modules/components/Edge.js @@ -187,9 +187,13 @@ class Edge { } // handle the font settings - if (newOptions.font !== undefined) { + if (newOptions.font !== undefined && newOptions.font !== null) { Label.parseOptions(parentOptions.font, newOptions); } + else if (allowDeletion === true && newOptions.font === null) { + parentOptions.font = undefined; + delete parentOptions.font; + } } diff --git a/lib/network/modules/components/Node.js b/lib/network/modules/components/Node.js index d7554f98..a16424e1 100644 --- a/lib/network/modules/components/Node.js +++ b/lib/network/modules/components/Node.js @@ -203,13 +203,17 @@ class Node { } // handle the font options - if (newOptions.font !== undefined) { + if (newOptions.font !== undefined && newOptions.font !== null) { Label.parseOptions(parentOptions.font, newOptions); } + else if (allowDeletion === true && newOptions.font === null) { + parentOptions.font = undefined; + delete parentOptions.font; + } // handle the scaling options, specifically the label part if (newOptions.scaling !== undefined) { - util.mergeOptions(parentOptions.scaling, newOptions.scaling, 'label'); + util.mergeOptions(parentOptions.scaling, newOptions.scaling, 'label', allowDeletion); } } diff --git a/test/networkTest.html b/test/networkTest.html index 2a7d4cde..e608bd61 100644 --- a/test/networkTest.html +++ b/test/networkTest.html @@ -1,89 +1,661 @@ - + - Vis Popup Example - + + + + + +Reset causes crash + +
+
+When you press the button, the nodes dataset will receive an update which shall reset the font and color properties, instead, vis crashes :(
+
+(The browser console shows the details)
+
+
+ + + +
+ + + - - - - - - - - -

Popup Example

+ data.nodes.update(updates); + + console.log(updates); + + }; + + + -
+ \ No newline at end of file