From 6aabd0123961d90095df3cefefeb0718f94aa6fc Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Tue, 10 Nov 2020 23:31:58 +0100 Subject: Add constant for the grid accuracy 0.5 was used as a magical number throughout the code for that until now, which I now changed. --- src/tool/wall_tool.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/tool/wall_tool.rs') diff --git a/src/tool/wall_tool.rs b/src/tool/wall_tool.rs index e815484..157f626 100644 --- a/src/tool/wall_tool.rs +++ b/src/tool/wall_tool.rs @@ -1,7 +1,7 @@ use super::Tool; use crate::button::Button; use crate::config::{ToolKeybindings, WallToolKeybindings}; -use crate::grid::snap_to_grid; +use crate::grid::{snap_to_grid, SNAP_SIZE}; use crate::map_data::MapData; use crate::math::Vec2; use crate::transform::Transform; @@ -27,7 +27,7 @@ impl Tool for WallTool { fn active_update(&mut self, map_data: &mut MapData, rl: &RaylibHandle, transform: &Transform) { 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, 0.5); + *pos2 = snap_to_grid(mouse_pos_m, SNAP_SIZE); } if self.keybindings.finish_segment.is_pressed(rl) && self.unfinished_wall.is_some() { @@ -35,7 +35,7 @@ impl Tool for WallTool { map_data.walls_mut().push((pos1, pos2)); self.unfinished_wall = Some((pos2, pos2)); } else if self.keybindings.start_wall.is_pressed(rl) { - let snapped_mouse_pos = snap_to_grid(mouse_pos_m, 0.5); + let snapped_mouse_pos = snap_to_grid(mouse_pos_m, SNAP_SIZE); self.unfinished_wall = Some((snapped_mouse_pos, snapped_mouse_pos)) } -- cgit v1.2.3-70-g09d2