mirror of
https://github.com/trebonian/visual6502.git
synced 2024-11-02 23:06:44 +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();
|
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
Block a user