mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Fix : protect LayerRenderer against fake setDisplaySize calls
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
ns.CachedFrameRenderer.prototype.setDisplaySize = function (width, height) {
|
ns.CachedFrameRenderer.prototype.setDisplaySize = function (width, height) {
|
||||||
if (this.displayWidth !== width || this.displayHeight !== height) {
|
if (this.displayWidth !== width || this.displayHeight !== height) {
|
||||||
pskl.rendering.frame.FrameRenderer.prototype.setDisplaySize.call(this, width, height);
|
this.superclass.setDisplaySize.call(this, width, height);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,20 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See @pskl.rendering.frame.CachedFrameRenderer
|
||||||
|
* Same issue : FrameRenderer setDisplaySize destroys the canvas
|
||||||
|
* @param {Number} width
|
||||||
|
* @param {Number} height
|
||||||
|
*/
|
||||||
|
ns.LayersRenderer.prototype.setDisplaySize = function (width, height) {
|
||||||
|
var size = this.getDisplaySize();
|
||||||
|
if (size.width !== width || size.height !== height) {
|
||||||
|
this.superclass.setDisplaySize.call(this, width, height);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
ns.LayersRenderer.prototype.getFrameForLayersAt_ = function (frameIndex, layers) {
|
ns.LayersRenderer.prototype.getFrameForLayersAt_ = function (frameIndex, layers) {
|
||||||
var frames = layers.map(function (l) {
|
var frames = layers.map(function (l) {
|
||||||
return l.getFrameAt(frameIndex);
|
return l.getFrameAt(frameIndex);
|
||||||
|
|||||||
Reference in New Issue
Block a user