metamaps--metamaps/app/views/synapses/create.js.erb

41 lines
1.3 KiB
Text
Raw Normal View History

$('#new_synapse').fadeOut('fast');
$('#synapse_desc').attr('value','');
$('#synapse_topic1id').attr('value','0');
$('#synapse_topic2id').attr('value','0');
var temp1, temp2, temp;
if ( Mconsole != null) {
temp1 = Mconsole.graph.getNode(<%= @synapse.topic1.id %>);
temp2 = Mconsole.graph.getNode(<%= @synapse.topic2.id %>);
Mconsole.graph.addAdjacence(temp1, temp2, {});
temp = Mconsole.graph.getAdjacence(temp1.id, temp2.id);
console.log(temp);
temp.setDataset('start', {
lineWidth: 0.4
});
temp.setDataset('end', {
lineWidth: 2
});
var d = new Array(<%= @synapse.node1_id.to_s() %>, <%= @synapse.node2_id.to_s() %>);
temp.setDataset('current', {
desc: '<%= @synapse.desc %>',
showDesc: true,
category: '<%= @synapse.category %>',
id: '<%= @synapse.id %>',
userid: '<%= @synapse.user.id %>',
username: '<%= @synapse.user.name %>'
});
temp.data.$direction = d;
Mconsole.fx.plotLine(temp, Mconsole.canvas);
selectEdge(temp);
Mconsole.fx.animate({
modes: ['edge-property:lineWidth:color'],
duration: 400
});
}
else {
json = <%= @synapse.selfplusnodes_as_json.html_safe %>
initialize("chaotic");
}