Browse Source

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
develop
João Menighin 6 years ago
committed by Yotam Berkowitz
parent
commit
6796a0c7fa
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      lib/network/modules/components/Node.js

+ 6
- 2
lib/network/modules/components/Node.js View File

@ -212,8 +212,12 @@ class Node {
var groupObj = groupList.get(group); var groupObj = groupList.get(group);
// Skip merging of group font options into parent; these are required to be distinct for labels // 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. // the color object needs to be completely defined.
// Since groups can partially overwrite the colors, we parse it again, just in case. // Since groups can partially overwrite the colors, we parse it again, just in case.

Loading…
Cancel
Save