Added zoom using the mouse wheel
This commit is contained in:
parent
5b86a57c2c
commit
8097137323
|
@ -277,6 +277,15 @@ function handleKey(e){
|
||||||
else if(c=='p') stepBack();
|
else if(c=='p') stepBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handler for zoom in/out using the mouse wheel
|
||||||
|
function handleWheelZoom(e){
|
||||||
|
chipsurround.focus();
|
||||||
|
e.preventDefault();
|
||||||
|
var n = e.deltaY / 100;
|
||||||
|
if(n>0 && zoom>1) setZoom(zoom/1.2);
|
||||||
|
if(n<0 && zoom<grMaxZoom) setZoom(zoom*1.2);
|
||||||
|
}
|
||||||
|
|
||||||
// handler for mousedown events over chip display
|
// handler for mousedown events over chip display
|
||||||
// must handle click-to-select (and focus), and drag to pan
|
// must handle click-to-select (and focus), and drag to pan
|
||||||
function mouseDown(e){
|
function mouseDown(e){
|
||||||
|
@ -599,6 +608,7 @@ function setupChipLayoutGraphics(){
|
||||||
}
|
}
|
||||||
// grant focus to the chip display to enable zoom keys
|
// grant focus to the chip display to enable zoom keys
|
||||||
chipsurround.focus();
|
chipsurround.focus();
|
||||||
|
chipsurround.onwheel = function(e){handleWheelZoom(e);};
|
||||||
chipsurround.onmousedown = function(e){mouseDown(e);};
|
chipsurround.onmousedown = function(e){mouseDown(e);};
|
||||||
chipsurround.onkeypress = function(e){handleKey(e);};
|
chipsurround.onkeypress = function(e){handleKey(e);};
|
||||||
chipsurround.onmouseout = function(e){mouseLeave(e);};
|
chipsurround.onmouseout = function(e){mouseLeave(e);};
|
||||||
|
|
Loading…
Reference in New Issue