mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
cargo fmt
This commit is contained in:
@@ -191,8 +191,8 @@ pub enum Event {
|
|||||||
modifiers: Modifiers,
|
modifiers: Modifiers,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// A key was repeated while pressed.
|
/// A key was repeated while pressed.
|
||||||
KeyRepeat {
|
KeyRepeat {
|
||||||
key: Key,
|
key: Key,
|
||||||
|
|
||||||
/// The state of the modifier keys at the time of the event.
|
/// The state of the modifier keys at the time of the event.
|
||||||
|
|||||||
@@ -166,12 +166,19 @@ impl InputState {
|
|||||||
let mut zoom_factor_delta = 1.0;
|
let mut zoom_factor_delta = 1.0;
|
||||||
for event in &mut new.events {
|
for event in &mut new.events {
|
||||||
match event {
|
match event {
|
||||||
Event::Key { key, pressed, modifiers } => {
|
Event::Key {
|
||||||
|
key,
|
||||||
|
pressed,
|
||||||
|
modifiers,
|
||||||
|
} => {
|
||||||
if *pressed {
|
if *pressed {
|
||||||
// We only retain presses that are novel (i.e. the first Press event, not those generated by key-repeat)
|
// 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.
|
// key repeats are represented by KeyRepeat.
|
||||||
if !keys_down.insert(*key) {
|
if !keys_down.insert(*key) {
|
||||||
*event = Event::KeyRepeat { key: *key, modifiers: *modifiers };
|
*event = Event::KeyRepeat {
|
||||||
|
key: *key,
|
||||||
|
modifiers: *modifiers,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
keys_down.remove(key);
|
keys_down.remove(key);
|
||||||
@@ -183,7 +190,7 @@ impl InputState {
|
|||||||
Event::Zoom(factor) => {
|
Event::Zoom(factor) => {
|
||||||
zoom_factor_delta *= *factor;
|
zoom_factor_delta *= *factor;
|
||||||
}
|
}
|
||||||
_ => {},
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user