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