Skip to content

Commit

Permalink
Another bug fix
Browse files Browse the repository at this point in the history
Fixed bug in select box tracking.
  • Loading branch information
emotodorov committed Jun 24, 2024
1 parent c9eddb6 commit ddfc21d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/ui/ui_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2923,9 +2923,6 @@ void mjui_render(mjUI* ui, const mjuiState* state, const mjrContext* con) {
int offset = mjMAX(0, rect.height - ui->height + ui->scroll) -
mjMAX(0, ui->height - ui->scroll - rect.height);

// draw in entire ui rectangle
initOpenGL(&rect, con);

// margin
mjrRect r = it->rect;
r.left -= g_itemside;
Expand All @@ -2934,26 +2931,30 @@ void mjui_render(mjUI* ui, const mjuiState* state, const mjrContext* con) {
r.bottom -= r.height;
r.bottom += offset;
r.left += rect.left;
drawrectangle(r, ui->color.sectpane, NULL, con);
mjr_rectangle(r, ui->color.sectpane[0],
ui->color.sectpane[1], ui->color.sectpane[2], 1);

// box
r = it->rect;
r.height = it->multi.nelem * cellheight;
r.bottom -= r.height;
r.bottom += offset;
r.left += rect.left;
drawrectangle(r, ui->color.select2, NULL, con);
mjr_rectangle(r, ui->color.select2[0],
ui->color.select2[1], ui->color.select2[2], 1);

// hightlight row under mouse
int k = findselect(it, ui, state, con);
if (k >= 0) {
mjrRect r1 = r;
r1.bottom = r.bottom + (it->multi.nelem-1-k)*cellheight;
r1.height = cellheight;
drawrectangle(r1, ui->color.select, NULL, con);
mjr_rectangle(r1, ui->color.select[0],
ui->color.select[1], ui->color.select[2], 1);
}

// text values
initOpenGL(&rect, con);
for (int k=0; k < it->multi.nelem; k++) {
drawtext(it->multi.name[k],
r.left+g_texthor - rect.left,
Expand Down

0 comments on commit ddfc21d

Please sign in to comment.