This repository has been archived by the owner on Mar 27, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
cubiq
committed
Oct 29, 2013
1 parent
08b7caf
commit 052c5ba
Showing
16 changed files
with
396 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,4 +1,4 @@ | |||
/*! iScroll v5.0.5 ~ (c) 2008-2013 Matteo Spinelli ~ http://cubiq.org/license */ | /*! iScroll v5.0.6 ~ (c) 2008-2013 Matteo Spinelli ~ http://cubiq.org/license */ | ||
var IScroll = (function (window, document, Math) { | var IScroll = (function (window, document, Math) { | ||
var rAF = window.requestAnimationFrame || | var rAF = window.requestAnimationFrame || | ||
window.webkitRequestAnimationFrame || | window.webkitRequestAnimationFrame || | ||
|
@@ -307,7 +307,7 @@ function IScroll (el, options) { | ||
} | } | ||
|
|
||
IScroll.prototype = { | IScroll.prototype = { | ||
version: '5.0.5', | version: '5.0.6', | ||
|
|
||
_init: function () { | _init: function () { | ||
this._initEvents(); | this._initEvents(); | ||
|
@@ -369,6 +369,7 @@ IScroll.prototype = { | ||
pos = this.getComputedPosition(); | pos = this.getComputedPosition(); | ||
|
|
||
this._translate(Math.round(pos.x), Math.round(pos.y)); | this._translate(Math.round(pos.x), Math.round(pos.y)); | ||
this._execEvent('scrollEnd'); | |||
this.isInTransition = false; | this.isInTransition = false; | ||
} | } | ||
|
|
||
|
@@ -379,7 +380,7 @@ IScroll.prototype = { | ||
this.pointX = point.pageX; | this.pointX = point.pageX; | ||
this.pointY = point.pageY; | this.pointY = point.pageY; | ||
|
|
||
this._execEvent('scrollStart'); | this._execEvent('beforeScrollStart'); | ||
}, | }, | ||
|
|
||
_move: function (e) { | _move: function (e) { | ||
|
@@ -392,8 +393,8 @@ IScroll.prototype = { | ||
} | } | ||
|
|
||
var point = e.touches ? e.touches[0] : e, | var point = e.touches ? e.touches[0] : e, | ||
deltaX = this.hasHorizontalScroll ? point.pageX - this.pointX : 0, | deltaX = point.pageX - this.pointX, | ||
deltaY = this.hasVerticalScroll ? point.pageY - this.pointY : 0, | deltaY = point.pageY - this.pointY, | ||
timestamp = utils.getTime(), | timestamp = utils.getTime(), | ||
newX, newY, | newX, newY, | ||
absDistX, absDistY; | absDistX, absDistY; | ||
|
@@ -442,6 +443,9 @@ IScroll.prototype = { | ||
deltaX = 0; | deltaX = 0; | ||
} | } | ||
|
|
||
deltaX = this.hasHorizontalScroll ? deltaX : 0; | |||
deltaY = this.hasVerticalScroll ? deltaY : 0; | |||
|
|||
newX = this.x + deltaX; | newX = this.x + deltaX; | ||
newY = this.y + deltaY; | newY = this.y + deltaY; | ||
|
|
||
|
@@ -456,6 +460,10 @@ IScroll.prototype = { | ||
this.directionX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0; | this.directionX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0; | ||
this.directionY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0; | this.directionY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0; | ||
|
|
||
if ( !this.moved ) { | |||
this._execEvent('scrollStart'); | |||
} | |||
|
|||
this.moved = true; | this.moved = true; | ||
|
|
||
this._translate(newX, newY); | this._translate(newX, newY); | ||
|
@@ -755,19 +763,25 @@ IScroll.prototype = { | ||
eventType(window, 'orientationchange', this); | eventType(window, 'orientationchange', this); | ||
eventType(window, 'resize', this); | eventType(window, 'resize', this); | ||
|
|
||
eventType(this.wrapper, 'mousedown', this); | if ( this.options.click ) { | ||
eventType(target, 'mousemove', this); | eventType(this.wrapper, 'click', this, true); | ||
eventType(target, 'mousecancel', this); | } | ||
eventType(target, 'mouseup', this); |
|
||
if ( !this.options.disableMouse ) { | |||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
cubiq
Owner
|
|||
eventType(this.wrapper, 'mousedown', this); | |||
eventType(target, 'mousemove', this); | |||
eventType(target, 'mousecancel', this); | |||
eventType(target, 'mouseup', this); | |||
} | |||
|
|
||
if ( utils.hasPointer ) { | if ( utils.hasPointer && !this.options.disablePointer ) { | ||
eventType(this.wrapper, 'MSPointerDown', this); | eventType(this.wrapper, 'MSPointerDown', this); | ||
eventType(target, 'MSPointerMove', this); | eventType(target, 'MSPointerMove', this); | ||
eventType(target, 'MSPointerCancel', this); | eventType(target, 'MSPointerCancel', this); | ||
eventType(target, 'MSPointerUp', this); | eventType(target, 'MSPointerUp', this); | ||
} | } | ||
|
|
||
if ( utils.hasTouch ) { | if ( utils.hasTouch && !this.options.disableTouch ) { | ||
eventType(this.wrapper, 'touchstart', this); | eventType(this.wrapper, 'touchstart', this); | ||
eventType(target, 'touchmove', this); | eventType(target, 'touchmove', this); | ||
eventType(target, 'touchcancel', this); | eventType(target, 'touchcancel', this); | ||
|
@@ -870,6 +884,12 @@ IScroll.prototype = { | ||
case 'keydown': | case 'keydown': | ||
this._key(e); | this._key(e); | ||
break; | break; | ||
case 'click': | |||
if ( !e._constructed ) { | |||
e.preventDefault(); | |||
e.stopPropagation(); | |||
} | |||
break; | |||
} | } | ||
} | } | ||
}; | }; | ||
|
Oops, something went wrong.
This is undocumented in the default set of options. I don't really want to sign a form to make a git pull for it ;) - but it took me like 10 minutes to find this. Any documentation ( docs or in-code ) would be great!