Added several delete nodes.

This commit is contained in:
mdtrooper 2016-03-30 16:12:35 +02:00
parent 7d66ba2dde
commit 415589ec95

View File

@ -1977,7 +1977,20 @@ MapController.prototype.editNode = function(self, target) {
* This function delete a node and the arrows that use it * This function delete a node and the arrows that use it
*/ */
MapController.prototype.deleteNode = function(self, target) { MapController.prototype.deleteNode = function(self, target) {
var id_node = d3.select(target).attr("id"); var self = this;
$.each(nodes, function(i, node) {
if (node.type != ITEM_TYPE_AGENT_NETWORKMAP)
return 1; // Continue
var status_selection =
self.get_status_selection_node(node.graph_id);
if (status_selection.indexOf("select") == -1) {
return 1; // Continue
}
var id_node = "node_" + node.graph_id;
var arrowsToDelete = self.getArrows(self, id_node); var arrowsToDelete = self.getArrows(self, id_node);
// Delete edges and nodes in "nodes" and "edges" arrays // Delete edges and nodes in "nodes" and "edges" arrays
@ -1987,7 +2000,10 @@ MapController.prototype.deleteNode = function(self, target) {
arrowsToDelete.forEach(function(arrow) { arrowsToDelete.forEach(function(arrow) {
d3.select("#arrow_" + arrow).remove(); d3.select("#arrow_" + arrow).remove();
}); });
d3.select(target).remove(); d3.select(self._target + " #" + id_node).remove();
});
} }
/** /**