mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-16 07:58:33 +00:00
Merge pull request #253 from aclysma/fix-backspace-text-entry
Fix backspace text entry
This commit is contained in:
commit
744e8f40b6
@ -441,7 +441,13 @@ impl WinitPlatform {
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
WindowEvent::ReceivedCharacter(ch) => io.add_input_character(ch),
|
||||
WindowEvent::ReceivedCharacter(ch) => {
|
||||
// Exclude the backspace key ('\u{7f}'). Otherwise we will insert this char and then
|
||||
// delete it.
|
||||
if ch != '\u{7f}' {
|
||||
io.add_input_character(ch)
|
||||
}
|
||||
}
|
||||
WindowEvent::CursorMoved { position, .. } => {
|
||||
let position = self.scale_pos_from_winit(window, position);
|
||||
io.mouse_pos = [position.x as f32, position.y as f32];
|
||||
@ -474,7 +480,7 @@ impl WinitPlatform {
|
||||
MouseButton::Left => io.mouse_down[0] = pressed,
|
||||
MouseButton::Right => io.mouse_down[1] = pressed,
|
||||
MouseButton::Middle => io.mouse_down[2] = pressed,
|
||||
MouseButton::Other(idx @ 0...4) => io.mouse_down[idx as usize] = pressed,
|
||||
MouseButton::Other(idx @ 0..=4) => io.mouse_down[idx as usize] = pressed,
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user