Beyond_Beyaan.BBScrollBar.MouseDown C# (CSharp) Метод

MouseDown() публичный Метод

public MouseDown ( int x, int y ) : bool
x int
y int
Результат bool
        public bool MouseDown(int x, int y)
        {
            if (isEnabled)
            {
                if (Up.MouseDown(x, y))
                {
                    return true;
                }
                if (Down.MouseDown(x, y))
                {
                    return true;
                }
                if (!isSlider && Scroll.MouseDown(x, y))
                {
                    scrollSelected = true;
                    if (isHorizontal)
                    {
                        initialMousePos = x;
                    }
                    else
                    {
                        initialMousePos = y;
                    }
                    initialScrollPos = scrollPos;
                    return true;
                }
                //at this point, only the scroll bar itself is left
                if ((isHorizontal && (x >= xPos + 16 && x < xPos + 16 + scrollBarLength && yPos <= y && y < yPos + 16))
                    || (!isHorizontal && (x >= xPos && x < xPos + 16 && yPos + 16 <= y && y < yPos + 16 + scrollBarLength)))
                {
                    if (!isSlider)
                    {
                        //clicked on the bar itself, jump up one page
                        if ((!isHorizontal && y < yPos + 16 + scrollPos) || (isHorizontal && x < xPos + 16 + scrollPos))
                        {
                            topIndex -= amountVisible;
                            if (topIndex < 0)
                            {
                                topIndex = 0;
                            }
                        }
                        else
                        {
                            //since up is checked already, jump down one page
                            topIndex += amountVisible;
                            if (topIndex > (amountOfItems - amountVisible))
                            {
                                topIndex = (amountOfItems - amountVisible);
                            }
                        }
                        SetScrollButtonPosition();
                    }
                    else
                    {
                        scrollSelected = true;
                    }
                    return true;
                }
            }
            return false;
        }