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,
color: '#d1d1d1'
});
temp.setDataset('end', {
lineWidth: 3,
color: '#36acfb'
});
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);
Mconsole.fx.animate({
modes: ['edge-property:lineWidth:color'],
duration: 400
});
}
else {
json = <%= @synapse.selfplusnodes_as_json.html_safe %>
initialize("chaotic");
}