mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 06:30:19 +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,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.
|
||||||
|
|
Loading…
Reference in a new issue