Highlight hovered and active color picker scrollbar handle

Add visual feedback to color picker scrollbar handle being hovered and active.
This commit is contained in:
Robert Müller 2024-06-26 22:42:43 +02:00
parent db9b5f5b61
commit 01d2b3e3bc

View file

@ -1381,19 +1381,20 @@ float CUi::DoScrollbarH(const void *pId, const CUIRect *pRect, float Current, co
} }
// render // render
const ColorRGBA HandleColor = ms_ScrollBarColorFunction.GetColor(CheckActiveItem(pId), HotItem() == pId);
if(pColorInner) if(pColorInner)
{ {
CUIRect Slider; CUIRect Slider;
Handle.VMargin(-2.0f, &Slider); Handle.VMargin(-2.0f, &Slider);
Slider.HMargin(-3.0f, &Slider); Slider.HMargin(-3.0f, &Slider);
Slider.Draw(ColorRGBA(0.15f, 0.15f, 0.15f, 1.0f), IGraphics::CORNER_ALL, 5.0f); Slider.Draw(ColorRGBA(0.15f, 0.15f, 0.15f, 1.0f).Multiply(HandleColor), IGraphics::CORNER_ALL, 5.0f);
Slider.Margin(2.0f, &Slider); Slider.Margin(2.0f, &Slider);
Slider.Draw(*pColorInner, IGraphics::CORNER_ALL, 3.0f); Slider.Draw(pColorInner->Multiply(HandleColor), IGraphics::CORNER_ALL, 3.0f);
} }
else else
{ {
Rail.Draw(ColorRGBA(1.0f, 1.0f, 1.0f, 0.25f), IGraphics::CORNER_ALL, Rail.h / 2.0f); Rail.Draw(ColorRGBA(1.0f, 1.0f, 1.0f, 0.25f), IGraphics::CORNER_ALL, Rail.h / 2.0f);
Handle.Draw(ms_ScrollBarColorFunction.GetColor(CheckActiveItem(pId), HotItem() == pId), IGraphics::CORNER_ALL, Handle.h / 2.0f); Handle.Draw(HandleColor, IGraphics::CORNER_ALL, Handle.h / 2.0f);
} }
return ReturnValue; return ReturnValue;