Commit d60e2191 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

no longer store id inside node_container[id].

parent 4dcd1f04
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
priv.formatForManpy = function (data) { priv.formatForManpy = function (data) {
var manpy_dict = {}, nodes = {}, edges = {}, edge_id = 0; var manpy_dict = {}, nodes = {}, edges = {}, edge_id = 0;
$.each(data['nodes'], function (idx, node) { $.each(data['nodes'], function (node_id, node) {
var clone_node = {}; var clone_node = {};
/* clone the node and put content of 'data' at the top level. */ /* clone the node and put content of 'data' at the top level. */
$.each(node, function (k, v) { $.each(node, function (k, v) {
...@@ -239,13 +239,13 @@ ...@@ -239,13 +239,13 @@
$.each(v, function (kk, vv) { $.each(v, function (kk, vv) {
clone_node[kk] = vv; clone_node[kk] = vv;
}); });
} else if (k == 'id' || k == 'element_id') { } else if (k == 'element_id') {
true; // no need to output true; // no need to output
} else { } else {
clone_node[k] = v; clone_node[k] = v;
} }
}); });
nodes[node['id']] = clone_node; nodes[node_id] = clone_node;
}); });
manpy_dict['nodes'] = nodes; manpy_dict['nodes'] = nodes;
......
...@@ -245,7 +245,6 @@ ...@@ -245,7 +245,6 @@
// Now update the container of elements // Now update the container of elements
var element_data = { var element_data = {
_class: element._class, _class: element._class,
id: element.id,
element_id: element.element_id, element_id: element.element_id,
name: element.name name: element.name
}; };
...@@ -345,14 +344,14 @@ ...@@ -345,14 +344,14 @@
that.updateElementData = function (node_id, data) { that.updateElementData = function (node_id, data) {
var element_id = priv.node_container[node_id].element_id; var element_id = priv.node_container[node_id].element_id;
$.extend(priv.node_container[node_id], data);
if (data['name']) { if (data['name']) {
$("#" + element_id).text(data["name"]); $("#" + element_id).text(data["name"]);
} }
var new_id = data['id']; var new_id = data['id'];
delete(data['id']);
$.extend(priv.node_container[node_id], data);
if (new_id && new_id !== node_id) { if (new_id && new_id !== node_id) {
priv.node_container[new_id] = priv.node_container[node_id]; priv.node_container[new_id] = priv.node_container[node_id];
priv.node_container[new_id]['id'] = new_id;
delete(priv.node_container[node_id]); delete(priv.node_container[node_id]);
$.each(priv.edge_container, function (k, v) { $.each(priv.edge_container, function (k, v) {
if (v[0] === node_id) { if (v[0] === node_id) {
......
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