Fix touch position being null when touching with multiple fingers
This commit is contained in:
parent
bebc9db629
commit
bb6a9657a0
@ -28,20 +28,19 @@ class SlideoutMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onTouchStart(e) {
|
function onTouchStart(e) {
|
||||||
|
touchStartPos = touchCurPos = e.touches.item(0);
|
||||||
|
|
||||||
if (e.touches.length !== 1) {
|
if (e.touches.length !== 1) {
|
||||||
onTouchEnd();
|
onTouchEnd();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const touch = e.touches.item(0);
|
|
||||||
const styles = window.getComputedStyle(menu);
|
const styles = window.getComputedStyle(menu);
|
||||||
|
|
||||||
menuWidth = parseFloat(styles.width);
|
menuWidth = parseFloat(styles.width);
|
||||||
menuIsAbsolute = styles.position === "absolute";
|
menuIsAbsolute = styles.position === "absolute";
|
||||||
|
|
||||||
if (!menuIsOpen || touch.screenX > menuWidth) {
|
if (!menuIsOpen || touchStartPos.screenX > menuWidth) {
|
||||||
touchStartPos = touch;
|
|
||||||
touchCurPos = touch;
|
|
||||||
touchStartTime = Date.now();
|
touchStartTime = Date.now();
|
||||||
|
|
||||||
document.body.addEventListener("touchmove", onTouchMove, {passive: true});
|
document.body.addEventListener("touchmove", onTouchMove, {passive: true});
|
||||||
|
Loading…
Reference in New Issue
Block a user