Skip to content

Commit

Permalink
fix(table) Don't consider clicks outside cells when table column widt…
Browse files Browse the repository at this point in the history
…h is smaller than table
  • Loading branch information
C47D committed Oct 25, 2024
1 parent bfca691 commit a0bef1e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/widgets/table/lv_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -1003,17 +1003,29 @@ static lv_result_t get_pressed_cell(lv_obj_t * obj, uint32_t * row, uint32_t * c

uint8_t idx = 0;
int32_t total_row_height = 0;
int32_t total_column_width = 0;

for(idx = 0; idx < table->row_cnt; ++idx) {
total_row_height += *(table->row_h);
}

for(idx = 0; idx < table->col_cnt; ++idx) {
total_column_width += *(table->col_w);
}

/* Clicked outside rows on empty space */
if(p.y > (total_row_height + area.y1)) {
if(col) *col = LV_TABLE_CELL_NONE;
if(row) *row = LV_TABLE_CELL_NONE;
return LV_RESULT_INVALID;
}
/* Clicked outside columns on empty space */
else if(p.x > (total_column_width + area.x1)) {
if(col) *col = LV_TABLE_CELL_NONE;
if(row) *row = LV_TABLE_CELL_NONE;
return LV_RESULT_INVALID;
}
else { /*Nothing to do*/ }

int32_t tmp;
if(col) {
Expand Down

0 comments on commit a0bef1e

Please sign in to comment.