1
0
Fork 0
mirror of https://github.com/GuerillaStudio/now-playing synced 2024-11-30 00:01:39 +00:00

Fix passive and non-passive event listeners of mobile menu's gesture

This commit is contained in:
Tixie Salander 2024-11-09 02:41:12 +01:00
parent 358dfc4761
commit 7e5c84b647
No known key found for this signature in database

View file

@ -19,23 +19,23 @@ class MobileMenu {
bindEvents () { bindEvents () {
document.addEventListener('touchstart', (event) => { document.addEventListener('touchstart', (event) => {
this.touchStart(event) this.touchStart(event)
}, false) }, {passive: true}, false)
document.addEventListener('touchmove', (event) => { document.addEventListener('touchmove', (event) => {
this.touchMove(event) this.touchMove(event)
}, false) }, {passive: false}, false)
document.addEventListener('touchend', (event) => { document.addEventListener('touchend', (event) => {
this.touchEnd(event) this.touchEnd(event)
}, false) }, {passive: true}, false)
this.btn.addEventListener('click', (event) => { this.btn.addEventListener('click', (event) => {
this.toggleMenu(event) this.toggleMenu(event)
}, false) }, false)
this.overlay.addEventListener('touchstart', (event) => { this.overlay.addEventListener('touchstart', (event) => {
this.touchAction = true this.touchAction = true
}, false) }, {passive: true}, false)
this.overlay.addEventListener('touchend', (event) => { this.overlay.addEventListener('touchend', (event) => {
this.toggleMenu(event) this.toggleMenu(event)
this.touchAction = false this.touchAction = false
}, false) }, {passive: true}, false)
this.overlay.addEventListener('click', (event) => { this.overlay.addEventListener('click', (event) => {
this.toggleMenu(event) this.toggleMenu(event)
if (this.touchAction) return if (this.touchAction) return