diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index 5d3477dca1..f45ebe3463 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -792,8 +792,8 @@ function edit_node(data_node, dblClick) { var id_networkmap_lenght = networkmap_id.toString().length; var id_node_length = id.length - id_networkmap_lenght; id = id.substring(0, id_node_length); - var node_selected = graph.nodes[id]; - + var index_node = $.inArray(data_node, graph.nodes); + var node_selected = graph.nodes[index_node]; var selected_links = get_relations(node_selected); $( @@ -2868,10 +2868,13 @@ function init_drag_and_drop() { var selection = d3.selectAll(".node_selected"); selection.each(function(d) { - graph.nodes[d.id].x = d.x + delta[0]; - graph.nodes[d.id].y = d.y + delta[1]; - graph.nodes[d.id].px = d.px + delta[0]; - graph.nodes[d.id].py = d.py + delta[1]; + // We search the position of this node in the array (index). + // This is to avoid errors when deleting nodes (id doesn't match index). + var index_node = $.inArray(d, graph.nodes); + graph.nodes[index_node].x = d.x + delta[0]; + graph.nodes[index_node].y = d.y + delta[1]; + graph.nodes[index_node].px = d.px + delta[0]; + graph.nodes[index_node].py = d.py + delta[1]; }); draw_elements_graph();