Tweak point conversion to prevent off-grid (negative) points from registering as on the grid
This commit is contained in:
parent
b3f946ecb2
commit
b0ef1d2303
|
@ -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_x = mouse_x_sq + left_edge;
|
||||||
float ans_y = mouse_y_sq + top_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;
|
gx = ans_x;
|
||||||
gy = ans_y;
|
gy = ans_y;
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue