Cheesebaron.HorizontalPager.HorizontalPager.SnapToDestination C# (CSharp) Method

SnapToDestination() private method

private SnapToDestination ( ) : void
return void
        private void SnapToDestination()
        {
            int screenWidth = Width;
            int whichScreen = mCurrentScreen;
            int deltaX = ScrollX - (screenWidth * mCurrentScreen);

            if ((deltaX < 0) && mCurrentScreen != 0 && ((screenWidth / FRACTION_OF_SCREEN_WIDTH_FOR_SWIPE < -deltaX)))
                whichScreen--;
            else if ((deltaX > 0) && (mCurrentScreen + 1 != this.ChildCount) &&
                (screenWidth / FRACTION_OF_SCREEN_WIDTH_FOR_SWIPE < deltaX))
                whichScreen++;

            SnapToScreen(whichScreen);
        }