Skip to content

Commit

Permalink
Update joy.js
Browse files Browse the repository at this point in the history
  • Loading branch information
wizard1146 authored Apr 25, 2024
1 parent d7196b7 commit 4878806
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js/joy.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,15 @@ let joy = (function() {

/* Touch functions */
touch(e) {
e.preventDefault()
this.pressed = 1
this.toucher = e.targetTouches[0].identifier
}
touching(e) {
// Failure conditions
// if (!this.toucher) return
// if (!e.targetTouches[0].target == this.canvas) return
e.preventDefault()
if (this.pressed === 1 && e.targetTouches[0].target === this.canvas) {
this.rx = e.targetTouches[0].pageX
this.ry = e.targetTouches[0].pageY
Expand All @@ -209,6 +211,7 @@ let joy = (function() {
}
}
touched(e) {
e.preventDefault()
if (e.changedTouches[0].identifier !== this.toucher) return
this.pressed = 0
// Return to the origin
Expand Down

0 comments on commit 4878806

Please sign in to comment.