Browse Source

added edge selection and removed this.selection from the graph

css_transitions
Alex de Mulder 11 years ago
parent
commit
181516e2dd
6 changed files with 26 additions and 66 deletions
  1. +12
    -32
      dist/vis.js
  2. +1
    -1
      examples/graph/02_random_nodes.html
  3. +1
    -1
      examples/graph/18_fully_random_nodes_clustering.html
  4. +1
    -1
      examples/graph/19_scale_free_graph_clustering.html
  5. +1
    -1
      examples/graph/20_UI_example.html
  6. +10
    -30
      src/graph/SelectionMixin.js

+ 12
- 32
dist/vis.js View File

@ -4,8 +4,8 @@
*
* A dynamic, browser-based visualization library.
*
* @version 0.4.0-SNAPSHOT
* @date 2014-01-30
* @version @@version
* @date @@date
*
* @license
* Copyright (C) 2011-2014 Almende B.V, http://almende.com
@ -12581,23 +12581,11 @@ var SelectionMixin = {
* selected nodes.
*/
getSelection : function() {
var nodeIdString = this.getSelectedNodes();
/*
var edgeIdString = this.getSelectedEdges();
var nodeIds = this.getSelectedNodes();
var idString = "";
if (nodeIdString != "") {
idString = idString.concat("Nodes: ",nodeIdString);
var edgeIds = this.getSelectedEdges();
if (edgeIdString != "") {
idString = idString.concat("; ");
}
}
if (edgeIdString != "") {
idString = idString.concat("Edges: ",edgeIdString);
}
*/
return nodeIdString
return {nodes:nodeIds, edges:edgeIds};
},
/**
@ -12607,41 +12595,33 @@ var SelectionMixin = {
* selected nodes.
*/
getSelectedNodes : function() {
var idString = "", i = 0;
var idArray = [];
for(var objectId in this.selectionObj) {
if(this.selectionObj.hasOwnProperty(objectId)) {
if (this.selectionObj[objectId] instanceof Node) {
if (i != 0) {
idString = idString.concat(", ");
}
idString = idString.concat(String(objectId));
i++;
idArray.push(objectId);
}
}
}
return idString
return idArray
},
/**
*
* retrieve the currently selected edges
* @return {String} selection An array with the ids of the
* @return {Array} selection An array with the ids of the
* selected nodes.
*/
getSelectedEdges : function() {
var idString = "", i = 0;
var idArray = [];
for(var objectId in this.selectionObj) {
if(this.selectionObj.hasOwnProperty(objectId)) {
if (this.selectionObj[objectId] instanceof Edge) {
if (i != 0) {
idString = idString.concat(", ");
}
idString = idString.concat(String(objectId));
i++;
idArray.push(objectId);
}
}
}
return idString
return idArray
},
/**

+ 1
- 1
examples/graph/02_random_nodes.html View File

@ -96,7 +96,7 @@
// add event listeners
vis.events.addListener(graph, 'select', function(params) {
document.getElementById('selection').innerHTML =
'Selection: ' + graph.getSelection();
'Selection: ' + JSON.stringify(graph.getSelection());
});
}
</script>

+ 1
- 1
examples/graph/18_fully_random_nodes_clustering.html View File

@ -65,7 +65,7 @@
// add event listeners
vis.events.addListener(graph, 'select', function(params) {
document.getElementById('selection').innerHTML =
'Selection: ' + graph.getSelection();
'Selection: ' + JSON.stringify(graph.getSelection());
});
}
</script>

+ 1
- 1
examples/graph/19_scale_free_graph_clustering.html View File

@ -102,7 +102,7 @@
// add event listeners
vis.events.addListener(graph, 'select', function(params) {
document.getElementById('selection').innerHTML =
'Selection: ' + graph.getSelection();
'Selection: ' + JSON.stringify(graph.getSelection());
});
}
</script>

+ 1
- 1
examples/graph/20_UI_example.html View File

@ -122,7 +122,7 @@
// add event listeners
vis.events.addListener(graph, 'select', function(params) {
document.getElementById('selection').innerHTML =
'Selection: ' + graph.getSelection();
'Selection: ' + JSON.stringify(graph.getSelection());
});
}
</script>

+ 10
- 30
src/graph/SelectionMixin.js View File

@ -400,23 +400,11 @@ var SelectionMixin = {
* selected nodes.
*/
getSelection : function() {
var nodeIdString = this.getSelectedNodes();
/*
var edgeIdString = this.getSelectedEdges();
var nodeIds = this.getSelectedNodes();
var idString = "";
if (nodeIdString != "") {
idString = idString.concat("Nodes: ",nodeIdString);
var edgeIds = this.getSelectedEdges();
if (edgeIdString != "") {
idString = idString.concat("; ");
}
}
if (edgeIdString != "") {
idString = idString.concat("Edges: ",edgeIdString);
}
*/
return nodeIdString
return {nodes:nodeIds, edges:edgeIds};
},
/**
@ -426,41 +414,33 @@ var SelectionMixin = {
* selected nodes.
*/
getSelectedNodes : function() {
var idString = "", i = 0;
var idArray = [];
for(var objectId in this.selectionObj) {
if(this.selectionObj.hasOwnProperty(objectId)) {
if (this.selectionObj[objectId] instanceof Node) {
if (i != 0) {
idString = idString.concat(", ");
}
idString = idString.concat(String(objectId));
i++;
idArray.push(objectId);
}
}
}
return idString
return idArray
},
/**
*
* retrieve the currently selected edges
* @return {String} selection An array with the ids of the
* @return {Array} selection An array with the ids of the
* selected nodes.
*/
getSelectedEdges : function() {
var idString = "", i = 0;
var idArray = [];
for(var objectId in this.selectionObj) {
if(this.selectionObj.hasOwnProperty(objectId)) {
if (this.selectionObj[objectId] instanceof Edge) {
if (i != 0) {
idString = idString.concat(", ");
}
idString = idString.concat(String(objectId));
i++;
idArray.push(objectId);
}
}
}
return idString
return idArray
},
/**

Loading…
Cancel
Save