Commit e0f254a5 authored by Jérome Perrin's avatar Jérome Perrin

fix issues with changing node id

parent 1df31b1c
...@@ -359,9 +359,9 @@ ...@@ -359,9 +359,9 @@
$(gadget.props.element).find("#" + element_id).remove(); $(gadget.props.element).find("#" + element_id).remove();
delete gadget.props.data.graph.node[node_id]; delete gadget.props.data.graph.node[node_id];
$.each(gadget.props.edge_container, function (k, v) { $.each(gadget.props.data.graph.edge, function (k, v) {
if (node_id === v[0] || node_id === v[1]) { if (node_id === v.source || node_id === v.destination) {
delete gadget.props.edge_container[k]; delete gadget.props.data.graph.edge[k];
} }
}); });
...@@ -382,13 +382,18 @@ ...@@ -382,13 +382,18 @@
gadget.props.data.graph.node[new_id] gadget.props.data.graph.node[new_id]
= gadget.props.data.graph.node[node_id]; = gadget.props.data.graph.node[node_id];
delete gadget.props.data.graph.node[node_id]; delete gadget.props.data.graph.node[node_id];
gadget.props.node_id_to_dom_element_id[new_id]
= gadget.props.node_id_to_dom_element_id[node_id];
delete gadget.props.node_id_to_dom_element_id[node_id];
delete gadget.props.data.graph.node[new_id].id; delete gadget.props.data.graph.node[new_id].id;
$.each(gadget.props.edge_container, function (k, v) { $.each(gadget.props.data.graph.edge, function (k, v) {
if (v[0] === node_id) { if (v.source === node_id) {
v[0] = new_id; v.source = new_id;
} }
if (v[1] === node_id) { if (v.destination === node_id) {
v[1] = new_id; v.destination = new_id;
} }
}); });
} }
...@@ -646,7 +651,6 @@ ...@@ -646,7 +651,6 @@
.declareAcquiredMethod('notifyDataChanged', 'notifyDataChanged') .declareAcquiredMethod('notifyDataChanged', 'notifyDataChanged')
.ready(function (g) { .ready(function (g) {
g.props.edge_container = {}; // XXX remove
g.props.node_id_to_dom_element_id = {}; g.props.node_id_to_dom_element_id = {};
g.props.zoom_level = 1.0; g.props.zoom_level = 1.0;
g.props.style_attr_list = [ g.props.style_attr_list = [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment