mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Issue #483 - limit zoom to have 10 sprite pixels displayed on screen
This commit is contained in:
parent
c0f0445544
commit
c49fe4d6a0
@ -14,8 +14,6 @@ var Constants = {
|
||||
|
||||
MAX_PALETTE_COLORS : 100,
|
||||
|
||||
MINIMUM_ZOOM : 1,
|
||||
|
||||
PREVIEW_FILM_SIZE : 96,
|
||||
ANIMATED_PREVIEW_WIDTH : 200,
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user