mirror of
https://github.com/trebonian/visual6502.git
synced 2024-09-07 08:54:57 +00:00
Merge pull request #60 from gdevic/dev
Added zoom using the mouse wheel
This commit is contained in:
commit
badcf8e40b
@ -277,6 +277,15 @@ function handleKey(e){
|
||||
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
|
||||
// must handle click-to-select (and focus), and drag to pan
|
||||
function mouseDown(e){
|
||||
@ -599,6 +608,7 @@ function setupChipLayoutGraphics(){
|
||||
}
|
||||
// grant focus to the chip display to enable zoom keys
|
||||
chipsurround.focus();
|
||||
chipsurround.onwheel = function(e){handleWheelZoom(e);};
|
||||
chipsurround.onmousedown = function(e){mouseDown(e);};
|
||||
chipsurround.onkeypress = function(e){handleKey(e);};
|
||||
chipsurround.onmouseout = function(e){mouseLeave(e);};
|
||||
|
Loading…
Reference in New Issue
Block a user