mirror of
https://github.com/projectstorm/react-diagrams.git
synced 2026-03-13 09:50:09 +08:00
use top left instead of center with dagre
This commit is contained in:
@@ -41,7 +41,9 @@ class DemoWidget extends React.Component<{ model: DiagramModel; engine: DiagramE
|
||||
this.engine = new DagreEngine({
|
||||
graph: {
|
||||
rankdir: 'RL',
|
||||
ranker: 'longest-path'
|
||||
ranker: 'longest-path',
|
||||
marginx:25,
|
||||
marginy:25
|
||||
},
|
||||
includeLinks: true
|
||||
});
|
||||
|
||||
@@ -59,7 +59,7 @@ export class DagreEngine {
|
||||
|
||||
g.nodes().forEach(v => {
|
||||
const node = g.node(v);
|
||||
model.getNode(v).setPosition(node.x, node.y);
|
||||
model.getNode(v).setPosition(node.x - (node.width / 2), node.y - (node.height / 2));
|
||||
});
|
||||
|
||||
// also include links?
|
||||
|
||||
Reference in New Issue
Block a user