Skip to content

Commit

Permalink
Avoid using NAN as mouse position
Browse files Browse the repository at this point in the history
Here we just want to move the mouse outside the viewport.  I am not
totally sure if using -1 is the best, but I prefer not using NAN so that
we can still if we want compile with -ffast-math.
  • Loading branch information
guillaumechereau committed Aug 11, 2024
1 parent cde28f3 commit 292588c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/goxel.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,10 @@ int goxel_iter(const inputs_t *inputs)
for (i = 0; i < (int)ARRAY_SIZE(inputs2.touches); i++) {
inputs2.touches[i].pos[1] =
inputs->window_size[1] - inputs->touches[i].pos[1];
// Move the mouse outside the viewport if the UI captures it.
if (gui_want_capture_mouse()) {
inputs2.touches[i].pos[0] = NAN;
inputs2.touches[i].pos[1] = NAN;
inputs2.touches[i].pos[0] = -1;
inputs2.touches[i].pos[1] = -1;
}
}
arrfree(goxel.hints);
Expand Down

0 comments on commit 292588c

Please sign in to comment.