Update node spacing
This commit is contained in:
parent
d4451a487c
commit
87206b1c43
|
@ -8,6 +8,7 @@
|
||||||
import { rolesToNodes, autoLayout } from "./layout"
|
import { rolesToNodes, autoLayout } from "./layout"
|
||||||
import { onMount, setContext } from "svelte"
|
import { onMount, setContext } from "svelte"
|
||||||
import Controls from "./Controls.svelte"
|
import Controls from "./Controls.svelte"
|
||||||
|
import { MaxAutoZoom } from "./constants"
|
||||||
|
|
||||||
const nodes = writable([])
|
const nodes = writable([])
|
||||||
const edges = writable([])
|
const edges = writable([])
|
||||||
|
@ -37,7 +38,7 @@
|
||||||
nodeTypes={{ role: RoleNode }}
|
nodeTypes={{ role: RoleNode }}
|
||||||
edgeTypes={{ role: RoleEdge }}
|
edgeTypes={{ role: RoleEdge }}
|
||||||
proOptions={{ hideAttribution: true }}
|
proOptions={{ hideAttribution: true }}
|
||||||
fitViewOptions={{ maxZoom: 1 }}
|
fitViewOptions={{ maxZoom: MaxAutoZoom }}
|
||||||
defaultEdgeOptions={{ type: "role", animated: true, selectable: false }}
|
defaultEdgeOptions={{ type: "role", animated: true, selectable: false }}
|
||||||
onconnectstart={() => dragging.set(true)}
|
onconnectstart={() => dragging.set(true)}
|
||||||
onconnectend={() => dragging.set(false)}
|
onconnectend={() => dragging.set(false)}
|
||||||
|
|
|
@ -79,7 +79,7 @@ const dagreLayout = ({ nodes, edges }) => {
|
||||||
dagreGraph.setGraph({
|
dagreGraph.setGraph({
|
||||||
rankdir: "LR",
|
rankdir: "LR",
|
||||||
ranksep: 200,
|
ranksep: 200,
|
||||||
nodesep: 100,
|
nodesep: 50,
|
||||||
})
|
})
|
||||||
nodes.forEach(node => {
|
nodes.forEach(node => {
|
||||||
dagreGraph.setNode(node.id, { width: NodeWidth, height: NodeHeight })
|
dagreGraph.setNode(node.id, { width: NodeWidth, height: NodeHeight })
|
||||||
|
|
Loading…
Reference in New Issue