Skip to content

Commit

Permalink
fix(nodes): update labels on constraint change (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomaash committed Jan 18, 2020
1 parent d10717b commit 2538650
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/network/modules/NodesHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,15 @@ class NodesHandler {
}
}

// update the font in all nodes
if (options.font !== undefined) {
for (let nodeId in this.body.nodes) {
if (this.body.nodes.hasOwnProperty(nodeId)) {
this.body.nodes[nodeId].updateLabelModule();
this.body.nodes[nodeId].needsRefresh();
}
// Update the labels of nodes if any relevant options changed.
if (
typeof options.font !== "undefined" ||
typeof options.widthConstraint !== "undefined" ||
typeof options.heightConstraint !== "undefined"
) {
for (let nodeId of Object.keys(this.body.nodes)) {
this.body.nodes[nodeId].updateLabelModule();
this.body.nodes[nodeId].needsRefresh();
}
}

Expand Down

0 comments on commit 2538650

Please sign in to comment.