Browse Source

fix: _origRedraw sometimes undefined (#2399)

codeClimate
yotamberk 8 years ago
committed by Alexander Wunschik
parent
commit
5900ea0319
1 changed files with 5 additions and 9 deletions
  1. +5
    -9
      lib/timeline/Core.js

+ 5
- 9
lib/timeline/Core.js View File

@ -115,6 +115,10 @@ Core.prototype._create = function (container) {
this.on('panmove', this._onDrag.bind(this)); this.on('panmove', this._onDrag.bind(this));
var me = this; var me = this;
this._origRedraw = this._redraw.bind(this);
this._redraw = util.throttle(this._origRedraw);
this.on('_change', function (properties) { this.on('_change', function (properties) {
if (me.itemSet.initialItemSetDrawn && properties && properties.queue == true) { if (me.itemSet.initialItemSetDrawn && properties && properties.queue == true) {
me._redraw() me._redraw()
@ -412,15 +416,7 @@ Core.prototype.setOptions = function (options) {
this.configurator.setModuleOptions({global: appliedOptions}); 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();
}; };
/** /**

Loading…
Cancel
Save