From 77cedfa08f3f8aec67c6a2fe8e5ae9bab5a0e7c7 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 1 Jul 2021 16:58:24 +0200 Subject: [PATCH] fix(btnmatrix) fix button invalidation on focus change --- src/widgets/lv_btnmatrix.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/widgets/lv_btnmatrix.c b/src/widgets/lv_btnmatrix.c index 1070cabc7..dd33ade13 100644 --- a/src/widgets/lv_btnmatrix.c +++ b/src/widgets/lv_btnmatrix.c @@ -942,6 +942,11 @@ static void invalidate_button_area(const lv_obj_t * obj, uint16_t btn_idx) lv_coord_t row_gap = lv_obj_get_style_pad_row(obj, LV_PART_MAIN); lv_coord_t col_gap = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); + /*Be sure to have a minimal extra space if row/col_gap is small*/ + lv_coord_t dpi = lv_disp_get_dpi(lv_obj_get_disp(obj)); + row_gap = LV_MAX(row_gap, dpi / 10); + col_gap = LV_MAX(col_gap, dpi / 10); + /*Convert relative coordinates to absolute*/ btn_area.x1 += obj_area.x1 - row_gap; btn_area.y1 += obj_area.y1 - col_gap;