diff --git a/docs/network/nodes.html b/docs/network/nodes.html index dfb0f3d6..3b167416 100644 --- a/docs/network/nodes.html +++ b/docs/network/nodes.html @@ -375,8 +375,8 @@ network.setOptions(options); font.textAlign String 'center' - If shape is box, this can be set to 'left' to make the label left-aligned. Otherwise, - defaults/resets to 'center'. + This can be set to 'left' to make the label left-aligned. Otherwise, + defaults to 'center'. group diff --git a/lib/network/modules/components/shared/Label.js b/lib/network/modules/components/shared/Label.js index 7dcc3846..e3983127 100644 --- a/lib/network/modules/components/shared/Label.js +++ b/lib/network/modules/components/shared/Label.js @@ -127,9 +127,9 @@ class Label { // configure context for drawing the text ctx.font = (selected && this.nodeOptions.labelHighlightBold ? 'bold ' : '') + fontSize + "px " + this.fontOptions.face; ctx.fillStyle = fontColor; - // When the shape is a box and the textAlign property is 'left', make label left-justified - if (this.options.shape === 'box' && this.options.font.textAlign === 'left') { - ctx.textAlign = 'left'; + // When the textAlign property is 'left', make label left-justified + if (this.options.font.textAlign === 'left') { + ctx.textAlign = this.options.font.textAlign; x = x - (this.size.wideth >> 1); // Shift label 1/2-way (>>1 == div by 2) left } else { ctx.textAlign = 'center';