Skip to content

Commit

Permalink
make linter more happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Gabriel committed Feb 23, 2024
1 parent 7cecf51 commit 71c9456
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions src/sketch_board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ pub enum SketchBoardOutput {

#[derive(Debug, Clone)]
pub enum InputEvent {
MouseEvent(MouseEventMsg),
KeyEvent(KeyEventMsg),
TextEvent(TextEventMsg),
Mouse(MouseEventMsg),
Key(KeyEventMsg),
Text(TextEventMsg),
}

// from https://flatuicolors.com/palette/au
Expand Down Expand Up @@ -84,19 +84,19 @@ impl SketchBoardInput {
modifier: ModifierType,
pos: Vec2D,
) -> SketchBoardInput {
SketchBoardInput::InputEvent(InputEvent::MouseEvent(MouseEventMsg {
SketchBoardInput::InputEvent(InputEvent::Mouse(MouseEventMsg {
type_: event_type,
button: button.into(),
modifier,
pos,
}))
}
pub fn new_key_event(event: KeyEventMsg) -> SketchBoardInput {
SketchBoardInput::InputEvent(InputEvent::KeyEvent(event))
SketchBoardInput::InputEvent(InputEvent::Key(event))
}

pub fn new_text_event(event: TextEventMsg) -> SketchBoardInput {
SketchBoardInput::InputEvent(InputEvent::TextEvent(event))
SketchBoardInput::InputEvent(InputEvent::Text(event))
}
}

Expand All @@ -118,7 +118,7 @@ impl InputEvent {
}

fn remap_event_coordinates(&mut self, scale: f64) {
if let InputEvent::MouseEvent(me) = self {
if let InputEvent::Mouse(me) = self {
Self::screen2image(&mut me.pos, scale)
};
}
Expand Down Expand Up @@ -421,7 +421,7 @@ impl Component for SketchBoard {
}

SketchBoardInput::InputEvent(mut ie) => {
if let InputEvent::KeyEvent(ke) = ie {
if let InputEvent::Key(ke) = ie {
if ke.key == Key::z && ke.modifier == ModifierType::CONTROL_MASK {
self.handle_undo()
} else if ke.key == Key::y && ke.modifier == ModifierType::CONTROL_MASK {
Expand Down
6 changes: 3 additions & 3 deletions src/tools/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ pub trait Tool {

fn handle_input_event(&mut self, event: InputEvent) -> ToolUpdateResult {
match event {
InputEvent::MouseEvent(e) => self.handle_mouse_event(e),
InputEvent::KeyEvent(e) => self.handle_key_event(e),
InputEvent::TextEvent(e) => self.handle_text_event(e),
InputEvent::Mouse(e) => self.handle_mouse_event(e),
InputEvent::Key(e) => self.handle_key_event(e),
InputEvent::Text(e) => self.handle_text_event(e),
}
}

Expand Down

0 comments on commit 71c9456

Please sign in to comment.