Nez.Portable/UI/Containers/ScrollPane.cs
/// <summary>
/// Sets the scroll offset so the specified rectangle is fully in view, and optionally centered vertically and/or horizontally,
/// if possible. Coordinates are in the scroll pane widget's coordinate system.
/// </summary>
/// <returns>The to.</returns>
/// <param name="x">The x coordinate.</param>
/// <param name="y">The y coordinate.</param>
/// <param name="width">Width.</param>
/// <param name="height">Height.</param>
/// <param name="centerHorizontal">Center horizontal.</param>
/// <param name="centerVertical">Center vertical.</param>
Sets the scroll offset so the specified rectangle is fully in view, and optionally centered vertically and/or horizontally,
if possible. Coordinates are in the scroll pane widget's coordinate system.
Sets the scroll offset so the specified rectangle is fully in view and optionally centered vertically and / or horizontally if possible . Coordinates are in the scroll pane widget ' s coordinate system .
public void scrollTo(float x, float y, float width, float height, bool centerHorizontal, bool centerVertical)
        {
            var amountX = _amountX;
            if (centerHorizontal)
            {
                amountX = x - _areaWidth / 2 + width / 2;
            }
            else
            {
                if (x + width > amountX + _areaWidth) amountX = x + width - _areaWidth;
                if (x < amountX) amountX = x;
            }
            setScrollX(amountX);
            var amountY = _amountY;
            if (centerVertical)
            {
                amountY = _maxY - y + _areaHeight / 2 - height / 2;
            }
            else
            {
                if (amountY > _maxY - y - height + _areaHeight) amountY = _maxY - y - height + _areaHeight;
                if (amountY < _maxY - y) amountY = _maxY - y;
            }
            setScrollY(amountY);
        }
public void scrollTo ( float x , float y , float width , float height , bool centerHorizontal , bool centerVertical ) { var amountX = _amountX ; if ( centerHorizontal ) { amountX = x - _areaWidth / 2 + width / 2 ; } else { if ( x + width > amountX + _areaWidth ) amountX = x + width - _areaWidth ; if ( x < amountX ) amountX = x ; } setScrollX ( amountX ) ; var amountY = _amountY ; if ( centerVertical ) { amountY = _maxY - y + _areaHeight / 2 - height / 2 ; } else { if ( amountY > _maxY - y - height + _areaHeight ) amountY = _maxY - y - height + _areaHeight ; if ( amountY < _maxY - y ) amountY = _maxY - y ; } setScrollY ( amountY ) ; }
Sets the scroll offset so the specified rectangle is fully in view, and optionally centered vertically and/or horizontally,
if possible.
Sets the scroll offset so the specified rectangle is fully in view and optionally centered vertically and / or horizontally if possible .
None
x
float
The x coordinate.
The x coordinate .
y
float
The y coordinate.
The y coordinate .
width
float
None
height
float
None
centerHorizontal
bool
None
centerVertical
bool
None