|
@ -360,14 +360,18 @@ Range.prototype._onDrag = function (event) { |
|
|
if (!this.options.moveable) return; |
|
|
if (!this.options.moveable) return; |
|
|
var direction = this.options.direction; |
|
|
var direction = this.options.direction; |
|
|
validateDirection(direction); |
|
|
validateDirection(direction); |
|
|
|
|
|
|
|
|
// refuse to drag when we where pinching to prevent the timeline make a jump
|
|
|
// refuse to drag when we where pinching to prevent the timeline make a jump
|
|
|
// when releasing the fingers in opposite order from the touch screen
|
|
|
// when releasing the fingers in opposite order from the touch screen
|
|
|
if (!this.props.touch.allowDragging) return; |
|
|
if (!this.props.touch.allowDragging) return; |
|
|
var delta = (direction == 'horizontal') ? event.gesture.deltaX : event.gesture.deltaY, |
|
|
|
|
|
interval = (this.props.touch.end - this.props.touch.start), |
|
|
|
|
|
width = (direction == 'horizontal') ? this.body.domProps.center.width : this.body.domProps.center.height, |
|
|
|
|
|
diffRange = -delta / width * interval; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var delta = (direction == 'horizontal') ? event.gesture.deltaX : event.gesture.deltaY; |
|
|
|
|
|
var interval = (this.props.touch.end - this.props.touch.start); |
|
|
|
|
|
var width = (direction == 'horizontal') ? this.body.domProps.center.width : this.body.domProps.center.height; |
|
|
|
|
|
var diffRange = -delta / width * interval; |
|
|
this._applyRange(this.props.touch.start + diffRange, this.props.touch.end + diffRange); |
|
|
this._applyRange(this.props.touch.start + diffRange, this.props.touch.end + diffRange); |
|
|
|
|
|
|
|
|
|
|
|
// fire a rangechange event
|
|
|
this.body.emitter.emit('rangechange', { |
|
|
this.body.emitter.emit('rangechange', { |
|
|
start: new Date(this.start), |
|
|
start: new Date(this.start), |
|
|
end: new Date(this.end) |
|
|
end: new Date(this.end) |
|
|