Browse Source

Renamed option `dragGraph` to `dragNetwork`

css_transitions
jos 10 years ago
parent
commit
ee7f8ff7c3
3 changed files with 10 additions and 4 deletions
  1. +1
    -0
      HISTORY.md
  2. +1
    -1
      docs/network.html
  3. +8
    -3
      src/network/Network.js

+ 1
- 0
HISTORY.md View File

@ -20,6 +20,7 @@ http://visjs.org
- Renamed `Graph` to `Network` to prevent confusion with the visualizations - Renamed `Graph` to `Network` to prevent confusion with the visualizations
`Graph2d` and `Graph3d`. `Graph2d` and `Graph3d`.
- Renamed option `dragGraph` to `dragNetwork`.
- Now throws an error when constructing without new keyword. - Now throws an error when constructing without new keyword.
- Added pull request from Vukk, user can now define the edge width multiplier - Added pull request from Vukk, user can now define the edge width multiplier
when selected. when selected.

+ 1
- 1
docs/network.html View File

@ -857,7 +857,7 @@ var options = {
</td> </td>
</tr> </tr>
<tr> <tr>
<td>dragGraph</td>
<td>dragNetwork</td>
<td>Boolean</td> <td>Boolean</td>
<td>true</td> <td>true</td>
<td> <td>

+ 8
- 3
src/network/Network.js View File

@ -193,7 +193,7 @@ function Network (container, data, options) {
background: '#FFFFC6' background: '#FFFFC6'
} }
}, },
dragGraph: true,
dragNetwork: true,
dragNodes: true, dragNodes: true,
zoomable: true, zoomable: true,
hover: false hover: false
@ -536,11 +536,16 @@ Network.prototype.setOptions = function (options) {
if (options.freezeForStabilization !== undefined) {this.constants.freezeForStabilization = options.freezeForStabilization;} if (options.freezeForStabilization !== undefined) {this.constants.freezeForStabilization = options.freezeForStabilization;}
if (options.configurePhysics !== undefined){this.constants.configurePhysics = options.configurePhysics;} if (options.configurePhysics !== undefined){this.constants.configurePhysics = options.configurePhysics;}
if (options.stabilizationIterations !== undefined) {this.constants.stabilizationIterations = options.stabilizationIterations;} if (options.stabilizationIterations !== undefined) {this.constants.stabilizationIterations = options.stabilizationIterations;}
if (options.dragGraph !== undefined) {this.constants.dragGraph = options.dragGraph;}
if (options.dragNetwork !== undefined) {this.constants.dragNetwork = options.dragNetwork;}
if (options.dragNodes !== undefined) {this.constants.dragNodes = options.dragNodes;} if (options.dragNodes !== undefined) {this.constants.dragNodes = options.dragNodes;}
if (options.zoomable !== undefined) {this.constants.zoomable = options.zoomable;} if (options.zoomable !== undefined) {this.constants.zoomable = options.zoomable;}
if (options.hover !== undefined) {this.constants.hover = options.hover;} if (options.hover !== undefined) {this.constants.hover = options.hover;}
// TODO: deprecated since version 3.0.0. Cleanup some day
if (options.dragGraph !== undefined) {
throw new Error('Option dragGraph is renamed to dragNetwork');
}
if (options.labels !== undefined) { if (options.labels !== undefined) {
for (prop in options.labels) { for (prop in options.labels) {
if (options.labels.hasOwnProperty(prop)) { if (options.labels.hasOwnProperty(prop)) {
@ -994,7 +999,7 @@ Network.prototype._handleOnDrag = function(event) {
} }
} }
else { else {
if (this.constants.dragGraph == true) {
if (this.constants.dragNetwork == true) {
// move the network // move the network
var diffX = pointer.x - this.drag.pointer.x; var diffX = pointer.x - this.drag.pointer.x;
var diffY = pointer.y - this.drag.pointer.y; var diffY = pointer.y - this.drag.pointer.y;

Loading…
Cancel
Save