fix: node not updating handlebounds when handle pos changes

* watch source & target pos and update node dimensions on next tick
This commit is contained in:
Braks
2021-10-22 08:16:32 +02:00
parent 9532615cfd
commit 26b3901bd5
4 changed files with 44 additions and 25 deletions
+15 -2
View File
@@ -3,7 +3,18 @@ import dagre from 'dagre'
import initialElements from './initial-elements'
import './layouting.css'
import Flow, { Controls, addEdge, Connection, Edge, Elements, isNode, NodeExtent, Position, removeElements } from '~/index'
import Flow, {
Controls,
addEdge,
ConnectionMode,
Connection,
Edge,
Elements,
isNode,
NodeExtent,
Position,
removeElements,
} from '~/index'
const dagreGraph = new dagre.graphlib.Graph()
dagreGraph.setDefaultEdgeLabel(() => ({}))
@@ -42,6 +53,7 @@ const onLayout = (direction: string) => {
return el
})
console.log(elements.value)
}
</script>
<template>
@@ -49,9 +61,10 @@ const onLayout = (direction: string) => {
<Flow
:elements="elements"
:node-extent="nodeExtent"
:connection-mode="ConnectionMode.Loose"
@connect="onConnect"
@clements-remove="onElementsRemove"
@load="() => onLayout('LR')"
@load="() => onLayout('TB')"
>
<Controls />
</Flow>