Skip to content

Commit

Permalink
Updated renderOptions to add direction property
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabhg772244 committed Sep 18, 2024
1 parent 3f5afe8 commit be9123e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/mermaid-layout-elk/src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const render = async (

// Add the element to the DOM
if (!node.isGroup) {
const childNodeEl = await insertNode(nodeEl, node, { config });
const childNodeEl = await insertNode(nodeEl, node, { config, dir: node.dir });
boundingBox = childNodeEl.node().getBBox();
child.domId = childNodeEl;
child.width = boundingBox.width;
Expand Down
2 changes: 1 addition & 1 deletion packages/mermaid/src/dagre-wrapper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, sit
// insertCluster(clusters, graph.node(v));
} else {
log.info('Node - the non recursive path', v, node.id, node);
await insertNode(nodes, graph.node(v), { config: siteConfig });
await insertNode(nodes, graph.node(v), { config: siteConfig, dir });
}
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, sit
// insertCluster(clusters, graph.node(v));
} else {
log.trace('Node - the non recursive path XAX', v, nodes, graph.node(v), dir);
await insertNode(nodes, graph.node(v), { config: siteConfig });
await insertNode(nodes, graph.node(v), { config: siteConfig, dir });
}
}
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { getNodeClasses, updateNodeBounds } from './util.js';
import intersect from '../intersect/index.js';
import type { Node } from '../../types.js';
import type { Node, RenderOptions } from '../../types.js';
import type { SVG } from '../../../diagram-api/types.js';
import rough from 'roughjs';
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';

export const forkJoin = (parent: SVG, node: Node, dir: string) => {
export const forkJoin = (parent: SVG, node: Node, { dir }: RenderOptions) => {
const { nodeStyles } = styles2String(node);
node.label = '';
const shapeSvg = parent
Expand Down
1 change: 1 addition & 0 deletions packages/mermaid/src/rendering-util/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,5 @@ export type LayoutMethod =

export interface RenderOptions {
config: MermaidConfig;
dir: string;
}

0 comments on commit be9123e

Please sign in to comment.