mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(scroll): do not click when scroll decelerating
Closes #1438, #2223, #2665
This commit is contained in:
@@ -793,7 +793,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
self.touchEnd = function(e) {
|
||||
if (!self.__isDown) return;
|
||||
|
||||
self.doTouchEnd(e.timeStamp);
|
||||
self.doTouchEnd(e, e.timeStamp);
|
||||
self.__isDown = false;
|
||||
self.__hasStarted = false;
|
||||
self.__isSelectable = true;
|
||||
@@ -865,7 +865,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
return;
|
||||
}
|
||||
|
||||
self.doTouchEnd(e.timeStamp);
|
||||
self.doTouchEnd(e, e.timeStamp);
|
||||
|
||||
mousedown = false;
|
||||
};
|
||||
@@ -1630,6 +1630,9 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
doTouchStart: function(touches, timeStamp) {
|
||||
var self = this;
|
||||
|
||||
// remember if the deceleration was just stopped
|
||||
self.__decStopped = !!(self.__isDecelerating || self.__isAnimating);
|
||||
|
||||
self.hintResize();
|
||||
|
||||
if (timeStamp instanceof Date) {
|
||||
@@ -1747,6 +1750,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
|
||||
// Are we already is dragging mode?
|
||||
if (self.__isDragging) {
|
||||
self.__decStopped = false;
|
||||
|
||||
// Compute move distance
|
||||
var moveX = currentTouchLeft - self.__lastTouchLeft;
|
||||
@@ -1912,7 +1916,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
/**
|
||||
* Touch end handler for scrolling support
|
||||
*/
|
||||
doTouchEnd: function(timeStamp) {
|
||||
doTouchEnd: function(e, timeStamp) {
|
||||
if (timeStamp instanceof Date) {
|
||||
timeStamp = timeStamp.valueOf();
|
||||
}
|
||||
@@ -1982,6 +1986,13 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
} else if ((timeStamp - self.__lastTouchMove) > 100) {
|
||||
self.__scrollingComplete();
|
||||
}
|
||||
|
||||
} else if (self.__decStopped) {
|
||||
// the deceleration was stopped
|
||||
// user flicked the scroll fast, and stop dragging, then did a touchstart to stop the srolling
|
||||
// tell the touchend event code to do nothing, we don't want to actually send a click
|
||||
e.isTapHandled = true;
|
||||
self.__decStopped = false;
|
||||
}
|
||||
|
||||
// If this was a slower move it is per default non decelerated, but this
|
||||
|
||||
Reference in New Issue
Block a user