Skip to content
This repository has been archived by the owner on Oct 4, 2020. It is now read-only.

Commit

Permalink
Fix almende#3713 - Node color overriden by Group Color (almende#3870)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Menighin authored and mojoaxel committed Jun 9, 2019
1 parent 7ed219c commit ade8e67
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/network/modules/components/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit ade8e67

Please sign in to comment.