Skip to content

Commit

Permalink
Stop mode override with mouse press or esc
Browse files Browse the repository at this point in the history
  • Loading branch information
urholaukkarinen committed Apr 28, 2024
1 parent 6db9a87 commit 217f1ae
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/transform-gizmo-bevy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ struct GizmoStorage {
fn handle_hotkeys(
mut gizmo_options: ResMut<GizmoOptions>,
keyboard_input: Res<ButtonInput<KeyCode>>,
mouse_input: Res<ButtonInput<MouseButton>>,
mut axes: Local<EnumSet<GizmoDirection>>,
) {
// Snapping is enabled when CTRL is pressed.
Expand Down Expand Up @@ -273,6 +274,12 @@ fn handle_hotkeys(
})
})
});

if mouse_input.any_just_pressed([MouseButton::Left, MouseButton::Right])
|| keyboard_input.just_pressed(KeyCode::Escape)
{
*mode_override = None;
}
}

#[allow(clippy::too_many_arguments)]
Expand Down

0 comments on commit 217f1ae

Please sign in to comment.