Browse Source

Merge pull request #641 from Dude9177/develop

Fixed the width problem for icons wich made it difficult to click on them
v3_develop
Alex 9 years ago
parent
commit
ba6856d6cc
1 changed files with 8 additions and 7 deletions
  1. +8
    -7
      lib/network/Node.js

+ 8
- 7
lib/network/Node.js View File

@ -1015,19 +1015,19 @@ Node.prototype._drawText = function (ctx) {
Node.prototype._resizeIcon = function (ctx) { Node.prototype._resizeIcon = function (ctx) {
if (!this.width) { if (!this.width) {
var margin = 5; var margin = 5;
var textSize =
var iconSize =
{ {
width: 1,
height: Number(this.options.iconSize) + 4
width: Number(this.options.iconSize),
height: Number(this.options.iconSize)
}; };
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 // scaling used for clustering
this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor; this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor;
this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor; this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor;
this.options.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor; 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);
} }
}; };
@ -1047,7 +1047,8 @@ Node.prototype._drawIcon = function (ctx) {
this.boundingBox.bottom = this.y + this.options.iconSize/2; this.boundingBox.bottom = this.y + this.options.iconSize/2;
if (this.label) { 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.left = Math.min(this.boundingBox.left, this.labelDimensions.left);
this.boundingBox.right = Math.max(this.boundingBox.right, this.labelDimensions.left + this.labelDimensions.width); this.boundingBox.right = Math.max(this.boundingBox.right, this.labelDimensions.left + this.labelDimensions.width);

Loading…
Cancel
Save