Issue #414: part5: rename PiskelController getFrameAt to getMergedFrameAt

This commit is contained in:
Julian Descottes 2016-03-06 15:18:17 +01:00 committed by juliandescottes
parent 186b5a305a
commit d2dc42e7cf
7 changed files with 7 additions and 7 deletions

View File

@ -203,7 +203,7 @@
},
getFirstFrameAsPng : function () {
var firstFrame = this.piskelController.getFrameAt(0);
var firstFrame = this.piskelController.getMergedFrameAt(0);
var firstFrameCanvas = pskl.utils.FrameUtils.toImage(firstFrame);
return firstFrameCanvas.toDataURL('image/png');
},

View File

@ -90,7 +90,7 @@
return this.piskel;
};
ns.PiskelController.prototype.getFrameAt = function (index) {
ns.PiskelController.prototype.getMergedFrameAt = function (index) {
var hash = [];
var frames = this.getLayers().map(function (l) {
var frame = l.getFrameAt(index);

View File

@ -170,7 +170,7 @@
var index = this.getNextIndex_(delta);
if (this.shoudlRender_() || this.currentIndex != index) {
this.currentIndex = index;
var frame = this.piskelController.getFrameAt(this.currentIndex);
var frame = this.piskelController.getMergedFrameAt(this.currentIndex);
this.renderer.render(frame);
this.renderFlag = false;

View File

@ -127,7 +127,7 @@
});
for (var i = 0 ; i < this.piskelController.getFrameCount() ; i++) {
var frame = this.piskelController.getFrameAt(i);
var frame = this.piskelController.getMergedFrameAt(i);
var canvasRenderer = new pskl.rendering.CanvasRenderer(frame, zoom);
if (preserveColors) {

View File

@ -60,7 +60,7 @@
ns.PngExportController.prototype.mergedExport_ = function (zip) {
var paddingLength = ('' + this.piskelController.getFrameCount()).length;
for (var i = 0; i < this.piskelController.getFrameCount(); i++) {
var frame = this.piskelController.getFrameAt(i);
var frame = this.piskelController.getMergedFrameAt(i);
var canvas = this.getFrameAsCanvas_(frame);
var basename = this.pngFilePrefixInput.value;
var id = pskl.utils.StringUtils.leftPad(i, paddingLength, '0');

View File

@ -5,7 +5,7 @@
ns.PiskelRenderer = function (piskelController) {
var frames = [];
for (var i = 0 ; i < piskelController.getFrameCount() ; i++) {
frames.push(piskelController.getFrameAt(i));
frames.push(piskelController.getMergedFrameAt(i));
}
ns.FramesheetRenderer.call(this, frames);
};

View File

@ -22,7 +22,6 @@
serializeLayer : function (layer, expanded) {
var frames = layer.getFrames();
var renderer = new pskl.rendering.FramesheetRenderer(frames);
var layerToSerialize = {
name : layer.getName(),
opacity : layer.getOpacity(),
@ -32,6 +31,7 @@
layerToSerialize.grids = frames.map(function (f) {return f.pixels;});
return layerToSerialize;
} else {
var renderer = new pskl.rendering.FramesheetRenderer(frames);
layerToSerialize.base64PNG = renderer.renderAsCanvas().toDataURL();
return JSON.stringify(layerToSerialize);
}