|
@ -136,7 +136,7 @@ Node.prototype.setProperties = function(properties, constants) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var fields = ['borderWidth','borderWidthSelected','shape','image','radius','fontColor', |
|
|
var fields = ['borderWidth','borderWidthSelected','shape','image','radius','fontColor', |
|
|
'fontSize','fontFace','group','mass' |
|
|
|
|
|
|
|
|
'fontSize','fontFace','fontFill','group','mass' |
|
|
]; |
|
|
]; |
|
|
util.selectiveDeepExtend(fields, this.options, properties); |
|
|
util.selectiveDeepExtend(fields, this.options, properties); |
|
|
|
|
|
|
|
@ -844,7 +844,6 @@ Node.prototype._drawText = function (ctx) { |
|
|
Node.prototype._label = function (ctx, text, x, y, align, baseline, labelUnderNode) { |
|
|
Node.prototype._label = function (ctx, text, x, y, align, baseline, labelUnderNode) { |
|
|
if (text && Number(this.options.fontSize) * this.networkScale > this.fontDrawThreshold) { |
|
|
if (text && Number(this.options.fontSize) * this.networkScale > this.fontDrawThreshold) { |
|
|
ctx.font = (this.selected ? "bold " : "") + this.options.fontSize + "px " + this.options.fontFace; |
|
|
ctx.font = (this.selected ? "bold " : "") + this.options.fontSize + "px " + this.options.fontFace; |
|
|
ctx.fillStyle = this.options.fontColor || "black"; |
|
|
|
|
|
ctx.textAlign = align || "center"; |
|
|
ctx.textAlign = align || "center"; |
|
|
ctx.textBaseline = baseline || "middle"; |
|
|
ctx.textBaseline = baseline || "middle"; |
|
|
|
|
|
|
|
@ -856,6 +855,18 @@ Node.prototype._label = function (ctx, text, x, y, align, baseline, labelUnderNo |
|
|
yLine = y + (1 - lineCount) / (2 * fontSize); |
|
|
yLine = y + (1 - lineCount) / (2 * fontSize); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// font fill from edges now for nodes!
|
|
|
|
|
|
if (this.options.fontFill !== undefined && this.options.fontFill !== null && this.options.fontFill !== "none") { |
|
|
|
|
|
var width = ctx.measureText(text).width; |
|
|
|
|
|
var height = this.options.fontSize; |
|
|
|
|
|
var left = x - width / 2; |
|
|
|
|
|
var top = y - height / 2; |
|
|
|
|
|
ctx.fillStyle = this.options.fontFill; |
|
|
|
|
|
ctx.fillRect(left, top, width, height); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// draw text
|
|
|
|
|
|
ctx.fillStyle = this.options.fontColor || "black"; |
|
|
for (var i = 0; i < lineCount; i++) { |
|
|
for (var i = 0; i < lineCount; i++) { |
|
|
ctx.fillText(lines[i], x, yLine); |
|
|
ctx.fillText(lines[i], x, yLine); |
|
|
yLine += fontSize; |
|
|
yLine += fontSize; |
|
|