From b0ef1d2303dc7e9e2a82240f7301ea677b55bc31 Mon Sep 17 00:00:00 2001 From: John McCardle Date: Sat, 4 Mar 2023 00:18:19 -0500 Subject: [PATCH] Tweak point conversion to prevent off-grid (negative) points from registering as on the grid --- src/Grid.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Grid.cpp b/src/Grid.cpp index 5438835..7e681ba 100644 --- a/src/Grid.cpp +++ b/src/Grid.cpp @@ -70,6 +70,10 @@ void Grid::screenToGrid(int sx, int sy, int& gx, int& gy) { float ans_x = mouse_x_sq + left_edge; float ans_y = mouse_y_sq + top_edge; + // casting float turns -0.5 to 0; I want any negative coord to be OOB + if (ans_x < 0) ans_x = -1; + if (ans_y < 0) ans_y = -1; + gx = ans_x; gy = ans_y; /*