From 6796a0c7fad930b38e7012698428e7028bff8d41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Menighin?= Date: Sat, 31 Mar 2018 16:04:04 -0300 Subject: [PATCH] Fix #3713 - Node color overriden by Group Color (#3870) * Checks if color is not defined at node level before overriding it with the Group color * Checking if newOptions is not undefined before checking for color property --- lib/network/modules/components/Node.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/network/modules/components/Node.js b/lib/network/modules/components/Node.js index 828d5c3f..f8780908 100644 --- a/lib/network/modules/components/Node.js +++ b/lib/network/modules/components/Node.js @@ -212,8 +212,12 @@ class Node { var groupObj = groupList.get(group); // Skip merging of group font options into parent; these are required to be distinct for labels - // TODO: It might not be a good idea either to merge the rest of the options, investigate this. - util.selectiveNotDeepExtend(['font'], parentOptions, groupObj); + // Also skip mergin of color IF it is already defined in the node itself. This is to avoid the color of the + // group overriding the color set at the node level + // TODO: It might not be a good idea either to merge the rest of the options, investigate this. + var skipProperties = ['font']; + if (newOptions !== undefined && newOptions.color !== undefined && newOptions.color != null) skipProperties.push('color'); + util.selectiveNotDeepExtend(skipProperties, parentOptions, groupObj); // the color object needs to be completely defined. // Since groups can partially overwrite the colors, we parse it again, just in case.