Ignore out-of-range mouse button values using from_bits_truncate (#3541)
* fix: ignore out-of-range mouse button values using from_bits_truncate * Apply suggestion from @TrueDoctor * Fix formatting --------- Co-authored-by: Dennis Kobert <dennis@kobert.dev>
This commit is contained in:
parent
33e3a88458
commit
5dd11bf138
|
|
@ -76,7 +76,8 @@ pub struct EditorMouseState {
|
|||
|
||||
impl EditorMouseState {
|
||||
pub fn from_keys_and_editor_position(keys: u8, editor_position: EditorPosition) -> Self {
|
||||
let mouse_keys = MouseKeys::from_bits(keys).expect("Invalid decoding of MouseKeys");
|
||||
// TODO: Some graphic tablets send key codes not mentioned in the spec. In the future we would like to support these as well.
|
||||
let mouse_keys = MouseKeys::from_bits_truncate(keys);
|
||||
|
||||
Self {
|
||||
editor_position,
|
||||
|
|
|
|||
Loading…
Reference in New Issue