Fix #115601: Clamp Color Picker Vertical Value Slider Position

The position of the vertical value slider has to be clamped to be
within the area of that slider, otherwise it can draw outside the
range when a value is over 1.

Pull Request: https://projects.blender.org/blender/blender/pulls/115680
This commit is contained in:
Harley Acheson
2023-12-01 20:01:22 +01:00
committed by Harley Acheson
parent 1d7ddcc46e
commit 0fbc3e956f

View File

@@ -3294,7 +3294,8 @@ static void ui_draw_but_HSV_v(uiBut *but, const rcti *rect)
UI_draw_roundbox_4fv_ex(&rectf, inner1, inner2, U.pixelsize, outline, 1.0f, 0.0f);
/* cursor */
const float y = rect->ymin + v * BLI_rcti_size_y(rect);
float y = rect->ymin + v * BLI_rcti_size_y(rect);
CLAMP(y, float(rect->ymin) + (2.0f * UI_SCALE_FAC), float(rect->ymax) - (2.0f * UI_SCALE_FAC));
rectf.ymin = y - (4.0f * UI_SCALE_FAC) - U.pixelsize;
rectf.ymax = y + (4.0f * UI_SCALE_FAC) + U.pixelsize;
float col[4] = {0.0f, 0.0f, 0.0f, 1.0f};