refactor(core): use separate svg container for edges

This commit is contained in:
braks
2023-06-15 22:35:25 +02:00
committed by Braks
parent 5f7d439ee2
commit 8e5d748013
2 changed files with 35 additions and 30 deletions
+18
View File
@@ -170,3 +170,21 @@ export function groupEdgesByZLevel(edges: GraphEdge[], findNode: Actions['findNo
}
})
}
export function getEdgeZIndex(edge: GraphEdge, findNode: Actions['findNode'], elevateEdgesOnSelect = false) {
const hasZIndex = isNumber(edge.zIndex)
let z = hasZIndex ? edge.zIndex! : 0
const source = findNode(edge.source)
const target = findNode(edge.target)
if (!source || !target) {
return 0
}
if (elevateEdgesOnSelect) {
z = hasZIndex ? edge.zIndex! : Math.max(source.computedPosition.z || 0, target.computedPosition.z || 0)
}
return z
}