Browse Source

renamed getEdges to getConnectedEdges, made getConnectedNodes also work for edges

flowchartTest
Alex de Mulder 9 years ago
parent
commit
7099dd13f7
4 changed files with 6910 additions and 6875 deletions
  1. +6885
    -6866
      dist/vis.js
  2. +7
    -6
      docs/network/index.html
  3. +8
    -1
      lib/network/Network.js
  4. +10
    -2
      lib/network/modules/EdgesHandler.js

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


+ 7
- 6
docs/network/index.html View File

@ -715,7 +715,7 @@ var locales = {
<tr class="subHeader">
<td colspan="2">Methods to get information on nodes.</td>
<td colspan="2">Methods to get information on nodes and edges.</td>
</tr>
<tr class="collapsible toggle" onclick="toggleTable('methodTable','getPositions', this);">
<td colspan="2"><span parent="getPositions" class="right-caret"></span> getPositions(<code><i>[Array of
@ -787,19 +787,20 @@ var locales = {
</tr>
<tr class="collapsible toggle" onclick="toggleTable('methodTable','getConnectedNodes', this);">
<td colspan="2"><span parent="getConnectedNodes" class="right-caret"></span> getConnectedNodes(<code><i>String
nodeId</i></code>)
nodeId or edgeId</i></code>)
</td>
</tr>
<tr class="hidden" parent="getConnectedNodes">
<td class="midMethods">Returns: Array</td>
<td>Returns an array of nodeIds of the all the nodes that are directly connected to this node.</td>
<td>Returns an array of nodeIds of the all the nodes that are directly connected to this node. If you supply an edgeId,
vis will first match the id to nodes. If no match is found, it will search in the edgelist and return an array: <code>[fromId, toId]</code>.</td>
</tr>
<tr class="collapsible toggle" onclick="toggleTable('methodTable','getEdges', this);">
<td colspan="2"><span parent="getEdges" class="right-caret"></span> getEdges(<code><i>String
<tr class="collapsible toggle" onclick="toggleTable('methodTable','getConnectedEdges', this);">
<td colspan="2"><span parent="getConnectedEdges" class="right-caret"></span> getConnectedEdges(<code><i>String
nodeId</i></code>)
</td>
</tr>
<tr class="hidden" parent="getEdges">
<tr class="hidden" parent="getConnectedEdges">
<td class="midMethods">Returns: Array</td>
<td>Returns an array of edgeIds of the edges connected to this node.</td>
</tr>

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

@ -449,7 +449,14 @@ Network.prototype.deleteSelected = function() {return this.manipulation.del
Network.prototype.getPositions = function() {return this.nodesHandler.getPositions.apply(this.nodesHandler,arguments);};
Network.prototype.storePositions = function() {return this.nodesHandler.storePositions.apply(this.nodesHandler,arguments);};
Network.prototype.getBoundingBox = function() {return this.nodesHandler.getBoundingBox.apply(this.nodesHandler,arguments);};
Network.prototype.getConnectedNodes = function() {return this.nodesHandler.getConnectedNodes.apply(this.nodesHandler,arguments);};
Network.prototype.getConnectedNodes = function(objectId) {
if (this.body.nodes[objectId] !== undefined) {
return this.nodesHandler.getConnectedNodes.apply(this.nodesHandler,arguments);
}
else {
return this.edgesHandler.getConnectedNodes.apply(this.edgesHandler,arguments);
}
};
Network.prototype.getEdges = function() {return this.nodesHandler.getEdges.apply(this.nodesHandler,arguments);};
Network.prototype.startSimulation = function() {return this.physics.startSimulation.apply(this.physics,arguments);};
Network.prototype.stopSimulation = function() {return this.physics.stopSimulation.apply(this.physics,arguments);};

+ 10
- 2
lib/network/modules/EdgesHandler.js View File

@ -341,8 +341,6 @@ class EdgesHandler {
}
}
/**
* Reconnect all edges
* @private
@ -369,6 +367,16 @@ class EdgesHandler {
}
getConnectedNodes(edgeId) {
let nodeList = [];
if (this.body.edges[edgeId] !== undefined) {
let edge = this.body.edges[edgeId];
if (edge.fromId) {nodeList.push(edge.fromId);}
if (edge.toId) {nodeList.push(edge.toId);}
}
return nodeList;
}
}
export default EdgesHandler;

Loading…
Cancel
Save