mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-25 18:30:10 +02:00
Fix support for fixed layout for flowchart
This commit is contained in:
@@ -16,7 +16,13 @@ export const getClasses = function (
|
||||
return diagramObj.db.getClasses();
|
||||
};
|
||||
|
||||
export const draw = async function (text: string, id: string, _version: string, diag: any) {
|
||||
export const draw = async function (
|
||||
text: string,
|
||||
id: string,
|
||||
_version: string,
|
||||
diag: any,
|
||||
positions: any
|
||||
) {
|
||||
log.info('REF0:');
|
||||
log.info('Drawing state diagram (v2)', id);
|
||||
const { securityLevel, flowchart: conf, layout } = getConfig();
|
||||
@@ -41,6 +47,7 @@ export const draw = async function (text: string, id: string, _version: string,
|
||||
|
||||
data4Layout.type = diag.type;
|
||||
data4Layout.layoutAlgorithm = getRegisteredLayoutAlgorithm(layout);
|
||||
|
||||
if (data4Layout.layoutAlgorithm === 'dagre' && layout === 'elk') {
|
||||
log.warn(
|
||||
'flowchart-elk was moved to an external package in Mermaid v11. Please refer [release notes](https://github.com/mermaid-js/mermaid/releases/tag/v11.0.0) for more details. This diagram will be rendered using `dagre` layout as a fallback.'
|
||||
@@ -53,7 +60,7 @@ export const draw = async function (text: string, id: string, _version: string,
|
||||
|
||||
data4Layout.diagramId = id;
|
||||
log.debug('REF1:', data4Layout);
|
||||
await render(data4Layout, svg);
|
||||
await render(data4Layout, svg, positions);
|
||||
const padding = data4Layout.config.flowchart?.diagramPadding ?? 8;
|
||||
utils.insertTitle(
|
||||
svg,
|
||||
|
Reference in New Issue
Block a user