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,10 +70,13 @@ where
/// Register a release for input `input`.
pub fn release(&mut self, input: T) {
self.pressed.remove(&input);
if self.pressed(input) {
self.just_released.insert(input);
}
self.pressed.remove(&input);
}
/// Check if `input` has been just pressed.
pub fn just_pressed(&self, input: T) -> bool {
self.just_pressed.contains(&input)