Skip to content

Commit 5dd11bf

Browse files
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>
1 parent 33e3a88 commit 5dd11bf

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

editor/src/messages/input_mapper/utility_types/input_mouse.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ pub struct EditorMouseState {
7676

7777
impl EditorMouseState {
7878
pub fn from_keys_and_editor_position(keys: u8, editor_position: EditorPosition) -> Self {
79-
let mouse_keys = MouseKeys::from_bits(keys).expect("Invalid decoding of MouseKeys");
79+
// TODO: Some graphic tablets send key codes not mentioned in the spec. In the future we would like to support these as well.
80+
let mouse_keys = MouseKeys::from_bits_truncate(keys);
8081

8182
Self {
8283
editor_position,

0 commit comments

Comments
 (0)