Skip to content

Commit

Permalink
[Fixed] rounded progressbars rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitarCC authored and Huevos committed Jan 21, 2024
1 parent 1850857 commit dcf6050
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions lib/gui/eslider.cpp
Expand Up @@ -124,11 +124,9 @@ int eSlider::event(int event, void *data, void *data2)
painter.setRadius(cornerRadius, getCornerRadiusEdges());
eRect rect = eRect(m_currently_filled.extends);
if (m_orientation == orHorizontal)
rect.setHeight(size().height()-m_border_width);
rect.setHeight(size().height()-m_border_width*2);
else
rect.setWidth(size().width()-m_border_width);
rect.setX(m_border_width);
rect.setY(m_border_width);
rect.setWidth(size().width()-m_border_width*2);
painter.drawRectangle(rect);
}
else {
Expand Down Expand Up @@ -183,14 +181,24 @@ int eSlider::event(int event, void *data, void *data2)
num_pix = 0;

if (m_orientation == orHorizontal)
m_currently_filled = eRect(start_pix, 0, num_pix, pixsize);
m_currently_filled = eRect(start_pix + m_border_width, m_border_width, num_pix, pixsize);
else
m_currently_filled = eRect(0, start_pix, pixsize, num_pix);
m_currently_filled = eRect(m_border_width, start_pix + m_border_width, pixsize, num_pix);

const int cornerRadius = getCornerRadius();

if (cornerRadius)
{
invalidate(old_currently_filled);
invalidate(m_currently_filled);
}
else
{
// redraw what *was* filled before and now isn't.
invalidate(m_currently_filled - old_currently_filled);
invalidate(m_currently_filled - old_currently_filled);
// redraw what wasn't filled before and is now.
invalidate(old_currently_filled - m_currently_filled);
invalidate(old_currently_filled - m_currently_filled);
}

return 0;
}
Expand Down

0 comments on commit dcf6050

Please sign in to comment.