Browse Source

added bounding box to image node style

v3_develop
Alex de Mulder 10 years ago
parent
commit
af0259cb8e
2 changed files with 24 additions and 6 deletions
  1. +12
    -3
      dist/vis.js
  2. +12
    -3
      lib/network/Node.js

+ 12
- 3
dist/vis.js View File

@ -26715,7 +26715,16 @@ return /******/ (function(modules) { // webpackBootstrap
yLabel = this.y;
}
this.boundingBox.top = this.top;
this.boundingBox.left = this.left;
this.boundingBox.right = this.left + this.width;
this.boundingBox.bottom = this.top + this.height;
this._label(ctx, this.label, this.x, yLabel, undefined, "top");
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.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelDimensions.height);
};
@ -27021,9 +27030,9 @@ return /******/ (function(modules) { // webpackBootstrap
if (this.label) {
this._label(ctx, this.label, this.x, this.y + this.height / 2, undefined, '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)
this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelDimensions.height)
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.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelDimensions.height);
}
};

+ 12
- 3
lib/network/Node.js View File

@ -565,7 +565,16 @@ Node.prototype._drawImage = function (ctx) {
yLabel = this.y;
}
this.boundingBox.top = this.top;
this.boundingBox.left = this.left;
this.boundingBox.right = this.left + this.width;
this.boundingBox.bottom = this.top + this.height;
this._label(ctx, this.label, this.x, yLabel, undefined, "top");
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.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelDimensions.height);
};
@ -871,9 +880,9 @@ Node.prototype._drawShape = function (ctx, shape) {
if (this.label) {
this._label(ctx, this.label, this.x, this.y + this.height / 2, undefined, '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)
this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelDimensions.height)
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.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelDimensions.height);
}
};

Loading…
Cancel
Save