Deselect food, egg, and potion when hitting the escape key

This commit is contained in:
TheHollidayInn
2015-07-21 21:52:29 -05:00
parent 11f56d491c
commit 107e27a2c6
3 changed files with 44 additions and 1 deletions

View File

@@ -211,5 +211,25 @@ habitrpg.controller("InventoryCtrl",
break;
}
};
$scope.$on("habit:keyup", function (e, keyEvent) {
if (keyEvent.keyCode == "27") {
$scope.deselectItem();
}
});
//$scope.listen(keyEvent)
$scope.deselectItem = function() {
if ($scope.selectedFood) {
$scope.selectedFood = null;
}
if ($scope.selectedPotion) {
$scope.selectedPotion = null
}
if ($scope.selectedEgg) {
$scope.selectedEgg = null;
}
}
}
]);