mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Fixed animation preview when deleting
This commit is contained in:
@@ -51,12 +51,13 @@
|
||||
};
|
||||
|
||||
ns.AnimatedPreviewController.prototype.refreshAnimatedPreview = function () {
|
||||
this.renderer.render(this.framesheet.getFrameByIndex(this.animIndex), this.previewCanvas, this.dpi);
|
||||
this.animIndex++;
|
||||
if (this.animIndex == this.framesheet.getFrameCount()) {
|
||||
this.animIndex = 0;
|
||||
}
|
||||
this.startAnimationTimer();
|
||||
if (!this.framesheet.hasFrameAtIndex(this.animIndex)) {
|
||||
this.animIndex = 0;
|
||||
}
|
||||
|
||||
this.renderer.render(this.framesheet.getFrameByIndex(this.animIndex), this.previewCanvas, this.dpi);
|
||||
this.animIndex++;
|
||||
this.startAnimationTimer();
|
||||
};
|
||||
|
||||
})();
|
@@ -65,12 +65,17 @@
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ns.FrameSheet.prototype.hasFrameAtIndex = function(index) {
|
||||
return (index >= 0 && index < this.getFrameCount());
|
||||
};
|
||||
|
||||
ns.FrameSheet.prototype.getFrameByIndex = function(index) {
|
||||
if (isNaN(index)) {
|
||||
throw "Bad argument value for getFrameByIndex method: <" + index + ">";
|
||||
}
|
||||
|
||||
if (index < 0 || index > this.getFrameCount()) {
|
||||
if (!this.hasFrameAtIndex(index)) {
|
||||
throw "Out of bound index for frameSheet object.";
|
||||
}
|
||||
|
||||
@@ -78,10 +83,10 @@
|
||||
};
|
||||
|
||||
ns.FrameSheet.prototype.removeFrameByIndex = function(index) {
|
||||
if(index < 0 || index > this.getFrameCount()) {
|
||||
if(!this.hasFrameAtIndex(index)) {
|
||||
throw "Out of bound index for frameSheet object.";
|
||||
}
|
||||
frames.splice(index, 1);
|
||||
this.frames.splice(index, 1);
|
||||
};
|
||||
|
||||
ns.FrameSheet.prototype.duplicateFrameByIndex = function(index) {
|
||||
|
@@ -296,8 +296,10 @@ $.namespace("pskl");
|
||||
|
||||
xhr.send(formData);
|
||||
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
if(event) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user