From 1ea1f089d30cbae6884da4bef0d51b981c8d2e1b Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Thu, 30 Jul 2015 18:03:04 +0300 Subject: client: record position to db when dragging + fixed Record position when dragging. Record fixed status. this is still not clear - what fixed means exactly. --- src/client/view/layouts.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/client/view/layouts.js') 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) { -- cgit v1.3.1