From a4b0b93f56e01e6e11d513dd55b92a3b0a4f645e Mon Sep 17 00:00:00 2001 From: Rene Heindl Date: Mon, 16 Feb 2015 14:23:36 +0100 Subject: [PATCH] Added documentation and default values --- docs/network.html | 27 +++++++++++++++++++++++++-- lib/network/Node.js | 4 ++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/docs/network.html b/docs/network.html index d1c2e9af..dfbac7e0 100644 --- a/docs/network.html +++ b/docs/network.html @@ -1009,7 +1009,6 @@ mySize = minSize + diff * scale; 'white' The color of the label stroke. - shape string @@ -1018,7 +1017,7 @@ mySize = minSize + diff * scale; Choose from ellipse (default), circle, box, database, image, circularImage, label, dot, - star, triangle, triangleDown, and square. + star, triangle, triangleDown, square and icon.

In case of image and circularImage, a property with name image must @@ -1095,6 +1094,30 @@ mySize = minSize + diff * scale; The maximum radius for a scaled node. Only applicable to shapes dot, star, triangle, triangleDown, and square. This only does something if you supply a value. + + iconFontFace + String + undefined + Font face for icons, for example FontAwesome or Ionicon.
You have to link to the css defining the font by yourself (see Examples) + + + icon + String + undefined + Unicode of the icon f.e. \uf0c0 (user-icon in FontAwesome) + + + iconSize + Number + 50 + Size of the icon + + + color + String + black + Color of the icon + diff --git a/lib/network/Node.js b/lib/network/Node.js index 2e8cae93..e2270121 100644 --- a/lib/network/Node.js +++ b/lib/network/Node.js @@ -1033,6 +1033,10 @@ Node.prototype._resizeIcon = function (ctx) { Node.prototype._drawIcon = function (ctx) { this._resizeIcon(ctx); + + this.options.iconSize = this.options.iconSize || 50; + this.options.iconSize = this.options.iconSize || 50; + this.left = this.x - this.width / 2; this.top = this.y - this.height / 2; this._icon(ctx, this.options.icon, this.x, this.y);