mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 20:53:53 +00:00
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:
parent
3e631e6234
commit
b0ddce36bd
1 changed files with 4 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue