Skip to content

Commit

Permalink
Update grapher.js (#1355)
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Sep 14, 2024
1 parent 000b313 commit 3e57dbc
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions source/grapher.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ grapher.Graph = class {
const element = document.createElementNS('http://www.w3.org/2000/svg', 'g');
element.setAttribute('id', name);
element.setAttribute('class', name);
origin.appendChild(element);
return element;
};

Expand Down Expand Up @@ -191,6 +190,18 @@ grapher.Graph = class {
edge.label.build(document, edgePathGroup, edgeLabelGroup);
this._focusable.set(edge.label.hitTest, edge.label);
}
origin.appendChild(clusterGroup);
origin.appendChild(edgePathGroup);
origin.appendChild(edgeLabelGroup);
origin.appendChild(nodeGroup);
for (const edge of this.edges.values()) {
if (edge.label.labelElement) {
const label = edge.label;
const box = label.labelElement.getBBox();
label.width = box.width;
label.height = box.height;
}
}
}

measure() {
Expand Down Expand Up @@ -857,9 +868,6 @@ grapher.Edge = class {
this.labelElement.setAttribute('id', `edge-label-${this.id}`);
}
edgeLabelGroupElement.appendChild(this.labelElement);
const edgeBox = this.labelElement.getBBox();
this.width = edgeBox.width;
this.height = edgeBox.height;
}
}

Expand Down

0 comments on commit 3e57dbc

Please sign in to comment.