Merge branch 'develop' of https://github.com/Connoropolous/metamaps_gen002 into new
This commit is contained in:
commit
ad2d79a7ea
4 changed files with 187 additions and 194 deletions
|
@ -373,29 +373,7 @@ Metamaps.GlobalUI.Search = {
|
|||
self.close(0, true);
|
||||
}
|
||||
break;
|
||||
case 65:
|
||||
case 97:
|
||||
|
||||
if (e.ctrlKey){
|
||||
Metamaps.Control.deselectAllNodes();
|
||||
Metamaps.Control.deselectAllEdges();
|
||||
|
||||
e.preventDefault();
|
||||
Metamaps.Visualize.mGraph.graph.eachNode(function (n) {
|
||||
Metamaps.Control.selectNode(n,e);
|
||||
});
|
||||
|
||||
Metamaps.Visualize.mGraph.plot();
|
||||
}
|
||||
|
||||
break;
|
||||
case 69:
|
||||
case 101:
|
||||
if (e.ctrlKey){
|
||||
e.preventDefault();
|
||||
Metamaps.JIT.zoomExtents();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break; //console.log(e.which);
|
||||
}
|
||||
|
|
|
@ -1654,6 +1654,11 @@ Metamaps.JIT = {
|
|||
var ratioX = spanX / width;
|
||||
var ratioY = spanY / height;
|
||||
|
||||
var cogX = (maxX + minX)/2;
|
||||
var cogY = (maxY + minY)/2;
|
||||
|
||||
canvas.translate(-1* cogX, -1* cogY);
|
||||
|
||||
var newRatio = Math.max(ratioX,ratioY);
|
||||
var scaleMultiplier = 1/newRatio*0.9;
|
||||
|
||||
|
@ -1669,43 +1674,6 @@ Metamaps.JIT = {
|
|||
canvas.scale(scaleMultiplier,scaleMultiplier);
|
||||
}
|
||||
|
||||
counter = 0;
|
||||
|
||||
nodes.forEach(function (n) {
|
||||
var x = n.pos.x,
|
||||
y = n.pos.y;
|
||||
|
||||
if (counter == 0){
|
||||
maxX = x;
|
||||
minX = x;
|
||||
maxY = y;
|
||||
minY = y;
|
||||
}
|
||||
|
||||
var arrayOfLabelLines = Metamaps.Util.splitLine(n.name, 30).split('\n'),
|
||||
dim = n.getData('dim'),
|
||||
ctx = canvas.getCtx();
|
||||
|
||||
var height = 25 * arrayOfLabelLines.length;
|
||||
|
||||
var index, lineWidths = [];
|
||||
for (index = 0; index < arrayOfLabelLines.length; ++index) {
|
||||
lineWidths.push(ctx.measureText(arrayOfLabelLines[index]).width)
|
||||
}
|
||||
var width = Math.max.apply(null, lineWidths) + 8;
|
||||
|
||||
maxX = Math.max(x + width /2,maxX);
|
||||
maxY = Math.max(y + n.getData("height") + 5 + height,maxY);
|
||||
minX = Math.min(x - width /2,minX);
|
||||
minY = Math.min(y - dim,minY);
|
||||
|
||||
counter++;
|
||||
});
|
||||
|
||||
var cogX = (maxX + minX)/2;
|
||||
var cogY = (maxY + minY)/2;
|
||||
|
||||
canvas.translate(-1* cogX, -1* cogY);
|
||||
$(document).trigger(Metamaps.JIT.events.zoom, [event]);
|
||||
}
|
||||
else if(nodes.length == 1){
|
||||
|
|
|
@ -2743,6 +2743,53 @@ Metamaps.Listeners = {
|
|||
case 27:
|
||||
if (Metamaps.Active.Map) Metamaps.JIT.escKeyHandler();
|
||||
break;
|
||||
case 65: //if a or A is pressed
|
||||
case 97:
|
||||
|
||||
if (e.ctrlKey){
|
||||
Metamaps.Control.deselectAllNodes();
|
||||
Metamaps.Control.deselectAllEdges();
|
||||
|
||||
e.preventDefault();
|
||||
Metamaps.Visualize.mGraph.graph.eachNode(function (n) {
|
||||
Metamaps.Control.selectNode(n,e);
|
||||
});
|
||||
|
||||
Metamaps.Visualize.mGraph.plot();
|
||||
}
|
||||
|
||||
break;
|
||||
case 69: //if e or E is pressed
|
||||
case 101:
|
||||
if (e.ctrlKey){
|
||||
e.preventDefault();
|
||||
Metamaps.JIT.zoomExtents();
|
||||
}
|
||||
break;
|
||||
case 82: //if r or R is pressed
|
||||
case 114:
|
||||
if (e.ctrlKey){
|
||||
e.preventDefault();
|
||||
Metamaps.Control.removeSelectedNodes();
|
||||
console.log('Once function works, selected nodes will be removed');
|
||||
}
|
||||
break;
|
||||
case 68: //if d or D is pressed
|
||||
case 100:
|
||||
if (e.ctrlKey){
|
||||
e.preventDefault();
|
||||
Metamaps.Control.deleteSelectedNodes();
|
||||
console.log('Once function works, selected nodes will be deleted');
|
||||
}
|
||||
break;
|
||||
case 72: //if h or H is pressed
|
||||
case 104:
|
||||
if (e.ctrlKey){
|
||||
e.preventDefault();
|
||||
Metamaps.Control.hideSelectedNodes();
|
||||
console.log('Once function works, selected nodes will be hidden');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break; //alert(e.which);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue