updated Uikit v2
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*! UIkit 2.25.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
||||
/*! UIkit 2.27.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
||||
// Based on Zeptos touch.js
|
||||
// https://raw.github.com/madrobby/zepto/master/src/touch.js
|
||||
// Zepto.js may be freely distributed under the MIT license.
|
||||
@@ -11,6 +11,12 @@
|
||||
|
||||
|
||||
var touch = {}, touchTimeout, tapTimeout, swipeTimeout, longTapTimeout, longTapDelay = 750, gesture;
|
||||
var hasTouchEvents = 'ontouchstart' in window,
|
||||
hasPointerEvents = window.PointerEvent,
|
||||
hasTouch = hasTouchEvents
|
||||
|| window.DocumentTouch && document instanceof DocumentTouch
|
||||
|| navigator.msPointerEnabled && navigator.msMaxTouchPoints > 0 // IE 10
|
||||
|| navigator.pointerEnabled && navigator.maxTouchPoints > 0; // IE >=11
|
||||
|
||||
function swipeDirection(x1, x2, y1, y2) {
|
||||
return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down');
|
||||
@@ -83,7 +89,7 @@
|
||||
longTapTimeout = setTimeout(longTap, longTapDelay);
|
||||
|
||||
// adds the current touch contact for IE gesture recognition
|
||||
if (gesture && ( e.type == 'MSPointerDown' || e.type == 'pointerdown' || e.type == 'touchstart' ) ) {
|
||||
if (e.originalEvent && e.originalEvent.pointerId && gesture && ( e.type == 'MSPointerDown' || e.type == 'pointerdown' || e.type == 'touchstart' ) ) {
|
||||
gesture.addPointer(e.originalEvent.pointerId);
|
||||
}
|
||||
|
||||
@@ -162,7 +168,14 @@
|
||||
// when the browser window loses focus,
|
||||
// for example when a modal dialog is shown,
|
||||
// cancel all ongoing events
|
||||
.on('touchcancel MSPointerCancel', cancelAll);
|
||||
.on('touchcancel MSPointerCancel pointercancel', function(e){
|
||||
|
||||
// Ignore pointercancel if the event supports touch events, to prevent pointercancel in swipe gesture
|
||||
if ((e.type == 'touchcancel' && hasTouchEvents && hasTouch) || (!hasTouchEvents && e.type == 'pointercancel' && hasPointerEvents)) {
|
||||
cancelAll();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// scrolling the window indicates intention of the user
|
||||
// to scroll, not tap or swipe, so cancel all ongoing events
|
||||
|
Reference in New Issue
Block a user