bugfix: ensure that canvas scale is at least 1x
This commit is contained in:
parent
3e9a45a7c3
commit
e13c4d0985
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…
Reference in New Issue
Block a user