mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:47:46 +00:00
LibGUI: Fix ColorSlider crash when the selected hue is 360
If the ColorSlider returns a hue of 360 degrees one of the various `VERIFY(hsv.hue >= 0.0 && hsv.hue < 360.0);` in Color.h will be hit.
This commit is contained in:
parent
bd0bf8250e
commit
5f93f62f1c
1 changed files with 2 additions and 0 deletions
|
@ -705,6 +705,8 @@ void ColorSlider::pick_value_at_position(GUI::MouseEvent& event)
|
|||
auto inner_rect = frame_inner_rect();
|
||||
auto position = event.position().constrained(inner_rect).translated(-frame_thickness(), -frame_thickness());
|
||||
auto hue = (double)position.y() / inner_rect.height() * 360;
|
||||
if (hue >= 360)
|
||||
hue -= 360;
|
||||
m_last_position = position.y();
|
||||
m_value = hue;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue