示例#1
0
bool PageView::scrollPages(float touchOffset)
{
    if (this->getPageCount() <= 0)
    {
        return false;
    }
    
    if (!_leftBoundaryChild || !_rightBoundaryChild)
    {
        return false;
    }
    
    float realOffset = touchOffset;
    
    switch (_touchMoveDirection)
    {
        case TouchDirection::LEFT: // left

            if (_rightBoundaryChild->getRightBoundary() + touchOffset <= _rightBoundary)
            {
                realOffset = _rightBoundary - _rightBoundaryChild->getRightBoundary();
                movePages(realOffset);
                return false;
            }
            break;
            
        case TouchDirection::RIGHT: // right

            if (_leftBoundaryChild->getLeftBoundary() + touchOffset >= _leftBoundary)
            {
                realOffset = _leftBoundary - _leftBoundaryChild->getLeftBoundary();
                movePages(realOffset);
                return false;
            }
            break;
        default:
            break;
    }
    
    movePages(realOffset);
    return true;
}
bool PageView::scrollPages(float touchOffset)
{
    if (_pages.size() <= 0)
    {
        return false;
    }
    
    if (!_leftChild || !_rightChild)
    {
        return false;
    }
    
    float realOffset = touchOffset;
    
    switch (_touchMoveDir)
    {
        case PAGEVIEW_TOUCHLEFT: // left
            if (_rightChild->getRightInParent() + touchOffset <= _rightBoundary)
            {
                realOffset = _rightBoundary - _rightChild->getRightInParent();
                movePages(realOffset);
                return false;
            }
            break;
            
        case PAGEVIEW_TOUCHRIGHT: // right
            if (_leftChild->getLeftInParent() + touchOffset >= _leftBoundary)
            {
                realOffset = _leftBoundary - _leftChild->getLeftInParent();
                movePages(realOffset);
                return false;
            }
            break;
        default:
            break;
    }
    
    movePages(realOffset);
    return true;
}
示例#3
0
bool UIPageView::scrollPages(float touchOffset)
{
    if (m_pages->count() <= 0)
    {
        return false;
    }

    if (!m_pLeftChild || !m_pRightChild)
    {
        return false;
    }

    float realOffset = touchOffset;

    switch (m_touchMoveDir)
    {
    case PAGEVIEW_TOUCHLEFT: // left
        if (m_pRightChild->getRightInParent() + touchOffset <= m_fRightBoundary)
        {
            realOffset = m_fRightBoundary - m_pRightChild->getRightInParent();
            movePages(realOffset);
            return false;
        }
        break;

    case PAGEVIEW_TOUCHRIGHT: // right
        if (m_pLeftChild->getLeftInParent() + touchOffset >= m_fLeftBoundary)
        {
            realOffset = m_fLeftBoundary - m_pLeftChild->getLeftInParent();
            movePages(realOffset);
            return false;
        }
        break;
    default:
        break;
    }

    movePages(realOffset);
    return true;
}
示例#4
0
bool NewPageView::scrollPages(float touchOffset)
{
    if (_pages.size() <= 0)
    {
        return false;
    }
    
//    if (!_leftChild || !_rightChild)
    {
//        return false;
    }
    movePages(touchOffset);
    return true;
}