aboutsummaryrefslogtreecommitdiff
path: root/src/brush.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/brush.rs')
-rw-r--r--src/brush.rs19
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)]
27pub struct RectSelectBrush { 27pub 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
32impl Brush { 33impl 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> {