Browse Source

Eliminate repeatedly fired `rangechanged` events on mousewheel (#2989)

* Fix redraw order

* Fix error when option is not defined

* Allow template labels

* Add .travis.yml file

* Add experiment travis code

* Fix react example

* Add pausing of rangechanged in scroll
gemini
yotamberk 7 years ago
committed by GitHub
parent
commit
77699b4fd9
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      lib/timeline/Range.js

+ 6
- 2
lib/timeline/Range.js View File

@ -196,12 +196,12 @@ Range.prototype.setRange = function(start, end, options, callback) {
if (options.byUser !== true) {
options.byUser = false;
}
var me = this;
var finalStart = start != undefined ? util.convert(start, 'Date').valueOf() : null;
var finalEnd = end != undefined ? util.convert(end, 'Date').valueOf() : null;
this._cancelAnimation();
if (options.animation) { // true or an Object
var me = this;
var initStart = this.start;
var initEnd = this.end;
var duration = (typeof options.animation === 'object' && 'duration' in options.animation) ? options.animation.duration : 500;
@ -265,8 +265,12 @@ Range.prototype.setRange = function(start, end, options, callback) {
byUser: options.byUser,
event: options.event
};
this.body.emitter.emit('rangechange', params);
this.body.emitter.emit('rangechanged', params);
clearTimeout( me.timeoutID );
me.timeoutID = setTimeout( function () {
me.body.emitter.emit('rangechanged', params);
}, 200 );
if (callback) { return callback() }
}
}

Loading…
Cancel
Save