diff --git a/HISTORY.md b/HISTORY.md index 1e133a0e..a5442b69 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -17,6 +17,7 @@ http://visjs.org - Fixed #1398: Support nodes start with the correct positions. - Fixed #1324: Labels now scale again. - Fixed #1362: Layout of hierarchicaly systems no longer overlaps NODES. +- Fixed #1414: Fixed color references for nodes and edges. ### Timeline diff --git a/dist/vis.js b/dist/vis.js index cc03042d..be0ee14d 100644 --- a/dist/vis.js +++ b/dist/vis.js @@ -28756,6 +28756,8 @@ return /******/ (function(modules) { // webpackBootstrap // individual shape newOptions if (newOptions.color !== undefined && newOptions.color !== null) { + // make a copy of the parent object in case this is referring to the global one (due to object create once, then update) + parentOptions.color = util.deepExtend({}, parentOptions.color, true); var parsedColor = util.parseColor(newOptions.color); util.fillIfDefined(parentOptions.color, parsedColor); } else if (allowDeletion === true && newOptions.color === null) { @@ -31653,6 +31655,8 @@ return /******/ (function(modules) { // webpackBootstrap // hanlde multiple input cases for color if (newOptions.color !== undefined && newOptions.color !== null) { + // make a copy of the parent object in case this is referring to the global one (due to object create once, then update) + parentOptions.color = util.deepExtend({}, parentOptions.color, true); if (util.isString(newOptions.color)) { parentOptions.color.color = newOptions.color; parentOptions.color.highlight = newOptions.color; diff --git a/lib/network/modules/components/Edge.js b/lib/network/modules/components/Edge.js index 89ac1c76..8c21c4af 100644 --- a/lib/network/modules/components/Edge.js +++ b/lib/network/modules/components/Edge.js @@ -160,6 +160,8 @@ class Edge { // hanlde multiple input cases for color if (newOptions.color !== undefined && newOptions.color !== null) { + // make a copy of the parent object in case this is referring to the global one (due to object create once, then update) + parentOptions.color = util.deepExtend({}, parentOptions.color, true); if (util.isString(newOptions.color)) { parentOptions.color.color = newOptions.color; parentOptions.color.highlight = newOptions.color; diff --git a/lib/network/modules/components/Node.js b/lib/network/modules/components/Node.js index 44c38993..37bdedd2 100644 --- a/lib/network/modules/components/Node.js +++ b/lib/network/modules/components/Node.js @@ -179,6 +179,8 @@ class Node { // individual shape newOptions if (newOptions.color !== undefined && newOptions.color !== null) { + // make a copy of the parent object in case this is referring to the global one (due to object create once, then update) + parentOptions.color = util.deepExtend({}, parentOptions.color, true); let parsedColor = util.parseColor(newOptions.color); util.fillIfDefined(parentOptions.color, parsedColor); } diff --git a/test/networkTest.html b/test/networkTest.html index aac4bc99..c24aeb81 100644 --- a/test/networkTest.html +++ b/test/networkTest.html @@ -17,59 +17,27 @@