fix off by one right and bottom edges of tilegrid.contains()

This commit is contained in:
foamyguy 2022-06-03 17:51:33 -05:00
parent 6831dd8aaa
commit c9c864a4f7

View File

@ -345,8 +345,8 @@ void common_hal_displayio_tilegrid_set_transpose_xy(displayio_tilegrid_t *self,
bool common_hal_displayio_tilegrid_contains(displayio_tilegrid_t *self, uint16_t x, uint16_t y) {
uint16_t right_edge = self->x + (self->width_in_tiles * self->tile_width);
uint16_t bottom_edge = self->y + (self->height_in_tiles * self->tile_height);
return x >= self->x && x <= right_edge &&
y >= self->y && y <= bottom_edge;
return x >= self->x && x < right_edge &&
y >= self->y && y < bottom_edge;
}
void common_hal_displayio_tilegrid_set_top_left(displayio_tilegrid_t *self, uint16_t x, uint16_t y) {