|
@ -100,8 +100,8 @@ function validateDirection (direction) { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Set a new start and end range |
|
|
* Set a new start and end range |
|
|
* @param {Number} [start] |
|
|
|
|
|
* @param {Number} [end] |
|
|
|
|
|
|
|
|
* @param {Date | Number | String} [start] |
|
|
|
|
|
* @param {Date | Number | String} [end] |
|
|
* @param {boolean | number} [animate=false] If true, the range is animated |
|
|
* @param {boolean | number} [animate=false] If true, the range is animated |
|
|
* smoothly to the new window. |
|
|
* smoothly to the new window. |
|
|
* If animate is a number, the |
|
|
* If animate is a number, the |
|
@ -110,6 +110,9 @@ function validateDirection (direction) { |
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
Range.prototype.setRange = function(start, end, animate) { |
|
|
Range.prototype.setRange = function(start, end, animate) { |
|
|
|
|
|
var _start = start != undefined ? util.convert(start, 'Date').valueOf() : null; |
|
|
|
|
|
var _end = end != undefined ? util.convert(end, 'Date').valueOf() : null; |
|
|
|
|
|
|
|
|
this._cancelAnimation(); |
|
|
this._cancelAnimation(); |
|
|
|
|
|
|
|
|
if (animate) { |
|
|
if (animate) { |
|
@ -123,8 +126,8 @@ Range.prototype.setRange = function(start, end, animate) { |
|
|
if (!me.props.touch.dragging) { |
|
|
if (!me.props.touch.dragging) { |
|
|
var now = new Date().valueOf(); |
|
|
var now = new Date().valueOf(); |
|
|
var time = now - initTime; |
|
|
var time = now - initTime; |
|
|
var s = util.easeInOutQuad(time, initStart, start, duration); |
|
|
|
|
|
var e = util.easeInOutQuad(time, initEnd, end, duration); |
|
|
|
|
|
|
|
|
var s = util.easeInOutQuad(time, initStart, _start, duration); |
|
|
|
|
|
var e = util.easeInOutQuad(time, initEnd, _end, duration); |
|
|
changed = me._applyRange(s, e); |
|
|
changed = me._applyRange(s, e); |
|
|
anyChanged = anyChanged || changed; |
|
|
anyChanged = anyChanged || changed; |
|
|
if (changed) { |
|
|
if (changed) { |
|
@ -148,7 +151,7 @@ Range.prototype.setRange = function(start, end, animate) { |
|
|
return next(); |
|
|
return next(); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
var changed = this._applyRange(start, end); |
|
|
|
|
|
|
|
|
var changed = this._applyRange(_start, _end); |
|
|
if (changed) { |
|
|
if (changed) { |
|
|
var params = {start: new Date(this.start), end: new Date(this.end)}; |
|
|
var params = {start: new Date(this.start), end: new Date(this.end)}; |
|
|
this.body.emitter.emit('rangechange', params); |
|
|
this.body.emitter.emit('rangechange', params); |
|
|