mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-23 15:30:14 -04:00
Merge branch '10-swipe-to-close-on-mobile' into 'main'
Resolve "Swipe to Close on Mobile doesn't work properly" Closes #10 See merge request walljm/dynamicbible!17
This commit is contained in:
commit
fd2f94e702
@ -53,6 +53,7 @@ export class Swipe {
|
|||||||
|
|
||||||
private bodyTouchStart(event: TouchEvent) {
|
private bodyTouchStart(event: TouchEvent) {
|
||||||
const t = event.touches[0];
|
const t = event.touches[0];
|
||||||
|
console.log(this.swipeInfo);
|
||||||
this.swipeInfo.x1 = t.pageX;
|
this.swipeInfo.x1 = t.pageX;
|
||||||
this.swipeInfo.y1 = t.pageY;
|
this.swipeInfo.y1 = t.pageY;
|
||||||
this.swipeInfo.x2 = 0;
|
this.swipeInfo.x2 = 0;
|
||||||
@ -277,16 +278,14 @@ export class Swipe {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Math.abs(this.swipeInfo.x2 - this.swipeInfo.x1) > 10) {
|
// if the user has moved more than 5 pixels x then they're swiping
|
||||||
// if the user has moved more than 5 pixels x then they're swiping
|
this.swipeInfo.scrolling = false;
|
||||||
this.swipeInfo.scrolling = false;
|
// disable scrolling
|
||||||
// disable scrolling
|
window.document.body.classList.add('lock-scroll');
|
||||||
window.document.body.classList.add('lock-scroll');
|
if (this.isIosDevice) {
|
||||||
if (this.isIosDevice) {
|
// css overflow:hidden doesn't work on the body for iOS so we have to use a
|
||||||
// css overflow:hidden doesn't work on the body for iOS so we have to use a
|
// non-passive listener and preventdefault to prevent scrolling
|
||||||
// non-passive listener and preventdefault to prevent scrolling
|
event.preventDefault();
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user