Skip to content

Commit

Permalink
Fix issues with signed number comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
Milan Oberkirch committed Jul 1, 2024
1 parent 154c6e9 commit 3538f02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ async fn click(State(state): State<AppState>, Form(input): Form<MousePosition>)
};
let step = bat.height / 2;
let y = (input.y * 1000.) as u16;
if (y - (bat.height / 2)) < bat.position {
bat.position = (bat.position - step).max(1)
if y < (bat.position + (bat.height / 2)) {
bat.position = if step < bat.position {bat.position - step} else {1}
} else {
bat.position = (bat.position + step).min(1000)
}
Expand Down

0 comments on commit 3538f02

Please sign in to comment.