Revert "Drag around all selected nodes, not just one - implements #79"
This reverts commit fa789dff2e
.
This commit is contained in:
parent
fa789dff2e
commit
0a1b5d51d8
4 changed files with 22 additions and 44 deletions
|
@ -73,6 +73,24 @@ function nodeWasDoubleClicked() {
|
|||
}
|
||||
}//nodeWasDoubleClicked;
|
||||
|
||||
function selectNode(node) {
|
||||
node.selected = true;
|
||||
node.setData('dim', 30, 'current');
|
||||
node.setData('onCanvas',true);
|
||||
node.eachAdjacency(function (adj) {
|
||||
selectEdge(adj);
|
||||
});
|
||||
}
|
||||
|
||||
function deselectNode(node) {
|
||||
delete node.selected;
|
||||
node.setData('onCanvas', false);
|
||||
node.eachAdjacency(function(adj) {
|
||||
deselectEdge(adj);
|
||||
});
|
||||
node.setData('dim', 25, 'current');
|
||||
}
|
||||
|
||||
function selectNodeOnClickHandler(node, e) {
|
||||
if (Mconsole.busy) return;
|
||||
|
||||
|
@ -139,25 +157,10 @@ function onDragMoveTopicHandler(node, eventInfo, e) {
|
|||
var pos = eventInfo.getPos();
|
||||
// if it's a left click, move the node
|
||||
if (e.button == 0 && !e.altKey && (e.buttons == 0 || e.buttons == 1 || e.buttons == undefined)) {
|
||||
var len = MetamapsModel.selectedNodes.length;
|
||||
|
||||
//first define offset for each node
|
||||
var xOffset = new Array();
|
||||
var yOffset = new Array();
|
||||
for (var i = 0; i < len; i += 1) {
|
||||
n = MetamapsModel.selectedNodes[i];
|
||||
xOffset[i] = n.getData('xloc') - node.getData('xloc');
|
||||
yOffset[i] = n.getData('yloc') - node.getData('yloc');
|
||||
}
|
||||
|
||||
for (var i = 0; i < len; i += 1) {
|
||||
n = MetamapsModel.selectedNodes[i];
|
||||
n.pos.setc(pos.x + xOffset[i], pos.y + yOffset[i]);
|
||||
n.setData('xloc', pos.x + xOffset[i]);
|
||||
n.setData('yloc', pos.y + yOffset[i]);
|
||||
}
|
||||
|
||||
dragged = node.id;
|
||||
node.pos.setc(pos.x, pos.y);
|
||||
node.data.$xloc = pos.x;
|
||||
node.data.$yloc = pos.y;
|
||||
Mconsole.plot();
|
||||
}
|
||||
// if it's a right click or holding down alt, start synapse creation ->third option is for firefox
|
||||
|
|
|
@ -9,9 +9,8 @@ var MetamapsModel = new Object();
|
|||
|
||||
MetamapsModel.embed = false;
|
||||
|
||||
//array of all selected edges, same for nodes
|
||||
//array of all selected edges
|
||||
MetamapsModel.selectedEdges = new Array();
|
||||
MetamapsModel.selectedNodes = new Array();
|
||||
|
||||
//is any showcard open right now? which one?
|
||||
MetamapsModel.showcardInUse = null;
|
||||
|
|
|
@ -480,7 +480,6 @@ function onDragEndTopicHandler(node, eventInfo, e, allowRealtime) {
|
|||
tempNode2 = null;
|
||||
tempInit = false;
|
||||
} else if (dragged != 0 && goRealtime) {
|
||||
//TODO: dragged is invalid if multiple nodes were dragged
|
||||
saveLayout(dragged);
|
||||
}
|
||||
}//onDragEndTopicHandler
|
||||
|
|
|
@ -287,29 +287,6 @@ function deleteSelectedEdges() {
|
|||
MetamapsModel.selectedEdges = new Array();
|
||||
}
|
||||
|
||||
function selectNode(node) {
|
||||
node.selected = true;
|
||||
node.setData('dim', 30, 'current');
|
||||
node.setData('onCanvas',true);
|
||||
node.eachAdjacency(function (adj) {
|
||||
selectEdge(adj);
|
||||
});
|
||||
MetamapsModel.selectedNodes.push(node);
|
||||
}
|
||||
|
||||
function deselectNode(node) {
|
||||
delete node.selected;
|
||||
node.setData('onCanvas', false);
|
||||
node.eachAdjacency(function(adj) {
|
||||
deselectEdge(adj);
|
||||
});
|
||||
node.setData('dim', 25, 'current');
|
||||
|
||||
//remove the node
|
||||
MetamapsModel.selectedNodes.splice(
|
||||
MetamapsModel.selectedNodes.indexOf(node), 1);
|
||||
}
|
||||
|
||||
function selectEdge(edge) {
|
||||
var showDesc = edge.getData("showDesc");
|
||||
if (! showDesc) {
|
||||
|
|
Loading…
Reference in a new issue