Adding zoom out limit

This commit is contained in:
David Négrier 2021-05-04 12:09:00 +02:00
parent 85efe208b3
commit 613ff5d463

View File

@ -41,6 +41,23 @@ export class HdpiManager {
i++;
}
// Has the canvas more pixels than the screen? This is forbidden
if ((i - 1) * this._zoomModifier < 1) {
// Let's reset the zoom modifier (WARNING this is a SIDE EFFECT in a getter)
this._zoomModifier = 1 / (i - 1);
return {
game: {
width: realPixelScreenSize.width,
height: realPixelScreenSize.height,
},
real: {
width: realPixelScreenSize.width,
height: realPixelScreenSize.height,
}
}
}
return {
game: {
width: Math.ceil(realPixelScreenSize.width / (i - 1) / this._zoomModifier),