feature : zoom-level

- Fixed bug with layer rendering when moving drawing offset (bad
  redraw-flag checking)
This commit is contained in:
jdescottes 2013-11-02 11:39:35 +01:00
parent cd4952cc7b
commit 44722ab88e

View File

@ -6,8 +6,9 @@
this.piskelController = piskelController; this.piskelController = piskelController;
this.belowRenderer = new pskl.rendering.frame.CachedFrameRenderer(container, renderingOptions, ["layers-canvas", "layers-below-canvas"]); // Do not use CachedFrameRenderers here, since the caching will be performed in the render method of LayersRenderer
this.aboveRenderer = new pskl.rendering.frame.CachedFrameRenderer(container, renderingOptions, ["layers-canvas", "layers-above-canvas"]); 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.belowRenderer);
this.add(this.aboveRenderer); this.add(this.aboveRenderer);
@ -18,18 +19,26 @@
pskl.utils.inherit(pskl.rendering.layer.LayersRenderer, pskl.rendering.CompositeRenderer); pskl.utils.inherit(pskl.rendering.layer.LayersRenderer, pskl.rendering.CompositeRenderer);
ns.LayersRenderer.prototype.render = function () { ns.LayersRenderer.prototype.render = function () {
var offset = this.getOffset();
var size = this.getDisplaySize();
var layers = this.piskelController.getLayers(); var layers = this.piskelController.getLayers();
var currentFrameIndex = this.piskelController.currentFrameIndex; var currentFrameIndex = this.piskelController.currentFrameIndex;
var currentLayerIndex = this.piskelController.currentLayerIndex; var currentLayerIndex = this.piskelController.currentLayerIndex;
var serializedRendering = [ var serializedRendering = [
this.getZoom(), this.getZoom(),
offset.x,
offset.y,
size.width,
size.height,
currentFrameIndex, currentFrameIndex,
currentLayerIndex, currentLayerIndex,
layers.length layers.length
].join("-"); ].join("-");
if (this.serializedRendering != serializedRendering) { if (this.serializedRendering != serializedRendering) {
console.log(serializedRendering);
this.serializedRendering = serializedRendering; this.serializedRendering = serializedRendering;
this.clear(); this.clear();