Skip to content

Commit

Permalink
fixed touch bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gawainhewitt committed Sep 20, 2022
1 parent 7454f89 commit 74921da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ function handleMouseUp() {
var elem = evt.targetTouches[0].target.id; //returns the id of the element that triggered the touch
console.log("image id = "+elem); //debugging
for(var i = 0; i < 9; i++) { // for loop to check which element it is and get a number to send to the synth
if(elem === "i"+i){ // this looks confusing because the id name also contains "i" - see that HTML
if(elem === "image"+i){ // this looks confusing because the id name also contains "i" - see that HTML
playSynth(i); // call the playSynth function
}
}
Expand Down Expand Up @@ -277,7 +277,7 @@ function handleMouseUp() {
var elem = touches[0].target.id //returns the id of the element that triggered the touch (that has just ended)
console.log("ended image id = "+elem); //debugging
for(var i = 0; i < 9; i++) { //get a number to end the right note
if(elem === "i"+i){
if(elem === "image"+i){
stopSynth(i); // call stopSynth
}
}
Expand Down

0 comments on commit 74921da

Please sign in to comment.