mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 17:06:31 +00:00
LibGUI: Fix OpacitySlider hairline disappearing towards the left
Whoops, we were scaling the alpha channel of the hairline color along with the RGB channels.
This commit is contained in:
parent
71f50b6e94
commit
4839f36f5e
|
@ -105,9 +105,9 @@ void OpacitySlider::paint_event(PaintEvent& event)
|
|||
// We adjust the hairline's x position so it lines up with the shadow/highlight of the notches.
|
||||
u8 h = ((float)value() / (float)max()) * 255.0f;
|
||||
if (h < 128)
|
||||
painter.draw_line({ notch_x, notch_y_top }, { notch_x, notch_y_bottom }, Color(h, h, h, h));
|
||||
painter.draw_line({ notch_x, notch_y_top }, { notch_x, notch_y_bottom }, Color(h, h, h, 255));
|
||||
else
|
||||
painter.draw_line({ notch_x - 1, notch_y_top }, { notch_x - 1, notch_y_bottom }, Color(h, h, h, h));
|
||||
painter.draw_line({ notch_x - 1, notch_y_top }, { notch_x - 1, notch_y_bottom }, Color(h, h, h, 255));
|
||||
|
||||
// Text label
|
||||
auto percent_text = String::formatted("{}%", (int)((float)value() / (float)max() * 100.0f));
|
||||
|
|
Loading…
Reference in a new issue