diff options
| author | Arne Dußin | 2020-11-20 20:00:28 +0100 |
|---|---|---|
| committer | Arne Dußin | 2020-11-20 20:00:28 +0100 |
| commit | cf0cbe3fd28b2099b580edc1714b4d68bf7183cd (patch) | |
| tree | b03561c1ae7860cad247d089cb1ad728efa843ec /src/tool/icon_tool.rs | |
| parent | f62dabcb390d4808739745c050dfba8e2826b214 (diff) | |
| download | graf_karto-cf0cbe3fd28b2099b580edc1714b4d68bf7183cd.tar.gz graf_karto-cf0cbe3fd28b2099b580edc1714b4d68bf7183cd.zip | |
Add simple tool sidebar gui
Diffstat (limited to 'src/tool/icon_tool.rs')
| -rw-r--r-- | src/tool/icon_tool.rs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/tool/icon_tool.rs b/src/tool/icon_tool.rs index bd16de8..4b3a1eb 100644 --- a/src/tool/icon_tool.rs +++ b/src/tool/icon_tool.rs @@ -123,7 +123,13 @@ impl Tool for IconTool { self.active = false; } - fn active_update(&mut self, map: &mut MapData, rl: &RaylibHandle, transform: &Transform) { + fn active_update( + &mut self, + map: &mut MapData, + rl: &RaylibHandle, + transform: &Transform, + mouse_blocked: bool, + ) { // Update the position of the icon that should be drawn to the current mouse position. let snapped_mouse_pos_m = snap_to_grid( transform.point_px_to_m(rl.get_mouse_position().into()), @@ -132,15 +138,19 @@ impl Tool for IconTool { self.current_icon.position = snapped_mouse_pos_m; // Unwrap the current icon, since it is now definitely set, as we are in the active update. - if self.keybindings.next.is_pressed(rl) { + if self.keybindings.next.is_pressed(rl, mouse_blocked) { self.current_icon.icon_id = (self.current_icon.icon_id + 1) % self.icon_data.len(); } - if self.keybindings.rotate_clockwise.is_pressed(rl) { + if self + .keybindings + .rotate_clockwise + .is_pressed(rl, mouse_blocked) + { self.current_icon.rotation += 45.; } // Handle placing the icon on the map - if self.keybindings.place.is_pressed(rl) { + if self.keybindings.place.is_pressed(rl, mouse_blocked) { map.icons_mut().push(self.current_icon.clone()); } } |
