|
|
@ -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; |
|
|
|
} |
|
|
|
_ => {}, |
|
|
|
_ => {} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|