Browse Source

- Added getBoundingBox method.

v3_develop
Alex de Mulder 10 years ago
parent
commit
a5151bf65a
4 changed files with 21 additions and 0 deletions
  1. +1
    -0
      HISTORY.md
  2. +7
    -0
      dist/vis.js
  3. +6
    -0
      docs/network.html
  4. +7
    -0
      lib/network/Network.js

+ 1
- 0
HISTORY.md View File

@ -22,6 +22,7 @@ http://visjs.org
- Fixed error in repulsion physics model. - Fixed error in repulsion physics model.
- Improved physics handling for smoother network simulation. - Improved physics handling for smoother network simulation.
- Fixed infinite loop when an image can not be found and no brokenImage is provided. - Fixed infinite loop when an image can not be found and no brokenImage is provided.
- Added getBoundingBox method.
### Graph2d ### Graph2d

+ 7
- 0
dist/vis.js View File

@ -25134,6 +25134,13 @@ return /******/ (function(modules) { // webpackBootstrap
return this.DOMtoCanvas({x: 0.5 * this.frame.canvas.clientWidth, y: 0.5 * this.frame.canvas.clientHeight}); return this.DOMtoCanvas({x: 0.5 * this.frame.canvas.clientWidth, y: 0.5 * this.frame.canvas.clientHeight});
}; };
Network.prototype.getBoundingBox = function(nodeId) {
if (this.nodes[nodeId] !== undefined) {
return this.nodes[nodeId].boundingBox;
}
}
module.exports = Network; module.exports = Network;

+ 6
- 0
docs/network.html View File

@ -2155,6 +2155,12 @@ var options = {
<td>Returns the x and y coodinates of the center of the screen (in canvas space). <td>Returns the x and y coodinates of the center of the screen (in canvas space).
</td> </td>
</tr> </tr>
<tr>
<td>getBoundingBox()</td>
<td>Object</td>
<td>Returns a bounding box for the node including label in the format: {top:Number,left:Number,right:Number,bottom:Number}. These values are in canvas space.
</td>
</tr>
<tr> <tr>
<td>getSelection()</td> <td>getSelection()</td>
<td>Array of ids</td> <td>Array of ids</td>

+ 7
- 0
lib/network/Network.js View File

@ -2649,4 +2649,11 @@ Network.prototype.getCenterCoordinates = function () {
return this.DOMtoCanvas({x: 0.5 * this.frame.canvas.clientWidth, y: 0.5 * this.frame.canvas.clientHeight}); return this.DOMtoCanvas({x: 0.5 * this.frame.canvas.clientWidth, y: 0.5 * this.frame.canvas.clientHeight});
}; };
Network.prototype.getBoundingBox = function(nodeId) {
if (this.nodes[nodeId] !== undefined) {
return this.nodes[nodeId].boundingBox;
}
}
module.exports = Network; module.exports = Network;

Loading…
Cancel
Save