Skip to content

Commit

Permalink
Merge pull request RobertWHurst#28 from nathanadams/minor-fixes
Browse files Browse the repository at this point in the history
Added nathanadams Minor fixes
  • Loading branch information
Robert Hurst authored and Robert Hurst committed Aug 27, 2012
2 parents 25f0f95 + 18298c7 commit d8369f1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
});

//bind to the window blur event and clear all pressed keys
bind(window, "blur", function() {
bind(window, "blur", function(event) {
activeKeys = [];

//execute the end callback on the active key binding
Expand Down Expand Up @@ -175,16 +175,17 @@

var bindingStack = queryActiveBindings(),
spentKeys = [],
output;
output,
key, keyIndex;

//loop through each active binding
for (var bindingIndex = 0; bindingIndex < bindingStack.length; bindingIndex += 1) {
var binding = bindingStack[bindingIndex],
usesSpentKey = false;

//check each of the required keys. Make sure they have not been used by another binding
for(var keyIndex = 0; keyIndex < binding.keys.length; keyIndex += 1) {
var key = binding.keys[keyIndex];
for(keyIndex = 0; keyIndex < binding.keys.length; keyIndex += 1) {
key = binding.keys[keyIndex];
if(spentKeys.indexOf(key) > -1) {
usesSpentKey = true;
break;
Expand All @@ -207,8 +208,8 @@
}

//add the current key binding's keys to the spent keys array
for(var keyIndex = 0; keyIndex < binding.keys.length; keyIndex += 1) {
var key = binding.keys[keyIndex];
for(keyIndex = 0; keyIndex < binding.keys.length; keyIndex += 1) {
key = binding.keys[keyIndex];
if(spentKeys.indexOf(key) < 0) {
spentKeys.push(key);
}
Expand Down

0 comments on commit d8369f1

Please sign in to comment.