Skip to content

Commit

Permalink
After create node, set node size to max between label size and shape …
Browse files Browse the repository at this point in the history
…size.
  • Loading branch information
kanitw committed Aug 18, 2015
1 parent 40198f9 commit bdc4f83
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/create-nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ function createNodes(selection, g, shapes) {
labelGroup = thisGroup.append("g").attr("class", "label"),
labelDom = addLabel(labelGroup, node),
shape = shapes[node.shape],
bbox = _.pick(labelDom.node().getBBox(), "width", "height");
bbox = _.pick(labelDom.node().getBBox(), "width", "height"),
labelWidth = bbox.width,
labelHeight = bbox.height;

node.elem = this;

Expand All @@ -46,8 +48,8 @@ function createNodes(selection, g, shapes) {
util.applyStyle(shapeSvg, node.style);

var shapeBBox = shapeSvg.node().getBBox();
node.width = shapeBBox.width;
node.height = shapeBBox.height;
node.width = Math.max(shapeBBox.width, labelWidth);
node.height = Math.max(shapeBBox.height, labelHeight);
});

util.applyTransition(svgNodes.exit(), g)
Expand Down

0 comments on commit bdc4f83

Please sign in to comment.