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

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

@ -898,10 +898,10 @@ Network.prototype._handleOnDrag = function(event) {
return; return;
} }
// remove the focus on node if it is focussed on by the focusOnNode
this.releaseNode(); this.releaseNode();
var pointer = this._getPointer(event.gesture.center); var pointer = this._getPointer(event.gesture.center);
var me = this; var me = this;
var drag = this.drag; var drag = this.drag;
var selection = drag.selection; 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.damping = networkConstants.physics.damping; // written every time gravity is calculated
this.fixedData = {x:null,y:null}; this.fixedData = {x:null,y:null};
this.setProperties(properties, constants); this.setProperties(properties, constants);
// creating the variables for clustering // 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); this.radiusFixed = this.radiusFixed || (properties.radius !== undefined);
if (this.options.shape == 'image') { if (this.options.shape == 'image') {

Loading…
Cancel
Save