mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 22:39:26 +02:00
Updated renderOptions to add direction property
This commit is contained in:
@@ -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;
|
||||||
|
@@ -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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@@ -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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@@ -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
|
||||||
|
@@ -143,4 +143,5 @@ export type LayoutMethod =
|
|||||||
|
|
||||||
export interface RenderOptions {
|
export interface RenderOptions {
|
||||||
config: MermaidConfig;
|
config: MermaidConfig;
|
||||||
|
dir: string;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user