From 84a1ea6cfdfe6207da85eb71bbab8881fe10c6a8 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 5 Dec 2022 17:11:53 +0100 Subject: [PATCH] cargo fmt --- crates/egui/src/data/input.rs | 4 ++-- crates/egui/src/input_state.rs | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/crates/egui/src/data/input.rs b/crates/egui/src/data/input.rs index 635d61754..b3fbcba08 100644 --- a/crates/egui/src/data/input.rs +++ b/crates/egui/src/data/input.rs @@ -191,8 +191,8 @@ pub enum Event { modifiers: Modifiers, }, - /// A key was repeated while pressed. - KeyRepeat { + /// A key was repeated while pressed. + KeyRepeat { key: Key, /// The state of the modifier keys at the time of the event. diff --git a/crates/egui/src/input_state.rs b/crates/egui/src/input_state.rs index 0e7dee6b8..0d5593d8c 100644 --- a/crates/egui/src/input_state.rs +++ b/crates/egui/src/input_state.rs @@ -166,13 +166,20 @@ impl InputState { let mut zoom_factor_delta = 1.0; for event in &mut new.events { match event { - Event::Key { key, pressed, modifiers } => { + Event::Key { + key, + pressed, + modifiers, + } => { if *pressed { // We only retain presses that are novel (i.e. the first Press event, not those generated by key-repeat) // key repeats are represented by KeyRepeat. if !keys_down.insert(*key) { - *event = Event::KeyRepeat { key: *key, modifiers: *modifiers }; - } + *event = Event::KeyRepeat { + key: *key, + modifiers: *modifiers, + }; + } } else { keys_down.remove(key); } @@ -183,7 +190,7 @@ impl InputState { Event::Zoom(factor) => { zoom_factor_delta *= *factor; } - _ => {}, + _ => {} } }