diff options
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index e6c85ea..1456684 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,6 @@ use piston_window::grid::Grid; use piston_window::rectangle::{Border, Rectangle}; use piston_window::*; use sdl2_window::Sdl2Window; -use std::cmp; pub const MIN_PIXELS_PER_M: f64 = 0.5; pub const MAX_PIXELS_PER_M: f64 = 10_000.; @@ -87,6 +86,10 @@ fn main() { starting_rect_point = Some(mouse_pos); } } + // Abort drawing a rectangle when clicking with the right mouse button + if let Some(Button::Mouse(MouseButton::Right)) = e.press_args() { + starting_rect_point = None; + } // Close the window when the user presses escape if let Some(Button::Keyboard(Key::Escape)) = e.press_args() { |
