-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix modifiers not working in kittest #5693
base: master
Are you sure you want to change the base?
Conversation
Preview available at https://egui-pr-preview.github.io/pr/5693-fix-kittest-modifiers |
let modifiers = modifiers | self.input.modifiers; | ||
let previous_modifiers = mem::replace(&mut self.input.modifiers, modifiers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: simpler/shorter
let modifiers = modifiers | self.input.modifiers; | |
let previous_modifiers = mem::replace(&mut self.input.modifiers, modifiers); | |
let previous_modifiers = self.input.modifiers; | |
self.input.modifiers |= modifiers; |
last_mouse_pos: Pos2, | ||
} | ||
|
||
impl EventState { | ||
pub fn kittest_event_to_egui(&mut self, event: kittest::Event) -> Option<egui::Event> { | ||
/// Map the kittest events to egui events, add them to the input and update the modifiers. | ||
/// This function accesses `egui::RawInput::modifiers`, make sure it is not reset after each |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// This function accesses `egui::RawInput::modifiers`, make sure it is not reset after each | |
/// This function accesses `egui::RawInput::modifiers`. Make sure it is not reset after each |
} | ||
|
||
/// Press a key with modifiers. | ||
/// This will create a key down event and a key up event. | ||
/// This will create a key down event, a key up event and update the modifiers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// This will create a key down event, a key up event and update the modifiers. | |
/// This will create a key-down event, a key-up event, and update the modifiers. |
It still isn't ideal, since you have to remember to call key_up on a separate frame.