Updated renderOptions to add direction property

This commit is contained in:
saurabhg772244
2024-09-18 13:10:07 +05:30
parent 3f5afe8daf
commit be9123ee2b
5 changed files with 6 additions and 5 deletions

View File

@@ -37,7 +37,7 @@ export const render = async (
// Add the element to the DOM // Add the element to the DOM
if (!node.isGroup) { if (!node.isGroup) {
const childNodeEl = await insertNode(nodeEl, node, { config }); const childNodeEl = await insertNode(nodeEl, node, { config, dir: node.dir });
boundingBox = childNodeEl.node().getBBox(); boundingBox = childNodeEl.node().getBBox();
child.domId = childNodeEl; child.domId = childNodeEl;
child.width = boundingBox.width; child.width = boundingBox.width;

View File

@@ -87,7 +87,7 @@ const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, sit
// insertCluster(clusters, graph.node(v)); // insertCluster(clusters, graph.node(v));
} else { } else {
log.info('Node - the non recursive path', v, node.id, node); 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 });
} }
} }
}) })

View File

@@ -125,7 +125,7 @@ const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, sit
// insertCluster(clusters, graph.node(v)); // insertCluster(clusters, graph.node(v));
} else { } else {
log.trace('Node - the non recursive path XAX', v, nodes, graph.node(v), dir); 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 });
} }
} }
}) })

View File

@@ -1,11 +1,11 @@
import { getNodeClasses, updateNodeBounds } from './util.js'; import { getNodeClasses, updateNodeBounds } from './util.js';
import intersect from '../intersect/index.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 type { SVG } from '../../../diagram-api/types.js';
import rough from 'roughjs'; import rough from 'roughjs';
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js'; 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); const { nodeStyles } = styles2String(node);
node.label = ''; node.label = '';
const shapeSvg = parent const shapeSvg = parent

View File

@@ -143,4 +143,5 @@ export type LayoutMethod =
export interface RenderOptions { export interface RenderOptions {
config: MermaidConfig; config: MermaidConfig;
dir: string;
} }