mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
wip
This commit is contained in:
@@ -3,6 +3,10 @@ const DEFAULT_EXPIRE = 330;
|
||||
let cbEle, fallbackTimerId;
|
||||
let isShowing = false;
|
||||
|
||||
function disableInput(ev) {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
}
|
||||
|
||||
function show(expire) {
|
||||
clearTimeout(fallbackTimerId);
|
||||
@@ -18,6 +22,7 @@ function show(expire) {
|
||||
cbEle.className = 'click-block ' + CSS_CLICK_BLOCK;
|
||||
document.body.appendChild(cbEle);
|
||||
}
|
||||
cbEle.addEventListener('touchmove', disableInput);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +31,7 @@ function hide() {
|
||||
if (isShowing) {
|
||||
cbEle.classList.remove(CSS_CLICK_BLOCK);
|
||||
isShowing = false;
|
||||
cbEle.removeEventListener('touchmove', disableInput);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -158,3 +158,27 @@ export function windowLoad(callback) {
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
export function pointerCoord(ev) {
|
||||
// get coordinates for either a mouse click
|
||||
// or a touch depending on the given event
|
||||
let c = { x: 0, y: 0 };
|
||||
if (ev) {
|
||||
const touches = ev.touches && ev.touches.length ? ev.touches : [ev];
|
||||
const e = (ev.changedTouches && ev.changedTouches[0]) || touches[0];
|
||||
if (e) {
|
||||
c.x = e.clientX || e.pageX || 0;
|
||||
c.y = e.clientY || e.pageY || 0;
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
export function hasPointerMoved(tolerance, startCoord, endCoord) {
|
||||
return Math.abs(startCoord.x - endCoord.x) > tolerance ||
|
||||
Math.abs(startCoord.y - endCoord.y) > tolerance;
|
||||
}
|
||||
|
||||
export function hasFocus(ele) {
|
||||
return !!(ele && (document.activeElement === ele.nativeElement || document.activeElement === ele));
|
||||
}
|
||||
|
||||
@@ -103,8 +103,8 @@ var tapEventListeners = {
|
||||
Platform.ready().then(config => {
|
||||
|
||||
if (config.setting('tapPolyfill')) {
|
||||
console.log('Tap.register, tapPolyfill')
|
||||
Tap.register(document);
|
||||
// console.log('Tap.register, tapPolyfill')
|
||||
// Tap.register(document);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user