aboutsummaryrefslogtreecommitdiff
path: root/src/tool/icon_tool.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tool/icon_tool.rs')
-rw-r--r--src/tool/icon_tool.rs18
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());
}
}