diff options
| author | Alon Levy <alon@pobox.com> | 2015-05-12 12:20:00 +0300 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-05-12 12:30:04 +0300 |
| commit | 23ce1eb42336375683907ca133008e44ab14704d (patch) | |
| tree | 536dcb7f65da44fbe117584e13a9cdf110c875ab /src/client | |
| parent | 5d3c07a47590cc01f1b1ae2d87ba0084cfc13c43 (diff) | |
client/rz_core: split out init_graphs, rename initDrawingArea/init_graph_views/
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/rz_core.js | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/client/rz_core.js b/src/client/rz_core.js index 6f712e8c..5904c825 100644 --- a/src/client/rz_core.js +++ b/src/client/rz_core.js @@ -59,7 +59,21 @@ function recenterZoom() { vis.attr("transform", "translate(0,0)scale(1)"); } -var initDrawingArea = function () { +function init_graphs() { + var user_id = $('#user_id'), + user = user_id.text(); + + main_graph = new model_graph.Graph({temporary: false, base: null}); + edit_graph = new model_graph.Graph({temporary: true, base: main_graph}); + + if (user_id.length > 0) { + console.log('found user ID: \'' + user + '\''); + main_graph.set_user(user); + edit_graph.set_user(user); + } +} + +var init_graph_views = function () { function zoom() { zoom_g.attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")"); @@ -67,9 +81,6 @@ var initDrawingArea = function () { updateZoomProgress(true); } - main_graph = new model_graph.Graph({temporary: false, base: null}); - edit_graph = new model_graph.Graph({temporary: true, base: main_graph}); - // TODO: we are listening both on graph.diffBus and selection.selectionChangedBus, // but the relation is actually: // @@ -84,15 +95,6 @@ var initDrawingArea = function () { } ); - var user_id = $('#user_id'), - user = user_id.text(); - - if (user_id.length > 0) { - console.log('found user ID: \'' + user + '\''); - main_graph.set_user(user); - edit_graph.set_user(user); - } - var el = document.body; vis = d3.select('#graph-view__canvas').append("svg:svg") .attr('id', 'canvas_d3') @@ -201,7 +203,8 @@ function init_ws_connection(){ } function init() { - initDrawingArea(); + init_graphs(); + init_graph_views(); init_ws_connection(); activity.init($('.graph-view')); |
