HTML and CSS Reference
In-Depth Information
context.drawImage(photo, windowX, windowY, windowWidth, windowHeight,
0,0,windowWidth*currentScale,windowHeight*currentScale);
}
function startUp(){
setInterval(drawScreen, 100 );
}
document.onkeydown = function(e){
e = e?e:window.event;
console.log(e.keyCode + "down");
switch (e.keyCode){
case 38:
//up
windowY-=10;
if (windowY<0){
windowY = 0;
}
break;
case 40:
//down
windowY+=10;
if (windowY>photo.height - windowHeight){
windowY = photo.height - windowHeight;
}
break;
case 37:
//left
windowX-=10;
if (windowX<0){
windowX = 0;
}
break;
case 39:
//right
windowX+=10;
if (windowX>photo.width - windowWidth){
windowX = photo.width - windowWidth;
}
break;
case 109:
//-
currentScale-=scaleIncrement;
if (currentScale<minScale){
currentScale = minScale;
}
break;
Search WWH ::




Custom Search