Added null checks

This commit is contained in:
2019-04-19 22:12:33 +09:00
parent 912f409688
commit 707233a422
11 changed files with 94 additions and 51 deletions

View File

@ -15,6 +15,8 @@ export default class TouchController {
this.downSwipe = this.upSwipe = this.rightSwipe = this.leftSwipe = () => null
this.threshold = 3
this.x = -1
this.y = -1
}
handleTouchStart(evt) {
@ -23,7 +25,7 @@ export default class TouchController {
}
handleTouchMove(evt) {
if(!this.x || !this.y) {
if(this.x === -1 || this.y === -1) {
return
}
@ -47,7 +49,7 @@ export default class TouchController {
}
}
this.x = undefined
this.y = undefined
this.x = -1
this.y = -1
}
}