mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 07:19:41 +02:00
Merge remote-tracking branch 'os_repo/5237-unified-layout-common-renderer' into alanaV11
This commit is contained in:
@@ -263,7 +263,7 @@ const calcOffset = function (src, dest, parentLookupDb) {
|
|||||||
/**
|
/**
|
||||||
* Add edges to graph based on parsed graph definition
|
* Add edges to graph based on parsed graph definition
|
||||||
*/
|
*/
|
||||||
export const addEdges = function (dataForLayout, graph, svg) {
|
export const addEdges = async function (dataForLayout, graph, svg) {
|
||||||
log.info('abc78 DAGA edges = ', dataForLayout);
|
log.info('abc78 DAGA edges = ', dataForLayout);
|
||||||
const edges = dataForLayout.edges;
|
const edges = dataForLayout.edges;
|
||||||
const labelsEl = svg.insert('g').attr('class', 'edgeLabels');
|
const labelsEl = svg.insert('g').attr('class', 'edgeLabels');
|
||||||
@@ -272,7 +272,8 @@ export const addEdges = function (dataForLayout, graph, svg) {
|
|||||||
let defaultStyle;
|
let defaultStyle;
|
||||||
let defaultLabelStyle;
|
let defaultLabelStyle;
|
||||||
|
|
||||||
edges.forEach(function (edge) {
|
await Promise.all(
|
||||||
|
edges.map(async function (edge) {
|
||||||
// Identify Link
|
// Identify Link
|
||||||
const linkIdBase = edge.id; // 'L-' + edge.start + '-' + edge.end;
|
const linkIdBase = edge.id; // 'L-' + edge.start + '-' + edge.end;
|
||||||
// count the links from+to the same node to give unique id
|
// count the links from+to the same node to give unique id
|
||||||
@@ -387,7 +388,7 @@ export const addEdges = function (dataForLayout, graph, svg) {
|
|||||||
edgeData.id = linkId;
|
edgeData.id = linkId;
|
||||||
edgeData.classes = 'flowchart-link ' + linkNameStart + ' ' + linkNameEnd;
|
edgeData.classes = 'flowchart-link ' + linkNameStart + ' ' + linkNameEnd;
|
||||||
|
|
||||||
const labelEl = insertEdgeLabel(labelsEl, edgeData);
|
const labelEl = await insertEdgeLabel(labelsEl, edgeData);
|
||||||
|
|
||||||
// calculate start and end points of the edge, note that the source and target
|
// calculate start and end points of the edge, note that the source and target
|
||||||
// can be modified for shapes that have ports
|
// can be modified for shapes that have ports
|
||||||
@@ -417,7 +418,8 @@ export const addEdges = function (dataForLayout, graph, svg) {
|
|||||||
],
|
],
|
||||||
edgeData,
|
edgeData,
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
|
);
|
||||||
return graph;
|
return graph;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -503,7 +505,7 @@ export const render = async (data4Layout, svg, element, algorithm) => {
|
|||||||
const edgesEl = svg.insert('g').attr('class', 'edges edgePath');
|
const edgesEl = svg.insert('g').attr('class', 'edges edgePath');
|
||||||
|
|
||||||
// Add the edges to the elk graph, this will entail creating the actual edges
|
// Add the edges to the elk graph, this will entail creating the actual edges
|
||||||
elkGraph = addEdges(data4Layout, elkGraph, svg);
|
elkGraph = await addEdges(data4Layout, elkGraph, svg);
|
||||||
|
|
||||||
// Iterate through all nodes and add the top level nodes to the graph
|
// Iterate through all nodes and add the top level nodes to the graph
|
||||||
const nodes = data4Layout.nodes;
|
const nodes = data4Layout.nodes;
|
||||||
|
@@ -256,12 +256,7 @@ const roundedWithTitle = async (parent, node) => {
|
|||||||
innerRect = shapeSvg.insert(() => roughInnerNode);
|
innerRect = shapeSvg.insert(() => roughInnerNode);
|
||||||
} else {
|
} else {
|
||||||
rect = outerRectG.insert('rect', ':first-child');
|
rect = outerRectG.insert('rect', ':first-child');
|
||||||
let outerRectClass = 'outer';
|
const outerRectClass = 'outer';
|
||||||
if (look === 'neo') {
|
|
||||||
outerRectClass = 'outer state-shadow-neo';
|
|
||||||
} else {
|
|
||||||
outerRectClass = 'outer';
|
|
||||||
}
|
|
||||||
|
|
||||||
// center the rect around its coordinate
|
// center the rect around its coordinate
|
||||||
rect
|
rect
|
||||||
|
Reference in New Issue
Block a user