From 44722ab88e565847fc961182d28ae3800bec4936 Mon Sep 17 00:00:00 2001 From: jdescottes Date: Sat, 2 Nov 2013 11:39:35 +0100 Subject: [PATCH] feature : zoom-level - Fixed bug with layer rendering when moving drawing offset (bad redraw-flag checking) --- js/rendering/layer/LayersRenderer.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/js/rendering/layer/LayersRenderer.js b/js/rendering/layer/LayersRenderer.js index 12c8b38d..0963ed05 100644 --- a/js/rendering/layer/LayersRenderer.js +++ b/js/rendering/layer/LayersRenderer.js @@ -6,8 +6,9 @@ this.piskelController = piskelController; - this.belowRenderer = new pskl.rendering.frame.CachedFrameRenderer(container, renderingOptions, ["layers-canvas", "layers-below-canvas"]); - this.aboveRenderer = new pskl.rendering.frame.CachedFrameRenderer(container, renderingOptions, ["layers-canvas", "layers-above-canvas"]); + // Do not use CachedFrameRenderers here, since the caching will be performed in the render method of LayersRenderer + this.belowRenderer = new pskl.rendering.frame.FrameRenderer(container, renderingOptions, ["layers-canvas", "layers-below-canvas"]); + this.aboveRenderer = new pskl.rendering.frame.FrameRenderer(container, renderingOptions, ["layers-canvas", "layers-above-canvas"]); this.add(this.belowRenderer); this.add(this.aboveRenderer); @@ -18,18 +19,26 @@ pskl.utils.inherit(pskl.rendering.layer.LayersRenderer, pskl.rendering.CompositeRenderer); ns.LayersRenderer.prototype.render = function () { + var offset = this.getOffset(); + var size = this.getDisplaySize(); var layers = this.piskelController.getLayers(); var currentFrameIndex = this.piskelController.currentFrameIndex; var currentLayerIndex = this.piskelController.currentLayerIndex; var serializedRendering = [ this.getZoom(), + offset.x, + offset.y, + size.width, + size.height, currentFrameIndex, currentLayerIndex, layers.length ].join("-"); + if (this.serializedRendering != serializedRendering) { + console.log(serializedRendering); this.serializedRendering = serializedRendering; this.clear();