Check an Input's pressed set before adding to just_released. (#4209)

# Objective

- Fixes #4208

## Solution

- Adds a check before inserting into an `Input`'s `just_released` set, in the same way that one exists for adding into the `just_pressed` set.
This commit is contained in:
Chris Foster 2022-03-20 21:54:09 +00:00
parent 3e631e6234
commit b0ddce36bd

View file

@ -70,8 +70,11 @@ where
/// Register a release for input `input`. /// Register a release for input `input`.
pub fn release(&mut self, input: T) { pub fn release(&mut self, input: T) {
if self.pressed(input) {
self.just_released.insert(input);
}
self.pressed.remove(&input); self.pressed.remove(&input);
self.just_released.insert(input);
} }
/// Check if `input` has been just pressed. /// Check if `input` has been just pressed.