Browse files

Merge pull request #4 from doubledare/patch-spurious-keyup-events

Fix for QH calling keyUp callback on mouseOut when mouseButton is up
  • Loading branch information...
2 parents 6bca917 + 3c15037 commit 5458ddd004c18221a2cb826ab56b7fcc7acb8596 @stuartmemo committed Oct 28, 2012
Showing with 9 additions and 5 deletions.
  1. +9 −5 qwerty-hancock.js
View
14 qwerty-hancock.js
@@ -99,8 +99,10 @@
noteDown = false;
keyUpCallback(this.attr('title'), getFrequency(this.attrs.title));
}).mouseout(function () {
- this.attr({fill: whiteNotesColour});
- keyUpCallback(this.attr('title'), getFrequency(this.attrs.title));
+ if (noteDown) {
+ this.attr({fill: whiteNotesColour});
+ keyUpCallback(this.attr('title'), getFrequency(this.attrs.title));
+ }
});
noteCounter++;
@@ -132,12 +134,14 @@
keyDownCallback(this.attr('title'), getFrequency(this.attrs.title));
}
}).mouseup(function () {
- this.attr({fill: blackNotesColour});
+ this.attr({fill: blackNotesColour});
noteDown = false;
keyUpCallback(this.attr('title'), getFrequency(this.attrs.title));
}).mouseout(function () {
- this.attr({fill: blackNotesColour});
- keyUpCallback(this.attr('title'), getFrequency(this.attrs.title));
+ if (noteDown) {
+ this.attr({fill: blackNotesColour});
+ keyUpCallback(this.attr('title'), getFrequency(this.attrs.title));
+ }
});
}
}

0 comments on commit 5458ddd

Please sign in to comment.