mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
fixed fps when restoring backup
This commit is contained in:
parent
19c99d1aa7
commit
b556143b66
@ -81,9 +81,11 @@
|
||||
};
|
||||
|
||||
ns.AnimatedPreviewController.prototype.setFPS = function (fps) {
|
||||
this.fps = fps;
|
||||
$("#preview-fps").val(this.fps);
|
||||
$("#display-fps").html(this.fps + " FPS");
|
||||
if (fps) {
|
||||
this.fps = fps;
|
||||
$("#preview-fps").val(this.fps);
|
||||
$("#display-fps").html(this.fps + " FPS");
|
||||
}
|
||||
};
|
||||
|
||||
ns.AnimatedPreviewController.prototype.getFPS = function () {
|
||||
|
@ -27,6 +27,10 @@
|
||||
var currentFrameIndex = this.piskelController.getCurrentFrameIndex();
|
||||
var currentLayerIndex = this.piskelController.getCurrentLayerIndex();
|
||||
|
||||
var downLayers = layers.slice(0, currentLayerIndex);
|
||||
var upLayers = layers.slice(currentLayerIndex + 1, layers.length);
|
||||
|
||||
|
||||
var serializedRendering = [
|
||||
this.getZoom(),
|
||||
this.getGridWidth(),
|
||||
@ -34,8 +38,8 @@
|
||||
offset.y,
|
||||
size.width,
|
||||
size.height,
|
||||
currentFrameIndex,
|
||||
currentLayerIndex,
|
||||
this.getHashForLayersAt_(currentFrameIndex, downLayers),
|
||||
this.getHashForLayersAt_(currentFrameIndex, upLayers),
|
||||
layers.length
|
||||
].join("-");
|
||||
|
||||
@ -45,18 +49,15 @@
|
||||
|
||||
this.clear();
|
||||
|
||||
var downLayers = layers.slice(0, currentLayerIndex);
|
||||
if (downLayers.length > 0) {
|
||||
var downFrame = this.getFrameForLayersAt_(currentFrameIndex, downLayers);
|
||||
this.belowRenderer.render(downFrame);
|
||||
}
|
||||
|
||||
var upLayers = layers.slice(currentLayerIndex + 1, layers.length);
|
||||
if (upLayers.length > 0) {
|
||||
var upFrame = this.getFrameForLayersAt_(currentFrameIndex, upLayers);
|
||||
this.aboveRenderer.render(upFrame);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@ -80,6 +81,13 @@
|
||||
return pskl.utils.FrameUtils.merge(frames);
|
||||
};
|
||||
|
||||
ns.LayersRenderer.prototype.getHashForLayersAt_ = function (frameIndex, layers) {
|
||||
var hash = layers.map(function (l) {
|
||||
return l.getFrameAt(frameIndex).getHash();
|
||||
});
|
||||
return hash.join('-');
|
||||
};
|
||||
|
||||
ns.LayersRenderer.prototype.flush = function () {
|
||||
this.serializedRendering = '';
|
||||
};
|
||||
|
@ -24,6 +24,7 @@
|
||||
var info = {
|
||||
name : descriptor.name,
|
||||
description : descriptor.info,
|
||||
fps : this.piskelController.getFPS(),
|
||||
date : Date.now(),
|
||||
hash : hash
|
||||
};
|
||||
@ -54,6 +55,7 @@
|
||||
pskl.utils.serialization.Deserializer.deserialize(previousPiskel, function (piskel) {
|
||||
piskel.setDescriptor(new pskl.model.piskel.Descriptor(previousInfo.name, previousInfo.description, true));
|
||||
pskl.app.piskelController.setPiskel(piskel);
|
||||
pskl.app.animationController.setFPS(previousInfo.fps);
|
||||
});
|
||||
};
|
||||
})();
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user