update(edges): filter edges of hidden nodes

* we don't want to show edges that go seemingly nowhere

Signed-off-by: bcakmakoglu <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
bcakmakoglu
2022-03-08 16:34:50 +01:00
parent 46a63c29aa
commit c31deb897d
2 changed files with 5 additions and 5 deletions
+1 -4
View File
@@ -32,10 +32,7 @@ const connectionLineVisible = controlledComputed(
store.connectionHandleType
),
)
const groups = controlledComputed(
() => store.getEdges,
() => groupEdgesByZLevel(store.getEdges, store.getNodes),
)
const groups = computed(() => groupEdgesByZLevel(store.getEdges, store.getNodes))
</script>
<script lang="ts">
export default {
+4 -1
View File
@@ -44,7 +44,8 @@ export default (state: State): ComputedGetters => {
const getEdges = computed<GraphEdge[]>(() => {
if (state.paneReady && state.dimensions.width && state.dimensions.height) {
if (!state.onlyRenderVisibleElements) return state.edges.filter((e) => !e.hidden)
if (!state.onlyRenderVisibleElements)
return state.edges.filter((e) => !e.hidden && !e.targetNode.hidden && !e.sourceNode.hidden)
else
return state.edges.filter(
(e) =>
@@ -53,6 +54,8 @@ export default (state: State): ComputedGetters => {
e.sourceNode.dimensions.height &&
e.targetNode.dimensions.width &&
e.targetNode.dimensions.height &&
!e.targetNode.hidden &&
!e.sourceNode.hidden &&
isEdgeVisible({
sourcePos: e.sourceNode.computedPosition || { x: 0, y: 0 },
targetPos: e.targetNode.computedPosition || { x: 0, y: 0 },