feat: highlight upstream/downstream edges when node selected
This commit is contained in:
@@ -47,12 +47,22 @@ function makeNodes() {
|
||||
}
|
||||
|
||||
function makeEdges() {
|
||||
return props.sceneEdges.map((e) => ({
|
||||
id: e.id,
|
||||
source: e.source,
|
||||
target: e.target,
|
||||
label: e.label ?? '',
|
||||
}))
|
||||
return props.sceneEdges.map((e) => {
|
||||
const isUp = props.selectedNodeId != null && e.target === props.selectedNodeId
|
||||
const isDown = props.selectedNodeId != null && e.source === props.selectedNodeId
|
||||
return {
|
||||
id: e.id,
|
||||
source: e.source,
|
||||
target: e.target,
|
||||
label: e.label ?? '',
|
||||
animated: isUp || isDown,
|
||||
style: isUp
|
||||
? { stroke: '#ff9800', strokeWidth: 2 }
|
||||
: isDown
|
||||
? { stroke: '#4fc3f7', strokeWidth: 2 }
|
||||
: undefined,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
let prevNodeCount = -1
|
||||
|
||||
Reference in New Issue
Block a user