Fixed configuration override on subgraphs
There was an issue with overriding the subgraphs with the main graphs direction which this commit fixes. It only overrides `rankdir` on the `setGraph` function so that the subgraph preserves it's `rankdir`. There is likely a better way of doing this by modifying the initialization of subgraph configuration to match the main graph when it comes to other elements in the JSON object which composes the graph label. As we modify the codebase this added line can be deprecated once we add more modular control to subgraphs such as allowing custom spacing or configurations for them. As `rankdir` is the only thing one can set with the `direction` keyword that is the only variable being overwritten for now.
This commit is contained in:
parent
a5ecc7a06d
commit
f693084065
|
@ -53,7 +53,10 @@ const recursiveRender = async (_elem, graph, diagramtype, id, parentCluster) =>
|
|||
// const children = graph.children(v);
|
||||
log.info('Cluster identified', v, node.width, graph.node(v));
|
||||
// node.graph.setGraph applies the graph configurations such as nodeSpacing to subgraphs as without this the default values would be used
|
||||
node.graph.setGraph(graph.graph());
|
||||
// We override the `rankdir` variable to allow for the subgraph's direction to override the graphs direction in the subgraph
|
||||
node.graph.setGraph({...graph.graph(), rankdir: node.graph.graph().rankdir});
|
||||
|
||||
|
||||
const o = await recursiveRender(nodes, node.graph, diagramtype, id, graph.node(v));
|
||||
const newEl = o.elem;
|
||||
updateNodeBounds(node, newEl);
|
||||
|
|
Loading…
Reference in New Issue