From 5900ea0319b2848bd1b8fe39b53a512281955563 Mon Sep 17 00:00:00 2001 From: yotamberk Date: Sun, 4 Dec 2016 17:41:59 +0200 Subject: [PATCH] fix: _origRedraw sometimes undefined (#2399) --- lib/timeline/Core.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/timeline/Core.js b/lib/timeline/Core.js index 1eeb0faa..aa8344da 100644 --- a/lib/timeline/Core.js +++ b/lib/timeline/Core.js @@ -115,6 +115,10 @@ Core.prototype._create = function (container) { this.on('panmove', this._onDrag.bind(this)); var me = this; + + this._origRedraw = this._redraw.bind(this); + this._redraw = util.throttle(this._origRedraw); + this.on('_change', function (properties) { if (me.itemSet.initialItemSetDrawn && properties && properties.queue == true) { me._redraw() @@ -412,15 +416,7 @@ Core.prototype.setOptions = function (options) { this.configurator.setModuleOptions({global: appliedOptions}); } - // override redraw with a throttled version - if (!this._origRedraw) { - this._origRedraw = this._redraw.bind(this); - this._redraw = util.throttle(this._origRedraw); - } else { - // Not the initial run: redraw everything - this._redraw(); - } - + this._redraw(); }; /**