Skip to content
This repository was archived by the owner on Jul 29, 2019. It is now read-only.

Commit e17136a

Browse files
axizo-piyotamberk
authored andcommitted
Fix placement label for dot shape (#3018)
1 parent 79bb381 commit e17136a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/network/modules/components/nodes/util/ShapeBase.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ class ShapeBase extends NodeBase {
4747
ctx.restore();
4848

4949
if (this.options.label !== undefined) {
50-
let yLabel = y + 0.5 * this.height + 3; // the + 3 is to offset it a bit below the node.
50+
// Need to call following here in order to ensure value for `this.labelModule.size.height`
51+
this.labelModule.calculateLabelSize(ctx, selected, hover, x, y, 'hanging')
52+
let yLabel = y + 0.5 * this.height + 0.5 * this.labelModule.size.height;
5153
this.labelModule.draw(ctx, x, yLabel, selected, hover, 'hanging');
5254
}
5355

@@ -63,7 +65,7 @@ class ShapeBase extends NodeBase {
6365
if (this.options.label !== undefined && this.labelModule.size.width > 0) {
6466
this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left);
6567
this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width);
66-
this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelModule.size.height + 3);
68+
this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelModule.size.height);
6769
}
6870
}
6971

0 commit comments

Comments
 (0)