Fix ripple again
This commit is contained in:
parent
38867d6e56
commit
cd418286b7
@ -56,6 +56,7 @@ export function ripple(elem: HTMLElement, callback: (id: number) => Promise<bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
handler = null;
|
handler = null;
|
||||||
|
touchStartFired = false;
|
||||||
};
|
};
|
||||||
//});
|
//});
|
||||||
|
|
||||||
@ -126,6 +127,7 @@ export function ripple(elem: HTMLElement, callback: (id: number) => Promise<bool
|
|||||||
//});
|
//});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: rename this variable
|
||||||
let touchStartFired = false;
|
let touchStartFired = false;
|
||||||
if(touchSupport) {
|
if(touchSupport) {
|
||||||
let touchEnd = () => {
|
let touchEnd = () => {
|
||||||
@ -134,7 +136,10 @@ export function ripple(elem: HTMLElement, callback: (id: number) => Promise<bool
|
|||||||
|
|
||||||
elem.addEventListener('touchstart', (e) => {
|
elem.addEventListener('touchstart', (e) => {
|
||||||
//console.log('ripple touchstart', e);
|
//console.log('ripple touchstart', e);
|
||||||
if(e.touches.length > 1 || ((e.target as HTMLElement).tagName == 'BUTTON' && e.target != elem) || findUpClassName(e.target as HTMLElement, 'c-ripple') != r) {
|
if(e.touches.length > 1
|
||||||
|
|| touchStartFired
|
||||||
|
|| ((e.target as HTMLElement).tagName == 'BUTTON' && e.target != elem)
|
||||||
|
|| findUpClassName(e.target as HTMLElement, 'c-ripple') != r) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +154,7 @@ export function ripple(elem: HTMLElement, callback: (id: number) => Promise<bool
|
|||||||
e.cancelBubble = true;
|
e.cancelBubble = true;
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
touchEnd();
|
touchEnd();
|
||||||
window.removeEventListener('touchend', touchEnd);
|
elem.removeEventListener('touchend', touchEnd);
|
||||||
}, {once: true});
|
}, {once: true});
|
||||||
}, {passive: true});
|
}, {passive: true});
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user