summaryrefslogtreecommitdiff
path: root/src/client/view/layouts.js
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-07-30 18:03:04 +0300
committerAlon Levy <alon@pobox.com>2015-07-30 18:05:06 +0300
commit365735289e899b4d4ee209506e465d420d24e978 (patch)
treedfacb6ef4698d24a2a1d49609109b7ceeefca393 /src/client/view/layouts.js
parentc85e703253d8bfa21ea48517791f8dc921d4fdd4 (diff)
client: record position to db when dragging + fixed
Record position when dragging. Record fixed status. this is still not clear - what fixed means exactly.
Diffstat (limited to 'src/client/view/layouts.js')
-rw-r--r--src/client/view/layouts.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/client/view/layouts.js b/src/client/view/layouts.js
index 76422c0b..5fb750a9 100644
--- a/src/client/view/layouts.js
+++ b/src/client/view/layouts.js
@@ -177,6 +177,12 @@ function(consts, $, d3, _) {
return layout;
}
+ function save_from_arr_id_x_y(data) {
+ layout.saved_nodes_position = _.object(data.map(function (d) {
+ return [d.id, {x: d.x, y: d.y, px: d.x, py: d.y, fixed: true}];
+ }));
+ }
+
function restore() {
if (layout.saved_nodes_position === undefined) {
return layout;
@@ -219,6 +225,7 @@ function(consts, $, d3, _) {
links: links,
save: save,
restore: restore,
+ save_from_arr_id_x_y: save_from_arr_id_x_y,
stop: save,
start: restore,
nodes_links: function (nodes, links) {