From 46236d9e2533cc57630548b9a701eb0089cd1293 Mon Sep 17 00:00:00 2001 From: Akshay Date: Fri, 2 Apr 2021 10:16:17 +0530 Subject: keybind F cycles brush instead --- src/app.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src/app.rs') diff --git a/src/app.rs b/src/app.rs index 1b192df..16a4433 100644 --- a/src/app.rs +++ b/src/app.rs @@ -147,6 +147,15 @@ impl<'ctx> AppState<'ctx> { } } + pub fn cycle_brush(&mut self) { + self.brush = match self.brush { + Brush::Circle(_) => Brush::line(0, false), + Brush::Line(LineBrush { extend: false, .. }) => Brush::line(0, true), + Brush::Line(LineBrush { extend: true, .. }) => Brush::Fill, + _ => Brush::new(0), + } + } + pub fn paint_point>( &mut self, center: P, @@ -666,19 +675,8 @@ impl<'ctx> AppState<'ctx> { self.pixmap.invert(); self.undo_stack.push(ModifyRecord::Invert); } - // line drawing - Keycode::F => { - if matches!( - self.brush, - Brush::Line(LineBrush { extend: false, .. }) - ) { - self.brush = Brush::line(0, true); - } else { - self.brush = Brush::line(0, false); - } - } + Keycode::F => self.cycle_brush(), // bucket fill tool - Keycode::B => self.brush = Brush::Fill, Keycode::V => self.cycle_symmetry(), // undo & redo Keycode::U => { -- cgit v1.2.3