Add modifier keys to every keyboard and mouse input (#247)

* Add modifier keys to every keyboard and mouse input

* Fix bad naming convention in Typescript

* Added some tests related to modifier keys
This commit is contained in:
Simon Desloges
2021-07-11 20:46:00 -07:00
committed by GitHub
parent 3fc7722d89
commit 63b849fac3
6 changed files with 159 additions and 32 deletions
+4 -4
View File
@@ -1,7 +1,7 @@
use crate::{
input::{
mouse::{MouseKeys, MouseState, ViewportPosition},
InputPreprocessorMessage,
InputPreprocessorMessage, ModifierKeys,
},
message_prelude::{Message, ToolMessage},
tool::ToolType,
@@ -51,15 +51,15 @@ impl EditorTestUtils for Editor {
}
fn move_mouse(&mut self, x: u32, y: u32) {
self.input(InputPreprocessorMessage::MouseMove(ViewportPosition { x, y }));
self.input(InputPreprocessorMessage::MouseMove(ViewportPosition { x, y }, ModifierKeys::default()));
}
fn mousedown(&mut self, state: MouseState) {
self.input(InputPreprocessorMessage::MouseDown(state));
self.input(InputPreprocessorMessage::MouseDown(state, ModifierKeys::default()));
}
fn mouseup(&mut self, state: MouseState) {
self.handle_message(InputPreprocessorMessage::MouseUp(state)).unwrap()
self.handle_message(InputPreprocessorMessage::MouseUp(state, ModifierKeys::default())).unwrap()
}
fn lmb_mousedown(&mut self, x: u32, y: u32) {