From 1216293b3ed2405dd995c29ade646cc14dd03481 Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Fri, 1 Dec 2023 10:08:20 -0800 Subject: [PATCH 1/2] 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. --- source/blender/editors/interface/interface_widgets.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface_widgets.cc b/source/blender/editors/interface/interface_widgets.cc index c4c3f70a5c9..399113c26e5 100644 --- a/source/blender/editors/interface/interface_widgets.cc +++ b/source/blender/editors/interface/interface_widgets.cc @@ -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, rect->ymin + (2.0f * UI_SCALE_FAC), 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}; -- 2.30.2 From 0fc6cd3ace384cb8d6250d4a15c8778ea5a610eb Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Fri, 1 Dec 2023 10:15:40 -0800 Subject: [PATCH 2/2] remove potential type warning --- source/blender/editors/interface/interface_widgets.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface_widgets.cc b/source/blender/editors/interface/interface_widgets.cc index 399113c26e5..77d579ec8cb 100644 --- a/source/blender/editors/interface/interface_widgets.cc +++ b/source/blender/editors/interface/interface_widgets.cc @@ -3295,7 +3295,7 @@ static void ui_draw_but_HSV_v(uiBut *but, const rcti *rect) /* cursor */ float y = rect->ymin + v * BLI_rcti_size_y(rect); - CLAMP(y, rect->ymin + (2.0f * UI_SCALE_FAC), rect->ymax - (2.0f * UI_SCALE_FAC)); + 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}; -- 2.30.2