Skip to content

Commit 9fb6e3b

Browse files
committed
[apperance] fix edge color when using node's color
Fix #190
1 parent f5cd542 commit 9fb6e3b

File tree

1 file changed

+7
-4
lines changed
  • packages/gephi-lite/src/core/appearance

1 file changed

+7
-4
lines changed

packages/gephi-lite/src/core/appearance/utils.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,20 +194,23 @@ export function makeGetColor<
194194
? (id?: string) => id && fullGraph.source(id)
195195
: (id?: string) => id && fullGraph.target(id);
196196

197-
if (getNodeColor && nodesColor.type !== "data")
197+
if (getNodeColor) {
198+
const nodesValues = mergeStaticDynamicData(nodeData, dynamicNodeData);
198199
getColor = (_, edgeId?: string) => {
199200
const node = nodeForColor(edgeId);
200-
return node ? getNodeColor(itemsValues[node]) : DEFAULT_NODE_COLOR;
201+
return node ? getNodeColor(nodesValues[node]) : DEFAULT_NODE_COLOR;
201202
};
202-
else if (nodesColor.type === "data")
203+
} else if (nodesColor.type === "data") {
203204
// special case when node are colored by data have to reach nodeRenderingData instead of normal getNodeColor
204205
getColor = (_, edgeId?: string) => {
205206
const node = nodeForColor(edgeId);
206207
return node && nodeRenderingData[node] && nodeRenderingData[node].color
207208
? nodeRenderingData[node].color || DEFAULT_NODE_COLOR
208209
: DEFAULT_NODE_COLOR;
209210
};
210-
else getColor = () => DEFAULT_EDGE_COLOR;
211+
} else {
212+
getColor = () => DEFAULT_EDGE_COLOR;
213+
}
211214
}
212215

213216
if (getColor && shadingDef) {

0 commit comments

Comments
 (0)