Browse Source

bugfix: ensure that canvas scale is at least 1x

main
Colin McMillen 5 years ago
parent
commit
e13c4d0985
  1. 6
      main.js

6
main.js

@ -8,6 +8,10 @@ const Orientation = {
RIGHT: 'right'
}
function bound(low, x, high) {
return Math.max(low, Math.min(x, high));
}
class Input {
constructor() {
this.up = false;
@ -524,7 +528,7 @@ function setCanvasScale(scale) {
function setAutoCanvasScale() {
const widthAspect = Math.floor(window.innerWidth / SNES_WIDTH);
const heightAspect = Math.floor(window.innerHeight / SNES_HEIGHT);
const scale = Math.min(widthAspect, heightAspect)
const scale = bound(1, Math.min(widthAspect, heightAspect), 8);
setCanvasScale(scale);
}

Loading…
Cancel
Save