Permalink
Browse files

fix #439 #488 #517 #428 #270 #520 #447 #452 #509

  • Loading branch information...
1 parent 08b7caf commit 052c5ba3c1e72d7911f203d228bc5d6c51d52815 @cubiq committed Oct 29, 2013
View
@@ -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 rAF = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
@@ -307,7 +307,7 @@ function IScroll (el, options) {
}
IScroll.prototype = {
- version: '5.0.5',
+ version: '5.0.6',
_init: function () {
this._initEvents();
@@ -369,6 +369,7 @@ IScroll.prototype = {
pos = this.getComputedPosition();
this._translate(Math.round(pos.x), Math.round(pos.y));
+ this._execEvent('scrollEnd');
this.isInTransition = false;
}
@@ -379,7 +380,7 @@ IScroll.prototype = {
this.pointX = point.pageX;
this.pointY = point.pageY;
- this._execEvent('scrollStart');
+ this._execEvent('beforeScrollStart');
},
_move: function (e) {
@@ -392,8 +393,8 @@ IScroll.prototype = {
}
var point = e.touches ? e.touches[0] : e,
- deltaX = this.hasHorizontalScroll ? point.pageX - this.pointX : 0,
- deltaY = this.hasVerticalScroll ? point.pageY - this.pointY : 0,
+ deltaX = point.pageX - this.pointX,
+ deltaY = point.pageY - this.pointY,
timestamp = utils.getTime(),
newX, newY,
absDistX, absDistY;
@@ -442,6 +443,9 @@ IScroll.prototype = {
deltaX = 0;
}
+ deltaX = this.hasHorizontalScroll ? deltaX : 0;
+ deltaY = this.hasVerticalScroll ? deltaY : 0;
+
newX = this.x + deltaX;
newY = this.y + deltaY;
@@ -456,6 +460,10 @@ IScroll.prototype = {
this.directionX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0;
this.directionY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0;
+ if ( !this.moved ) {
+ this._execEvent('scrollStart');
+ }
+
this.moved = true;
this._translate(newX, newY);
@@ -755,19 +763,25 @@ IScroll.prototype = {
eventType(window, 'orientationchange', this);
eventType(window, 'resize', this);
- eventType(this.wrapper, 'mousedown', this);
- eventType(target, 'mousemove', this);
- eventType(target, 'mousecancel', this);
- eventType(target, 'mouseup', this);
+ if ( this.options.click ) {
+ eventType(this.wrapper, 'click', this, true);
+ }
+
+ if ( !this.options.disableMouse ) {
@justnorris
justnorris 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!

@cubiq
cubiq Dec 28, 2013 Owner

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

@justnorris
justnorris 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(target, 'MSPointerMove', this);
eventType(target, 'MSPointerCancel', this);
eventType(target, 'MSPointerUp', this);
}
- if ( utils.hasTouch ) {
+ if ( utils.hasTouch && !this.options.disableTouch ) {
eventType(this.wrapper, 'touchstart', this);
eventType(target, 'touchmove', this);
eventType(target, 'touchcancel', this);
@@ -870,6 +884,12 @@ IScroll.prototype = {
case 'keydown':
this._key(e);
break;
+ case 'click':
+ if ( !e._constructed ) {
+ e.preventDefault();
+ e.stopPropagation();
+ }
+ break;
}
}
};
Oops, something went wrong.

0 comments on commit 052c5ba

Please sign in to comment.