Skip to content

Commit c9c864a

Browse files
committed
fix off by one right and bottom edges of tilegrid.contains()
1 parent 6831dd8 commit c9c864a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

shared-module/displayio/TileGrid.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ void common_hal_displayio_tilegrid_set_transpose_xy(displayio_tilegrid_t *self,
345345
bool common_hal_displayio_tilegrid_contains(displayio_tilegrid_t *self, uint16_t x, uint16_t y) {
346346
uint16_t right_edge = self->x + (self->width_in_tiles * self->tile_width);
347347
uint16_t bottom_edge = self->y + (self->height_in_tiles * self->tile_height);
348-
return x >= self->x && x <= right_edge &&
349-
y >= self->y && y <= bottom_edge;
348+
return x >= self->x && x < right_edge &&
349+
y >= self->y && y < bottom_edge;
350350
}
351351

352352
void common_hal_displayio_tilegrid_set_top_left(displayio_tilegrid_t *self, uint16_t x, uint16_t y) {

0 commit comments

Comments
 (0)