From e2c408f983edc2fac94b44a88eeb98bf8a4a0167 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Mon, 7 Jan 2013 22:05:59 -0500 Subject: [PATCH] changed savedToMap() function so that it also includes all synapses --- app/assets/javascripts/application.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 42d3ef34..9daf752b 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -115,16 +115,19 @@ function saveLayout(id) { // this is to save your console to a map function saveToMap() { - var Coor = ""; + var nodes_data = "", syapses_data = ""; Mconsole.graph.eachNode(function(n) { - Coor = Coor + n.id + '/' + n.pos.x + '/' + n.pos.y + ','; + nodes_data += n.id + '/' + n.pos.x + '/' + n.pos.y + ','; }); - Coor = Coor.slice(0, -1); - $('#map_topicsToMap').val(Coor); + Mconsole.graph.eachAdjacence(function(adj) { + synapses_data += adj.id + ','; + } + nodes_data = nodes_data.slice(0, -1); + $('#map_topicsToMap').val(nodes_data); + $('#map_synapsesToMap').val(synapses_data); $('#new_map').fadeIn('fast'); } - // this is for hiding one topic from your canvas function removeFromCanvas(topic_id) { var node = Mconsole.graph.getNode(topic_id); @@ -168,4 +171,4 @@ function MconsoleReset() { var mY = Mconsole.canvas.scaleOffsetY; Mconsole.canvas.scale((1/mX),(1/mY)); -} \ No newline at end of file +}