Permalink
Browse files

change event.keyCode to event.which

  • Loading branch information...
1 parent a6b921a commit 32e1eada580c1926a3dd338d299e577b66775d76 gman committed Jun 4, 2014
Showing with 11 additions and 11 deletions.
  1. +7 −7 aquarium/aquarium.js
  2. +2 −2 color-adjust/color-adjust.html
  3. +2 −2 field/field.html
View
@@ -1708,17 +1708,17 @@ $(function(){
$('#topUI').hide();
} else {
$(document).keypress(function(event) {
- if (event.keyCode == 'l'.charCodeAt(0) ||
- event.keyCode == 'L'.charCodeAt(0)) {
+ if (event.which == 'l'.charCodeAt(0) ||
+ event.which == 'L'.charCodeAt(0)) {
setSettings({drawLasers: !g.drawLasers});
- } else if (event.keyCode == ' '.charCodeAt(0)) {
+ } else if (event.which == ' '.charCodeAt(0)) {
advanceViewSettings();
- } else if (event.keyCode == 's'.charCodeAt(0) ||
- event.keyCode == 'S'.charCodeAt(0)) {
+ } else if (event.which == 's'.charCodeAt(0) ||
+ event.which == 'S'.charCodeAt(0)) {
tdl.screenshot.takeScreenshot(
document.getElementById("canvas"));
- } else if (event.keyCode == 'h'.charCodeAt(0) ||
- event.keyCode == 'H'.charCodeAt(0)) {
+ } else if (event.which == 'h'.charCodeAt(0) ||
+ event.which == 'H'.charCodeAt(0)) {
$('#topUI').toggle();
}
});
@@ -383,8 +383,8 @@
var showRT = false;
$(document).keypress(function(event) {
- if (event.keyCode == 'd'.charCodeAt(0) ||
- event.keyCode == 'D'.charCodeAt(0)) {
+ if (event.which == 'd'.charCodeAt(0) ||
+ event.which == 'D'.charCodeAt(0)) {
showRT = !showRT;
tdl.log(showRT);
}
View
@@ -693,8 +693,8 @@
uiElem.appendChild(div);
}
$(document).keypress(function(event) {
- if (event.keyCode == 'd'.charCodeAt(0) ||
- event.keyCode == 'D'.charCodeAt(0)) {
+ if (event.which == 'd'.charCodeAt(0) ||
+ event.which == 'D'.charCodeAt(0)) {
g.globals.showRT = (g.globals.showRT + 1) % 5;
}
});

0 comments on commit 32e1ead

Please sign in to comment.