Skip to content

Commit

Permalink
Improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
Shute052 committed Feb 18, 2024
1 parent d5f2cb1 commit fbc1d6c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/axislike.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,9 @@ impl DeadZoneShape {
radius_x: f32,
radius_y: f32,
) -> Option<DualAxisData> {
let normalized_x = x / radius_x.max(f32::EPSILON);
let normalized_y = y / radius_y.max(f32::EPSILON);
let is_outside_deadzone = normalized_x.powi(2) + normalized_y.powi(2) >= 1.0;
let x_ratio = x / radius_x.max(f32::EPSILON);
let y_ratio = y / radius_y.max(f32::EPSILON);
let is_outside_deadzone = x_ratio.powi(2) + y_ratio.powi(2) >= 1.0;
is_outside_deadzone.then(|| {
let new_x = deadzone_axis_value(x, radius_x);
let new_y = deadzone_axis_value(y, radius_y);
Expand Down
3 changes: 2 additions & 1 deletion src/clashing_inputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ impl<A: Actionlike> InputMap<A> {
}
}

(!clash.inputs_a.is_empty()).then_some(clash)
let not_empty = !clash.inputs_a.is_empty();
not_empty.then_some(clash)
}
}

Expand Down

0 comments on commit fbc1d6c

Please sign in to comment.