diff options
author | Akshay <[email protected]> | 2021-04-02 05:46:17 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2021-04-02 05:46:17 +0100 |
commit | 46236d9e2533cc57630548b9a701eb0089cd1293 (patch) | |
tree | f1a8174e44a01796d78aa90cfa97a2944cf9abe3 /src/app.rs | |
parent | 84a2475799b711b3bd460bc283d0abb27b9014fd (diff) |
keybind F cycles brush instead
Diffstat (limited to 'src/app.rs')
-rw-r--r-- | src/app.rs | 22 |
1 files changed, 10 insertions, 12 deletions
@@ -147,6 +147,15 @@ impl<'ctx> AppState<'ctx> { | |||
147 | } | 147 | } |
148 | } | 148 | } |
149 | 149 | ||
150 | pub fn cycle_brush(&mut self) { | ||
151 | self.brush = match self.brush { | ||
152 | Brush::Circle(_) => Brush::line(0, false), | ||
153 | Brush::Line(LineBrush { extend: false, .. }) => Brush::line(0, true), | ||
154 | Brush::Line(LineBrush { extend: true, .. }) => Brush::Fill, | ||
155 | _ => Brush::new(0), | ||
156 | } | ||
157 | } | ||
158 | |||
150 | pub fn paint_point<P: Into<Point>>( | 159 | pub fn paint_point<P: Into<Point>>( |
151 | &mut self, | 160 | &mut self, |
152 | center: P, | 161 | center: P, |
@@ -666,19 +675,8 @@ impl<'ctx> AppState<'ctx> { | |||
666 | self.pixmap.invert(); | 675 | self.pixmap.invert(); |
667 | self.undo_stack.push(ModifyRecord::Invert); | 676 | self.undo_stack.push(ModifyRecord::Invert); |
668 | } | 677 | } |
669 | // line drawing | 678 | Keycode::F => self.cycle_brush(), |
670 | Keycode::F => { | ||
671 | if matches!( | ||
672 | self.brush, | ||
673 | Brush::Line(LineBrush { extend: false, .. }) | ||
674 | ) { | ||
675 | self.brush = Brush::line(0, true); | ||
676 | } else { | ||
677 | self.brush = Brush::line(0, false); | ||
678 | } | ||
679 | } | ||
680 | // bucket fill tool | 679 | // bucket fill tool |
681 | Keycode::B => self.brush = Brush::Fill, | ||
682 | Keycode::V => self.cycle_symmetry(), | 680 | Keycode::V => self.cycle_symmetry(), |
683 | // undo & redo | 681 | // undo & redo |
684 | Keycode::U => { | 682 | Keycode::U => { |