Skip to content

Commit 295789f

Browse files
authored
[UI] Use elkjs bundled (#670)
1 parent 5fecad2 commit 295789f

File tree

1 file changed

+5
-7
lines changed
  • web/client/src/library/components/graph

1 file changed

+5
-7
lines changed

web/client/src/library/components/graph/help.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ELK from 'elkjs/lib/elk-api'
1+
import ELK from 'elkjs/lib/elk.bundled.js'
22
import { MarkerType } from 'reactflow'
33
import { isArrayNotEmpty } from '../../../utils'
44

@@ -48,9 +48,7 @@ interface GraphOptions {
4848
algorithm?: string
4949
}
5050

51-
const elk = new ELK({
52-
workerUrl: '/node_modules/elkjs/lib/elk-worker.min.js',
53-
})
51+
const elk = new ELK()
5452

5553
const ALGORITHM_LAYERED = 'layered'
5654

@@ -87,7 +85,7 @@ export async function getNodesAndEdges({
8785
const layout = await elk.layout(graph)
8886
const nodes: GraphNode[] = []
8987

90-
layout.children?.forEach((node, idx: number) => {
88+
layout.children?.forEach(node => {
9189
const output = nodesMap[node.id]
9290

9391
if (output == null) return
@@ -101,8 +99,8 @@ export async function getNodesAndEdges({
10199
}
102100

103101
output.position = {
104-
x: node.x == null ? 0 : -node.x,
105-
y: node.y == null ? 0 : -node.y,
102+
x: node.x == null ? 0 : -node.x * 2,
103+
y: node.y == null ? 0 : -node.y * 1.5,
106104
}
107105

108106
nodes.push(output)

0 commit comments

Comments
 (0)