From b0685c1638044b85dc7e8b07555a7b639b54d69a Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 11 Apr 2021 15:31:18 +0530 Subject: add rect select brush and keybinds --- src/brush.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/brush.rs') diff --git a/src/brush.rs b/src/brush.rs index 8557ba7..8d3ee1c 100644 --- a/src/brush.rs +++ b/src/brush.rs @@ -25,8 +25,9 @@ pub struct CircleBrush { #[derive(Debug, Copy, Clone)] pub struct RectSelectBrush { - pub start: MapPoint, - pub end: MapPoint, + pub start: Option, + pub end: Option, + pub active_end: bool, } impl Brush { @@ -60,8 +61,20 @@ impl Brush { }) } + pub fn rect() -> Self { + Brush::RectSelect(RectSelectBrush { + start: None, + end: None, + active_end: true, + }) + } + pub fn is_line(&self) -> bool { - matches!(self, Self::Line { .. }) + matches!(self, Self::Line(_)) + } + + pub fn is_rect(&self) -> bool { + matches!(self, Self::RectSelect(_)) } pub fn size(&self) -> Option { -- cgit v1.2.3