mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Deselect food, egg, and potion when hitting the escape key
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user