Skip to content

Commit 94f06cb

Browse files
fix the sticky key down
1 parent 9b38581 commit 94f06cb

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/lib.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,19 @@ impl EventHandler for Stage {
792792
}
793793

794794
fn window_minimized_event(&mut self) {
795+
let context = get_context();
796+
795797
#[cfg(target_os = "android")]
796-
get_context().audio_context.pause();
798+
context.audio_context.pause();
799+
800+
// Clear held down keys and button and announce them as released
801+
context.mouse_released.extend(context.mouse_down.drain());
802+
context.keys_released.extend(context.keys_down.drain());
803+
804+
// Announce all touches as released
805+
for (_, touch) in context.touches.iter_mut() {
806+
touch.phase = input::TouchPhase::Ended;
807+
}
797808
}
798809

799810
fn quit_requested_event(&mut self) {

0 commit comments

Comments
 (0)