Skip to content

Commit

Permalink
Merge from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishjain0512 committed Aug 13, 2024
2 parents 8f5f7fc + c5eb07c commit ef895a3
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,15 @@ const shapes = {
divider,
};

let clusterElems = {};
let clusterElems = new Map();

export const insertCluster = (elem, node) => {
export const insertCluster = async (elem, node) => {
const shape = node.shape || 'rect';
const cluster = shapes[shape](elem, node);
clusterElems[node.id] = cluster;
const cluster = await shapes[shape](elem, node);
clusterElems.set(node.id, cluster);
return cluster;
};

export const getClusterTitleWidth = (elem, node) => {
const label = createLabel(node.label, node.labelStyle, undefined, true);
elem.node().appendChild(label);
Expand All @@ -374,7 +375,7 @@ export const getClusterTitleWidth = (elem, node) => {
};

export const clear = () => {
clusterElems = {};
clusterElems = new Map();
};

export const positionCluster = (node) => {
Expand All @@ -390,8 +391,8 @@ export const positionCluster = (node) => {
', ' +
node?.height +
')',
clusterElems[node.id]
clusterElems.get(node.id)
);
const el = clusterElems[node.id];
const el = clusterElems.get(node.id);
el.cluster.attr('transform', 'translate(' + node.x + ', ' + node.y + ')');
};

0 comments on commit ef895a3

Please sign in to comment.