public bool MouseUp(int x, int y)
{
if (isEnabled)
{
bool changed = false;
if (Up.MouseUp(x, y))
{
if (TopIndex > 0)
{
TopIndex--;
}
changed = true;
}
else if (Down.MouseUp(x, y))
{
if (TopIndex < amountOfItems - amountVisible)
{
TopIndex++;
}
changed = true;
}
if (changed || scrollSelected)
{
scrollSelected = false;
if (!isSlider)
{
SetScrollButtonPosition();
Scroll.MouseUp(x, y);
}
return true;
}
if (x >= xPos && x < xPos + 16 + (isHorizontal ? scrollBarLength : 0) && yPos + 16 <= y && y < yPos + 16 + (isHorizontal ? 0 : scrollBarLength))
{
return true;
}
}
return false;
}