From 830fe47776fa591f988dcaa50e4bc2209c528055 Mon Sep 17 00:00:00 2001 From: Rene Heindl Date: Tue, 17 Feb 2015 11:33:54 +0100 Subject: [PATCH 1/2] Changed resizing for icons --- lib/network/Node.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/network/Node.js b/lib/network/Node.js index e2270121..0c35d9a2 100644 --- a/lib/network/Node.js +++ b/lib/network/Node.js @@ -1015,19 +1015,19 @@ Node.prototype._drawText = function (ctx) { Node.prototype._resizeIcon = function (ctx) { if (!this.width) { var margin = 5; - var textSize = + var iconSize = { - width: 1, + width: Number(this.options.iconSize), height: Number(this.options.iconSize) + 4 }; - this.width = textSize.width + 2 * margin; - this.height = textSize.height + 2 * margin; + this.width = iconSize.width + 2 * margin; + this.height = iconSize.height + 2 * margin; // scaling used for clustering this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor; this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor; this.options.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor; - this.growthIndicator = this.width - (textSize.width + 2 * margin); + this.growthIndicator = this.width - (iconSize.width + 2 * margin); } }; From dfef167e0829504b70ad9e48778140cd2c82df43 Mon Sep 17 00:00:00 2001 From: Rene Heindl Date: Tue, 17 Feb 2015 12:20:59 +0100 Subject: [PATCH 2/2] Added icon-text-spacing --- lib/network/Node.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/network/Node.js b/lib/network/Node.js index 0c35d9a2..2d4c3aed 100644 --- a/lib/network/Node.js +++ b/lib/network/Node.js @@ -1018,7 +1018,7 @@ Node.prototype._resizeIcon = function (ctx) { var iconSize = { width: Number(this.options.iconSize), - height: Number(this.options.iconSize) + 4 + height: Number(this.options.iconSize) }; this.width = iconSize.width + 2 * margin; this.height = iconSize.height + 2 * margin; @@ -1048,7 +1048,8 @@ Node.prototype._drawIcon = function (ctx) { this.boundingBox.bottom = this.y + this.options.iconSize/2; if (this.label) { - this._label(ctx, this.label, this.x, this.y + this.height / 2, 'top', true); + var iconTextSpacing = 5; + this._label(ctx, this.label, this.x, this.y + this.height / 2 + iconTextSpacing, 'top', true); this.boundingBox.left = Math.min(this.boundingBox.left, this.labelDimensions.left); this.boundingBox.right = Math.max(this.boundingBox.right, this.labelDimensions.left + this.labelDimensions.width);