diff --git a/src/js/Constants.js b/src/js/Constants.js index 90f0fd01..f6ac4519 100644 --- a/src/js/Constants.js +++ b/src/js/Constants.js @@ -14,8 +14,6 @@ var Constants = { MAX_PALETTE_COLORS : 100, - MINIMUM_ZOOM : 1, - PREVIEW_FILM_SIZE : 96, ANIMATED_PREVIEW_WIDTH : 200, diff --git a/src/js/rendering/frame/FrameRenderer.js b/src/js/rendering/frame/FrameRenderer.js index 0ea7723b..c9b610ce 100644 --- a/src/js/rendering/frame/FrameRenderer.js +++ b/src/js/rendering/frame/FrameRenderer.js @@ -75,9 +75,12 @@ }; ns.FrameRenderer.prototype.setZoom = function (zoom) { - if (zoom < Constants.MINIMUM_ZOOM) { - zoom = Constants.MINIMUM_ZOOM; - } + // Minimum zoom is one to ensure one sprite pixel occupies at least one pixel on screen. + var minimumZoom = 1; + // Maximum zoom is relative to the display dimensions to ensure at least 10 pixels can + // be drawn on screen. + var maximumZoom = Math.min(this.displayWidth, this.displayHeight) / 10; + zoom = pskl.utils.Math.minmax(zoom, minimumZoom, maximumZoom); if (zoom == this.zoom) { return;