mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 11:30:13 +08:00
feat: center the same layers
This commit is contained in:
1 parent
7a8df716da
commit
b19d6bf6e2
3 files changed
+55
-2
No files matched your search
@@ -53,12 +53,15 @@ const data = [
|
||||
},
|
||||
]
|
||||
|
||||
const marginX = 100
|
||||
const marginY = 100
|
||||
|
||||
const dag = new DAG(data)
|
||||
const nodes = dag.getNodes().map((node) => ({
|
||||
id: node._id,
|
||||
name: node.title,
|
||||
x: 50 * node.index,
|
||||
y: 100 * node.layer,
|
||||
x: marginX * node.index - (marginX * dag.getLayer(node._id)) / 2,
|
||||
y: marginY * node.layer,
|
||||
}))
|
||||
|
||||
const edges = dag.getEdgesArray().map((edge) => ({
|
||||
|
||||
Reference in new issue
Block a user