Comparing version 0.4.6 to 0.4.7
@@ -35,2 +35,12 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
var isWebView = typeof navigator !== 'undefined' && /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent); | ||
function iOSWebViewFix(e, touchendFn) { | ||
// https://github.com/ant-design/ant-design-mobile/issues/573#issuecomment-339560829 | ||
// iOS UIWebView issue, It seems no problem in WKWebView | ||
if (isWebView && e.changedTouches[0].clientY < 0) { | ||
touchendFn(new Event('touchend') || e); | ||
} | ||
} | ||
var willPreventDefault = supportsPassive ? { passive: false } : false; | ||
@@ -290,2 +300,8 @@ var willNotPreventDefault = supportsPassive ? { passive: true } : false; | ||
var onTouchEnd = function onTouchEnd(e) { | ||
scroller.doTouchEnd(e.timeStamp); | ||
releaseLockTimer = setTimeout(function () { | ||
lockMouse = false; | ||
}, 300); | ||
}; | ||
@@ -296,2 +312,3 @@ if (preventDefaultOnTouchMove !== false) { | ||
scroller.doTouchMove(e.touches, e.timeStamp, e.scale); | ||
iOSWebViewFix(e, onTouchEnd); | ||
}, willPreventDefault); | ||
@@ -301,12 +318,6 @@ } else { | ||
scroller.doTouchMove(e.touches, e.timeStamp, e.scale); | ||
iOSWebViewFix(e, onTouchEnd); | ||
}, willNotPreventDefault); | ||
} | ||
var onTouchEnd = function onTouchEnd(e) { | ||
scroller.doTouchEnd(e.timeStamp); | ||
releaseLockTimer = setTimeout(function () { | ||
lockMouse = false; | ||
}, 300); | ||
}; | ||
this.bindEvent(container, 'touchend', onTouchEnd, willNotPreventDefault); | ||
@@ -313,0 +324,0 @@ this.bindEvent(container, 'touchcancel', onTouchEnd, willNotPreventDefault); |
@@ -48,2 +48,12 @@ 'use strict'; | ||
var isWebView = typeof navigator !== 'undefined' && /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent); | ||
function iOSWebViewFix(e, touchendFn) { | ||
// https://github.com/ant-design/ant-design-mobile/issues/573#issuecomment-339560829 | ||
// iOS UIWebView issue, It seems no problem in WKWebView | ||
if (isWebView && e.changedTouches[0].clientY < 0) { | ||
touchendFn(new Event('touchend') || e); | ||
} | ||
} | ||
var willPreventDefault = supportsPassive ? { passive: false } : false; | ||
@@ -303,2 +313,8 @@ var willNotPreventDefault = supportsPassive ? { passive: true } : false; | ||
var onTouchEnd = function onTouchEnd(e) { | ||
scroller.doTouchEnd(e.timeStamp); | ||
releaseLockTimer = setTimeout(function () { | ||
lockMouse = false; | ||
}, 300); | ||
}; | ||
@@ -309,2 +325,3 @@ if (preventDefaultOnTouchMove !== false) { | ||
scroller.doTouchMove(e.touches, e.timeStamp, e.scale); | ||
iOSWebViewFix(e, onTouchEnd); | ||
}, willPreventDefault); | ||
@@ -314,12 +331,6 @@ } else { | ||
scroller.doTouchMove(e.touches, e.timeStamp, e.scale); | ||
iOSWebViewFix(e, onTouchEnd); | ||
}, willNotPreventDefault); | ||
} | ||
var onTouchEnd = function onTouchEnd(e) { | ||
scroller.doTouchEnd(e.timeStamp); | ||
releaseLockTimer = setTimeout(function () { | ||
lockMouse = false; | ||
}, 300); | ||
}; | ||
this.bindEvent(container, 'touchend', onTouchEnd, willNotPreventDefault); | ||
@@ -326,0 +337,0 @@ this.bindEvent(container, 'touchcancel', onTouchEnd, willNotPreventDefault); |
{ | ||
"name": "zscroller", | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"description": "dom scroller based on zynga scroller", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
121740
3005