fixed save layout bug issue #90

This commit is contained in:
Devin Howard 2013-02-10 20:22:18 -05:00
parent 87d74fd3c2
commit cd3f02d676
2 changed files with 5 additions and 4 deletions

View file

@ -159,7 +159,7 @@ function saveLayoutAll() {
var coor = "";
if (gType == "arranged" || gType == "chaotic") {
Mconsole.graph.eachNode(function(n) {
coor = coor + n.data.$mappingid + '/' + n.pos.x + '/' + n.pos.y + ',';
coor = coor + n.getData("mappingid") + '/' + n.pos.x + '/' + n.pos.y + ',';
});
coor = coor.slice(0, -1);
$('#map_coordinates').val(coor);
@ -170,7 +170,7 @@ function saveLayoutAll() {
// this is to update the location coordinate of a single node on a map
function saveLayout(id) {
var n = Mconsole.graph.getNode(id);
$('#map_coordinates').val(n.data.$mappingid + '/' + n.pos.x + '/' + n.pos.y);
$('#map_coordinates').val(n.getData("mappingid") + '/' + n.pos.x + '/' + n.pos.y);
$('#saveMapLayout').submit();
dragged = 0;
$('#saveLayout').attr('value','Saved!');

View file

@ -11,8 +11,6 @@ $('#topic_name').attr('value','');
$('#topic_grabTopic').attr('value','null');
$('#topic_addSynapse').attr('value','false');
var newnode = <%= @topic.self_as_json.html_safe %>;
var x = <%= @position['x'] %>;
var y = <%= @position['y'] %>;
@ -85,6 +83,9 @@ if (!$.isEmptyObject(Mconsole.graph.nodes)) {
temp.setData('dim', 25, 'end');
temp.setData('onCanvas', false);
temp.setData('inCommons', false);
if (gType == "arranged" || gType == "chaotic") {
temp.setData('mappingid', <%= @mapping.id %>);
}
temp.setPos(new $jit.Complex(x, y), 'current');
temp.setPos(new $jit.Complex(x, y), 'start');
temp.setPos(new $jit.Complex(x, y), 'end');