Issue #483 - limit zoom to have 10 sprite pixels displayed on screen

This commit is contained in:
Julian Descottes 2016-06-09 11:05:59 +02:00
parent c0f0445544
commit c49fe4d6a0
2 changed files with 6 additions and 5 deletions

View File

@ -14,8 +14,6 @@ var Constants = {
MAX_PALETTE_COLORS : 100,
MINIMUM_ZOOM : 1,
PREVIEW_FILM_SIZE : 96,
ANIMATED_PREVIEW_WIDTH : 200,

View File

@ -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;