From f98c2d2cf594d3af7b705b21275baf30d484ef4b Mon Sep 17 00:00:00 2001 From: jdescottes Date: Thu, 19 Dec 2013 00:15:40 +0100 Subject: [PATCH] Issue#148:JSError when deleting first frame + preview speed accuracy --- js/controller/PiskelController.js | 2 +- js/rendering/DrawingLoop.js | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/js/controller/PiskelController.js b/js/controller/PiskelController.js index 25028ce7..ab44d197 100644 --- a/js/controller/PiskelController.js +++ b/js/controller/PiskelController.js @@ -98,7 +98,7 @@ l.removeFrameAt(index); }); // 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); } diff --git a/js/rendering/DrawingLoop.js b/js/rendering/DrawingLoop.js index d746f684..e1816011 100644 --- a/js/rendering/DrawingLoop.js +++ b/js/rendering/DrawingLoop.js @@ -6,7 +6,6 @@ this.isRunning = false; this.previousTime = 0; this.callbacks = []; - this.i = 0; }; ns.DrawingLoop.prototype.addCallback = function (callback, scope, args) { @@ -34,10 +33,7 @@ ns.DrawingLoop.prototype.loop_ = function () { var currentTime = Date.now(); var delta = currentTime - this.previousTime; - this.i++; - if(this.i%2 === 0) { - this.executeCallbacks_(delta); - } + this.executeCallbacks_(delta); this.previousTime = currentTime; this.requestAnimationFrame.call(window, this.loop_.bind(this)); };