From d2dc42e7cf03835106c6d8b2633b475a6c9517f7 Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Sun, 6 Mar 2016 15:18:17 +0100 Subject: [PATCH] Issue #414: part5: rename PiskelController getFrameAt to getMergedFrameAt --- src/js/app.js | 2 +- src/js/controller/piskel/PiskelController.js | 2 +- src/js/controller/preview/PreviewController.js | 2 +- src/js/controller/settings/exportimage/GifExportController.js | 2 +- src/js/controller/settings/exportimage/PngExportController.js | 2 +- src/js/rendering/PiskelRenderer.js | 2 +- src/js/utils/serialization/Serializer.js | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/js/app.js b/src/js/app.js index a410009f..0e7b8def 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -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'); }, diff --git a/src/js/controller/piskel/PiskelController.js b/src/js/controller/piskel/PiskelController.js index 1f8e407f..3838639e 100644 --- a/src/js/controller/piskel/PiskelController.js +++ b/src/js/controller/piskel/PiskelController.js @@ -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); diff --git a/src/js/controller/preview/PreviewController.js b/src/js/controller/preview/PreviewController.js index 33278b72..dd252e70 100644 --- a/src/js/controller/preview/PreviewController.js +++ b/src/js/controller/preview/PreviewController.js @@ -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; diff --git a/src/js/controller/settings/exportimage/GifExportController.js b/src/js/controller/settings/exportimage/GifExportController.js index 9ca27fed..de3ebcce 100644 --- a/src/js/controller/settings/exportimage/GifExportController.js +++ b/src/js/controller/settings/exportimage/GifExportController.js @@ -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) { diff --git a/src/js/controller/settings/exportimage/PngExportController.js b/src/js/controller/settings/exportimage/PngExportController.js index e9ba4c27..8964448c 100644 --- a/src/js/controller/settings/exportimage/PngExportController.js +++ b/src/js/controller/settings/exportimage/PngExportController.js @@ -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'); diff --git a/src/js/rendering/PiskelRenderer.js b/src/js/rendering/PiskelRenderer.js index a53788b3..c2fa9207 100644 --- a/src/js/rendering/PiskelRenderer.js +++ b/src/js/rendering/PiskelRenderer.js @@ -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); }; diff --git a/src/js/utils/serialization/Serializer.js b/src/js/utils/serialization/Serializer.js index 1528f3cb..b946ad8e 100644 --- a/src/js/utils/serialization/Serializer.js +++ b/src/js/utils/serialization/Serializer.js @@ -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); }