aboutsummaryrefslogtreecommitdiff
path: root/src/tool/wall_tool.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tool/wall_tool.rs')
-rw-r--r--src/tool/wall_tool.rs19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/tool/wall_tool.rs b/src/tool/wall_tool.rs
index 85079b0..2cc5b5d 100644
--- a/src/tool/wall_tool.rs
+++ b/src/tool/wall_tool.rs
@@ -28,22 +28,33 @@ impl Tool for WallTool {
self.unfinished_wall = None;
}
- fn active_update(&mut self, map_data: &mut MapData, rl: &RaylibHandle, transform: &Transform) {
+ fn active_update(
+ &mut self,
+ map_data: &mut MapData,
+ rl: &RaylibHandle,
+ transform: &Transform,
+ mouse_blocked: bool,
+ ) {
let mouse_pos_m = transform.point_px_to_m(rl.get_mouse_position().into());
if let Some((_, ref mut pos2)) = &mut self.unfinished_wall {
*pos2 = snap_to_grid(mouse_pos_m, SNAP_SIZE);
}
- if self.keybindings.finish_segment.is_pressed(rl) && self.unfinished_wall.is_some() {
+ if self
+ .keybindings
+ .finish_segment
+ .is_pressed(rl, mouse_blocked)
+ && self.unfinished_wall.is_some()
+ {
let (pos1, pos2) = self.unfinished_wall.unwrap();
map_data.walls_mut().push((pos1, pos2));
self.unfinished_wall = Some((pos2, pos2));
- } else if self.keybindings.start_wall.is_pressed(rl) {
+ } else if self.keybindings.start_wall.is_pressed(rl, mouse_blocked) {
let snapped_mouse_pos = snap_to_grid(mouse_pos_m, SNAP_SIZE);
self.unfinished_wall = Some((snapped_mouse_pos, snapped_mouse_pos))
}
- if self.keybindings.abort_segment.is_pressed(rl) {
+ if self.keybindings.abort_segment.is_pressed(rl, false) {
self.unfinished_wall = None;
}
}