MonoGdx.Scene2D.UI.ScrollPane.ScrollTo C# (CSharp) Method

ScrollTo() public method

public ScrollTo ( float x, float y, float width, float height ) : void
x float
y float
width float
height float
return void
        public void ScrollTo(float x, float y, float width, float height)
        {
            float amountX = ScrollX;
            if (x + width > amountX + _areaWidth)
                amountX = x + width - _areaWidth;
            if (x < amountX)
                amountX = x;
            ScrollX = MathHelper.Clamp(amountX, 0, MaxX);

            float amountY = ScrollY;
            if (amountY > MaxY - y - height + _areaHeight)
                amountY = MaxY - y - height + _areaHeight;
            if (amountY < MaxY - y)
                amountY = MaxY - y;
            ScrollY = MathHelper.Clamp(amountY, 0, MaxY);
        }