Browse Source

Fix in positioning of text label of node

v3_develop
jos 10 years ago
parent
commit
f6655c0014
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      lib/network/Node.js

+ 2
- 2
lib/network/Node.js View File

@ -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};

Loading…
Cancel
Save