mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-29 16:21:29 +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
Notes:
sideshowbarker
2024-07-17 04:49:48 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/5f93f62f1c Pull-request: https://github.com/SerenityOS/serenity/pull/18666
|
@ -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…
Reference in a new issue