#5237 Fix for async rendering of clusters

This commit is contained in:
Knut Sveidqvist 2024-06-20 14:54:49 +02:00
parent 6d91ae4a09
commit b69c9821bc

View File

@ -193,7 +193,8 @@ const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, sit
log.info('Need the size here XAX', graph.node('T1')?.height); log.info('Need the size here XAX', graph.node('T1')?.height);
let { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig); let { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);
subGraphTitleTotalMargin = 0; subGraphTitleTotalMargin = 0;
sortNodesByHierarchy(graph).forEach(function (v) { await Promise.all(
sortNodesByHierarchy(graph).map(async function (v) {
const node = graph.node(v); const node = graph.node(v);
const p = graph.node(node?.parentId); const p = graph.node(node?.parentId);
subGraphTitleTotalMargin = p?.offsetY || subGraphTitleTotalMargin; subGraphTitleTotalMargin = p?.offsetY || subGraphTitleTotalMargin;
@ -248,7 +249,7 @@ const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, sit
log.debug('OffsetY', offsetY, 'labelHeight', labelHeight, 'halfPadding', halfPadding); log.debug('OffsetY', offsetY, 'labelHeight', labelHeight, 'halfPadding', halfPadding);
// node.y += offsetY + (parent?.offsetY / 2 || 0); // node.y += offsetY + (parent?.offsetY / 2 || 0);
// node.offsetY = offsetY; // node.offsetY = offsetY;
insertCluster(clusters, node); await insertCluster(clusters, node);
// A cluster in the non-recursive way // A cluster in the non-recursive way
clusterDb[node.id].node = node; clusterDb[node.id].node = node;
@ -276,7 +277,8 @@ const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, sit
positionNode(node); positionNode(node);
} }
} }
}); })
);
// Move the edge labels to the correct place after layout // Move the edge labels to the correct place after layout
graph.edges().forEach(function (e) { graph.edges().forEach(function (e) {