Browse Source

updated the fixed property of Nodes. You can now always unfix it with allowedToMove #303

v3_develop
Alex de Mulder 10 years ago
parent
commit
4fa0b995bc
6 changed files with 25194 additions and 25435 deletions
  1. +25179
    -25414
      dist/vis.js
  2. +1
    -1
      dist/vis.min.css
  3. +1
    -11
      docs/graph2d.html
  4. +4
    -5
      examples/network/02_random_nodes.html
  5. +1
    -1
      lib/network/Network.js
  6. +8
    -3
      lib/network/Node.js

+ 25179
- 25414
dist/vis.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/vis.min.css
File diff suppressed because it is too large
View File


+ 1
- 11
docs/graph2d.html View File

@ -853,17 +853,7 @@ Graph2d.clear({options: true}); // clear options only
</p>
<p>
Here an example on how to listen for a <code>rangeChanged</code> event.
</p>
<pre class="prettyprint lang-js">
Graph2d.on('select', function (properties) {
alert('selected items: ' + properties.nodes);
});
</pre>
<p>
A listener can be removed via the function <code>off</code>:
Here an example on how to listen for a <code>rangeChanged</code> event. A listener can be removed via the function <code>off</code>:
</p>
<pre class="prettyprint lang-js">

+ 4
- 5
examples/network/02_random_nodes.html View File

@ -30,7 +30,7 @@
// randomly create some nodes and edges
var nodeCount = document.getElementById('nodeCount').value;
for (var i = 0; i < nodeCount; i++) {
nodes.push({
nodes.push({
id: i,
label: String(i)
});
@ -69,26 +69,25 @@
connectionCount[to]++;
}
}
// create a network
var container = document.getElementById('mynetwork');
var data = {
nodes: nodes,
edges: edges
};
var options = {};
var options = {stabilization:false};
network = new vis.Network(container, data, options);
// add event listeners
network.on('select', function(params) {
document.getElementById('selection').innerHTML = 'Selection: ' + params.nodes;
console.log(params)
});
network.on('stabilized', function (params) {
document.getElementById('stabilization').innerHTML = 'Stabilization took ' + params.iterations + ' iterations.';
doFocus = false;
});
}
</script>
</head>

+ 1
- 1
lib/network/Network.js View File

@ -898,10 +898,10 @@ Network.prototype._handleOnDrag = function(event) {
return;
}
// remove the focus on node if it is focussed on by the focusOnNode
this.releaseNode();
var pointer = this._getPointer(event.gesture.center);
var me = this;
var drag = this.drag;
var selection = drag.selection;

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

@ -64,7 +64,6 @@ function Node(properties, imagelist, grouplist, networkConstants) {
this.damping = networkConstants.physics.damping; // written every time gravity is calculated
this.fixedData = {x:null,y:null};
this.setProperties(properties, constants);
// creating the variables for clustering
@ -183,8 +182,14 @@ Node.prototype.setProperties = function(properties, constants) {
}
}
this.xFixed = this.xFixed || (properties.x !== undefined && !properties.allowedToMoveX);
this.yFixed = this.yFixed || (properties.y !== undefined && !properties.allowedToMoveY);
if (properties.allowedToMoveX == true) {this.xFixed = false;}
else {this.xFixed = this.xFixed || (properties.x !== undefined && !properties.allowedToMoveX);}
if (properties.allowedToMoveY == true) {this.yFixed = false;}
else {this.yFixed = this.yFixed || (properties.y !== undefined && !properties.allowedToMoveY);}
this.radiusFixed = this.radiusFixed || (properties.radius !== undefined);
if (this.options.shape == 'image') {

Loading…
Cancel
Save