mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03: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
Notes:
sideshowbarker
2024-07-18 23:47:57 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/4839f36f5ed
@ -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 New Issue
Block a user