fixed mouse mappings
This commit is contained in:
parent
2de697bcca
commit
c1728b9ecb
2 changed files with 27 additions and 36 deletions
|
@ -2495,7 +2495,7 @@ Extras.Classes.Navigation = new Class({
|
||||||
//START METAMAPS CODE
|
//START METAMAPS CODE
|
||||||
var rightClick = e.button == 2 || (navigator.platform.indexOf("Mac") != -1 && e.ctrlKey);
|
var rightClick = e.button == 2 || (navigator.platform.indexOf("Mac") != -1 && e.ctrlKey);
|
||||||
// TODO make sure this works across browsers
|
// TODO make sure this works across browsers
|
||||||
if (!Metamaps.Mouse.boxStartCoordinates && ((e.button == 0 && e.shiftKey) || (e.button == 0 && e.ctrlKey) || (rightClick && e.ctrlKey))) {
|
if (!Metamaps.Mouse.boxStartCoordinates && ((e.button == 0 && e.shiftKey) || (e.button == 0 && e.ctrlKey) || rightClick)) {
|
||||||
Metamaps.Mouse.boxStartCoordinates = eventInfo.getPos();
|
Metamaps.Mouse.boxStartCoordinates = eventInfo.getPos();
|
||||||
//console.log('mouse down');
|
//console.log('mouse down');
|
||||||
}
|
}
|
||||||
|
@ -2525,13 +2525,13 @@ Extras.Classes.Navigation = new Class({
|
||||||
|
|
||||||
// START METAMAPS CODE
|
// START METAMAPS CODE
|
||||||
var rightClick = e.button == 2 || (navigator.platform.indexOf("Mac") != -1 && e.ctrlKey);
|
var rightClick = e.button == 2 || (navigator.platform.indexOf("Mac") != -1 && e.ctrlKey);
|
||||||
if (!Metamaps.Mouse.boxStartCoordinates && ((e.button == 0 && e.shiftKey) || (e.button == 0 && e.ctrlKey) || (rightClick && e.ctrlKey))) {
|
if (!Metamaps.Mouse.boxStartCoordinates && ((e.button == 0 && e.shiftKey) || (e.button == 0 && e.ctrlKey) || rightClick)) {
|
||||||
Metamaps.Visualize.mGraph.busy = true;
|
Metamaps.Visualize.mGraph.busy = true;
|
||||||
Metamaps.boxStartCoordinates = eventInfo.getPos();
|
Metamaps.boxStartCoordinates = eventInfo.getPos();
|
||||||
//console.log('mouse move');
|
//console.log('mouse move');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Metamaps.Mouse.boxStartCoordinates && ((e.button == 0 && e.shiftKey) || (e.button == 0 && e.ctrlKey) || (rightClick && e.ctrlKey))) {
|
if (Metamaps.Mouse.boxStartCoordinates && ((e.button == 0 && e.shiftKey) || (e.button == 0 && e.ctrlKey) || rightClick)) {
|
||||||
Metamaps.Visualize.mGraph.busy = true;
|
Metamaps.Visualize.mGraph.busy = true;
|
||||||
Metamaps.JIT.drawSelectBox(eventInfo,e);
|
Metamaps.JIT.drawSelectBox(eventInfo,e);
|
||||||
//console.log('mouse move');
|
//console.log('mouse move');
|
||||||
|
|
|
@ -374,14 +374,14 @@ Metamaps.JIT = {
|
||||||
$('.rightclickmenu').remove();
|
$('.rightclickmenu').remove();
|
||||||
|
|
||||||
if (Metamaps.Mouse.boxStartCoordinates) {
|
if (Metamaps.Mouse.boxStartCoordinates) {
|
||||||
if(e.ctrlKey && e.shiftKey){
|
if(e.ctrlKey){
|
||||||
Metamaps.Visualize.mGraph.busy = false;
|
Metamaps.Visualize.mGraph.busy = false;
|
||||||
Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos();
|
Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos();
|
||||||
Metamaps.JIT.zoomToBox(e);
|
Metamaps.JIT.zoomToBox(e);
|
||||||
//console.log('called zoom to box');
|
//console.log('called zoom to box');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (e.ctrlKey || e.shiftKey) {
|
else if (e.shiftKey) {
|
||||||
Metamaps.Visualize.mGraph.busy = false;
|
Metamaps.Visualize.mGraph.busy = false;
|
||||||
Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos();
|
Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos();
|
||||||
Metamaps.JIT.selectWithBox(e);
|
Metamaps.JIT.selectWithBox(e);
|
||||||
|
@ -410,10 +410,10 @@ Metamaps.JIT = {
|
||||||
// remove the rightclickmenu
|
// remove the rightclickmenu
|
||||||
$('.rightclickmenu').remove();
|
$('.rightclickmenu').remove();
|
||||||
|
|
||||||
if (Metamaps.Mouse.boxStartCoordinates && e.ctrlKey) {
|
if (Metamaps.Mouse.boxStartCoordinates) {
|
||||||
Metamaps.Visualize.mGraph.busy = false;
|
Metamaps.Visualize.mGraph.busy = false;
|
||||||
Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos();
|
Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos();
|
||||||
Metamaps.JIT.zoomToBox(e);
|
Metamaps.JIT.selectWithBox(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1097,7 +1097,7 @@ Metamaps.JIT = {
|
||||||
eX = Metamaps.Mouse.boxEndCoordinates.x,
|
eX = Metamaps.Mouse.boxEndCoordinates.x,
|
||||||
eY = Metamaps.Mouse.boxEndCoordinates.y;
|
eY = Metamaps.Mouse.boxEndCoordinates.y;
|
||||||
|
|
||||||
if(!(e.shiftKey) && !(e.ctrlKey)){
|
if(!e.shiftKey){
|
||||||
Metamaps.Control.deselectAllNodes();
|
Metamaps.Control.deselectAllNodes();
|
||||||
Metamaps.Control.deselectAllEdges();
|
Metamaps.Control.deselectAllEdges();
|
||||||
}
|
}
|
||||||
|
@ -1108,7 +1108,7 @@ Metamaps.JIT = {
|
||||||
y = n.pos.y;
|
y = n.pos.y;
|
||||||
|
|
||||||
if ((sX < x && x < eX && sY < y && y < eY) || (sX > x && x > eX && sY > y && y > eY) || (sX > x && x > eX && sY < y && y < eY) || (sX < x && x < eX && sY > y && y > eY)) {
|
if ((sX < x && x < eX && sY < y && y < eY) || (sX > x && x > eX && sY > y && y > eY) || (sX > x && x > eX && sY < y && y < eY) || (sX < x && x < eX && sY > y && y > eY)) {
|
||||||
if(e.ctrlKey){
|
if(e.shiftKey){
|
||||||
if(n.selected){
|
if(n.selected){
|
||||||
Metamaps.Control.deselectNode(n);
|
Metamaps.Control.deselectNode(n);
|
||||||
}
|
}
|
||||||
|
@ -1211,7 +1211,7 @@ Metamaps.JIT = {
|
||||||
var node2id = synapse.get('edge').nodeTo.id;
|
var node2id = synapse.get('edge').nodeTo.id;
|
||||||
var edge = Metamaps.Visualize.mGraph.graph.getAdjacence(node1id, node2id);
|
var edge = Metamaps.Visualize.mGraph.graph.getAdjacence(node1id, node2id);
|
||||||
if(selectTest){
|
if(selectTest){
|
||||||
if(e.ctrlKey){
|
if(e.shiftKey){
|
||||||
if(Metamaps.Selected.Edges.indexOf(synapse.get('edge')) != -1 ){
|
if(Metamaps.Selected.Edges.indexOf(synapse.get('edge')) != -1 ){
|
||||||
Metamaps.Control.deselectEdge(synapse.get('edge'));
|
Metamaps.Control.deselectEdge(synapse.get('edge'));
|
||||||
}
|
}
|
||||||
|
@ -1273,21 +1273,17 @@ Metamaps.JIT = {
|
||||||
// wait a certain length of time, then check again, then run this code
|
// wait a certain length of time, then check again, then run this code
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
if (!Metamaps.JIT.nodeWasDoubleClicked()) {
|
if (!Metamaps.JIT.nodeWasDoubleClicked()) {
|
||||||
if (!e.shiftKey && !e.ctrlKey) {
|
|
||||||
|
var nodeAlreadySelected = node.selected;
|
||||||
|
|
||||||
|
if (!e.shiftKey) {
|
||||||
Metamaps.Control.deselectAllNodes();
|
Metamaps.Control.deselectAllNodes();
|
||||||
Metamaps.Control.deselectAllEdges();
|
Metamaps.Control.deselectAllEdges();
|
||||||
Metamaps.Control.selectNode(node,e);
|
|
||||||
}
|
}
|
||||||
else if(e.shiftKey && e.ctrlKey){
|
|
||||||
//no result
|
if (nodeAlreadySelected) {
|
||||||
}
|
Metamaps.Control.deselectNode(node);
|
||||||
else if(e.ctrlKey){
|
} else {
|
||||||
if (node.selected) {
|
|
||||||
Metamaps.Control.deselectNode(node);
|
|
||||||
} else {
|
|
||||||
Metamaps.Control.selectNode(node,e);
|
|
||||||
}
|
|
||||||
}else if(e.shiftKey){
|
|
||||||
Metamaps.Control.selectNode(node,e);
|
Metamaps.Control.selectNode(node,e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1531,22 +1527,17 @@ Metamaps.JIT = {
|
||||||
// wait a certain length of time, then check again, then run this code
|
// wait a certain length of time, then check again, then run this code
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
if (!Metamaps.JIT.nodeWasDoubleClicked()) {
|
if (!Metamaps.JIT.nodeWasDoubleClicked()) {
|
||||||
if (!e.shiftKey && !e.ctrlKey) {
|
|
||||||
|
var edgeAlreadySelected = Metamaps.Selected.Edges.indexOf(adj) !== -1;
|
||||||
|
|
||||||
|
if (!e.shiftKey) {
|
||||||
Metamaps.Control.deselectAllNodes();
|
Metamaps.Control.deselectAllNodes();
|
||||||
Metamaps.Control.deselectAllEdges();
|
Metamaps.Control.deselectAllEdges();
|
||||||
Metamaps.Control.selectEdge(adj);
|
|
||||||
}
|
}
|
||||||
else if (e.shiftKey && e.ctrlKey){
|
|
||||||
//no result
|
if (edgeAlreadySelected) {
|
||||||
}
|
Metamaps.Control.deselectEdge(adj);
|
||||||
else if (e.ctrlKey){
|
} else {
|
||||||
if (Metamaps.Selected.Edges.indexOf(adj) !== -1) {
|
|
||||||
Metamaps.Control.deselectEdge(adj);
|
|
||||||
} else {
|
|
||||||
Metamaps.Control.selectEdge(adj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (e.shiftKey){
|
|
||||||
Metamaps.Control.selectEdge(adj);
|
Metamaps.Control.selectEdge(adj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue