mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Issue#148:JSError when deleting first frame + preview speed accuracy
This commit is contained in:
parent
4056142b97
commit
f98c2d2cf5
|
@ -98,7 +98,7 @@
|
||||||
l.removeFrameAt(index);
|
l.removeFrameAt(index);
|
||||||
});
|
});
|
||||||
// Current frame index is impacted if the removed frame was before the current frame
|
// Current frame index is impacted if the removed frame was before the current frame
|
||||||
if (this.currentFrameIndex >= index) {
|
if (this.currentFrameIndex >= index && this.currentFrameIndex > 0) {
|
||||||
this.setCurrentFrameIndex(this.currentFrameIndex - 1);
|
this.setCurrentFrameIndex(this.currentFrameIndex - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
this.isRunning = false;
|
this.isRunning = false;
|
||||||
this.previousTime = 0;
|
this.previousTime = 0;
|
||||||
this.callbacks = [];
|
this.callbacks = [];
|
||||||
this.i = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.DrawingLoop.prototype.addCallback = function (callback, scope, args) {
|
ns.DrawingLoop.prototype.addCallback = function (callback, scope, args) {
|
||||||
|
@ -34,10 +33,7 @@
|
||||||
ns.DrawingLoop.prototype.loop_ = function () {
|
ns.DrawingLoop.prototype.loop_ = function () {
|
||||||
var currentTime = Date.now();
|
var currentTime = Date.now();
|
||||||
var delta = currentTime - this.previousTime;
|
var delta = currentTime - this.previousTime;
|
||||||
this.i++;
|
|
||||||
if(this.i%2 === 0) {
|
|
||||||
this.executeCallbacks_(delta);
|
this.executeCallbacks_(delta);
|
||||||
}
|
|
||||||
this.previousTime = currentTime;
|
this.previousTime = currentTime;
|
||||||
this.requestAnimationFrame.call(window, this.loop_.bind(this));
|
this.requestAnimationFrame.call(window, this.loop_.bind(this));
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user