Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cubiq committed Oct 29, 2013
1 parent 08b7caf commit 052c5ba
Show file tree
Hide file tree
Showing 16 changed files with 396 additions and 252 deletions.
42 changes: 31 additions & 11 deletions build/iscroll-lite.js
@@ -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 ||
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
} }


Expand All @@ -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) {
Expand All @@ -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;
Expand Down Expand Up @@ -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;


Expand All @@ -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);
Expand Down Expand Up @@ -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.

Copy link
@pyronaur

pyronaur Dec 28, 2013

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!

This comment has been minimized.

Copy link
@cubiq

cubiq Dec 28, 2013

Owner

documentation (very very extensive) is coming. sorry for the delay, but it takes time.

This comment has been minimized.

Copy link
@pyronaur

pyronaur Dec 28, 2013

No problem :)
You can open source the documentation too and let the community help!

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);
Expand Down Expand Up @@ -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;
} }
} }
}; };
Expand Down

0 comments on commit 052c5ba

Please sign in to comment.