diff options
author | Akshay <[email protected]> | 2021-04-11 11:01:18 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2021-04-11 11:01:18 +0100 |
commit | b0685c1638044b85dc7e8b07555a7b639b54d69a (patch) | |
tree | 3ba4f28a1a8f4c1b409df2d4f5082056ece2f8e6 /src/brush.rs | |
parent | 8d5fecc23f4e986c74295c58473c6ea8d840d955 (diff) |
add rect select brush and keybinds
Diffstat (limited to 'src/brush.rs')
-rw-r--r-- | src/brush.rs | 19 |
1 files changed, 16 insertions, 3 deletions
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 { | |||
25 | 25 | ||
26 | #[derive(Debug, Copy, Clone)] | 26 | #[derive(Debug, Copy, Clone)] |
27 | pub struct RectSelectBrush { | 27 | pub struct RectSelectBrush { |
28 | pub start: MapPoint, | 28 | pub start: Option<MapPoint>, |
29 | pub end: MapPoint, | 29 | pub end: Option<MapPoint>, |
30 | pub active_end: bool, | ||
30 | } | 31 | } |
31 | 32 | ||
32 | impl Brush { | 33 | impl Brush { |
@@ -60,8 +61,20 @@ impl Brush { | |||
60 | }) | 61 | }) |
61 | } | 62 | } |
62 | 63 | ||
64 | pub fn rect() -> Self { | ||
65 | Brush::RectSelect(RectSelectBrush { | ||
66 | start: None, | ||
67 | end: None, | ||
68 | active_end: true, | ||
69 | }) | ||
70 | } | ||
71 | |||
63 | pub fn is_line(&self) -> bool { | 72 | pub fn is_line(&self) -> bool { |
64 | matches!(self, Self::Line { .. }) | 73 | matches!(self, Self::Line(_)) |
74 | } | ||
75 | |||
76 | pub fn is_rect(&self) -> bool { | ||
77 | matches!(self, Self::RectSelect(_)) | ||
65 | } | 78 | } |
66 | 79 | ||
67 | pub fn size(&self) -> Option<u8> { | 80 | pub fn size(&self) -> Option<u8> { |