fixed synapse selection and removal of multiple topics bugs

This commit is contained in:
Connor Turland 2014-11-29 15:36:03 -05:00
parent f938ffade3
commit 93227f0e2f
2 changed files with 25 additions and 37 deletions

View file

@ -1129,11 +1129,18 @@ Metamaps.JIT = {
sY = -1 * sY;
eY = -1 * eY
Metamaps.Synapses.each(function(synapse) {
var fromNodeX = synapse.get('edge').nodeFrom.pos.x;
var fromNodeY = -1 * synapse.get('edge').nodeFrom.pos.y;
var toNodeX = synapse.get('edge').nodeTo.pos.x;
var toNodeY = -1 * synapse.get('edge').nodeTo.pos.y;
var edgesToToggle = [];
Metamaps.Synapses.each(function(synapse) {
var e = synapse.get('edge');
if (edgesToToggle.indexOf(e) === -1) {
edgesToToggle.push(e);
}
});
edgesToToggle.forEach(function(edge) {
var fromNodeX = edge.nodeFrom.pos.x;
var fromNodeY = -1 * edge.nodeFrom.pos.y;
var toNodeX = edge.nodeTo.pos.x;
var toNodeY = -1 * edge.nodeTo.pos.y;
var maxX = fromNodeX;
var maxY = fromNodeY;
@ -1209,21 +1216,18 @@ Metamaps.JIT = {
//The test synapse was selected!
// make sure the edge hasn't been hidden from the page
var node1id = synapse.get('edge').nodeFrom.id;
var node2id = synapse.get('edge').nodeTo.id;
var edge = Metamaps.Visualize.mGraph.graph.getAdjacence(node1id, node2id);
if(selectTest){
if(selectTest){
// shiftKey = toggleSelect, otherwise
if(e.shiftKey){
if(Metamaps.Selected.Edges.indexOf(synapse.get('edge')) != -1 ){
Metamaps.Control.deselectEdge(synapse.get('edge'));
if(Metamaps.Selected.Edges.indexOf(edge) != -1 ){
Metamaps.Control.deselectEdge(edge);
}
else{
if (edge) Metamaps.Control.selectEdge(synapse.get('edge'));
Metamaps.Control.selectEdge(edge);
}
}
else{
if (edge) Metamaps.Control.selectEdge(synapse.get('edge'));
Metamaps.Control.selectEdge(edge);
}
}
});

View file

@ -2818,20 +2818,8 @@ Metamaps.Control = {
}
Metamaps.Control.deselectNode(node);
node.setData('alpha', 0, 'end');
node.eachAdjacency(function (adj) {
adj.setData('alpha', 0, 'end');
});
Metamaps.Visualize.mGraph.fx.animate({
modes: ['node-property:alpha',
'edge-property:alpha'
],
duration: 500
});
setTimeout(function () {
Metamaps.Visualize.mGraph.graph.removeNode(nodeid);
}, 500);
Metamaps.Visualize.mGraph.graph.removeNode(nodeid);
Metamaps.Visualize.mGraph.plot();
Metamaps.Filter.checkMetacodes();
Metamaps.Filter.checkMappers();
},
@ -2996,17 +2984,13 @@ Metamaps.Control = {
hideEdge: function (edge) {
var from = edge.nodeFrom.id;
var to = edge.nodeTo.id;
edge.setData('alpha', 0, 'end');
Metamaps.Control.deselectEdge(edge);
Metamaps.Visualize.mGraph.fx.animate({
modes: ['edge-property:alpha'],
duration: 500
});
setTimeout(function () {
if (Metamaps.Visualize.mGraph.graph.getAdjacence(from, to)) {
Metamaps.Visualize.mGraph.graph.removeAdjacence(from, to);
}, 500);
Metamaps.Filter.checkSynapses();
Metamaps.Filter.checkMappers();
Metamaps.Visualize.mGraph.plot();
Metamaps.Filter.checkSynapses();
Metamaps.Filter.checkMappers();
}
},
updateSelectedPermissions: function (permission) {