mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-11-24 17:51:51 +08:00
fix: bind topology node coordinates to G6 styles
This commit is contained in:
1 parent
3e04b68e38
commit
67c0aee483
1 file changed
+6
@@ -218,6 +218,10 @@ type G6NodeDatum = {
|
||||
active: boolean;
|
||||
x: number;
|
||||
y: number;
|
||||
// G6 v5 reads the initial position from style.x/style.y. Keeping the
|
||||
// coordinates on the datum alone makes every node start at (0, 0), after
|
||||
// which fitView magnifies one node and hides the rest.
|
||||
style: { x: number; y: number };
|
||||
};
|
||||
|
||||
type G6EdgeDatum = { source: string; target: string; active: boolean };
|
||||
@@ -276,6 +280,7 @@ function toG6Nodes(renderNodes: RenderNode[], activeKeys: Set<string>): G6NodeDa
|
||||
lbl: `还有 ${rn.hidden.length} 个${kindMeta[rn.kind].label}`,
|
||||
size: 24,
|
||||
active: activeKeys.has(rn.key),
|
||||
style: { x: position.x, y: position.y },
|
||||
...position,
|
||||
};
|
||||
}
|
||||
@@ -288,6 +293,7 @@ function toG6Nodes(renderNodes: RenderNode[], activeKeys: Set<string>): G6NodeDa
|
||||
lbl: trunc(graphLabel(rn.node) || kindMeta[rn.kind].label),
|
||||
size: kindMeta[rn.kind].size,
|
||||
active: activeKeys.has(rn.key),
|
||||
style: { x: position.x, y: position.y },
|
||||
...position,
|
||||
};
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user