diff --git a/lib/network/Node.js b/lib/network/Node.js index a1fe8704..e70ec7e1 100644 --- a/lib/network/Node.js +++ b/lib/network/Node.js @@ -878,7 +878,7 @@ Node.prototype._label = function (ctx, text, x, y, align, baseline, labelUnderNo var lines = text.split('\n'); var lineCount = lines.length; - var fontSize = (Number(this.options.fontSize) + 4); + var fontSize = (Number(this.options.fontSize) + 4); // TODO: why is this +4 ? var yLine = y + (1 - lineCount) / 2 * fontSize; if (labelUnderNode == true) { yLine = y + (1 - lineCount) / (2 * fontSize); @@ -893,7 +893,7 @@ Node.prototype._label = function (ctx, text, x, y, align, baseline, labelUnderNo var height = this.options.fontSize * lineCount; var left = x - width / 2; var top = y - height / 2; - if (ctx.textBaseline == "top") { + if (baseline == "top") { top += 0.5 * fontSize; } this.labelDimensions = {top:top,left:left,width:width,height:height,yLine:yLine};