Example #1
0
// auto move
void UIDragPanel::autoMove()
{
    if (m_bBounceEnable)
    {
        if (checkNeedBounce())
        {
            stopAutoMove();
            startBounce();
        }
    }
}
Example #2
0
void Widget::onNext()
{
    m_visible.start();
    if (m_messageQueue.size() < 2)
        return;
    Message m = m_messageQueue.front();
    boost::optional<QVariant> tmpManual = m.data["manually_shown"];
    m.data["manually_shown"] = boost::optional<QVariant>(true);
    m_previousStack.push(m);
    m_messageQueue.pop_front();
    loadDefaults();
    setupFont();
    setupColors();
    setupIcon();
    setupTitle();
    setupContent();
    connectForPosition(m_messageQueue.front().data["pos"]->toString());
    updateFinalWidth();
    if (m_messageQueue.front().data["bounce"] && !tmpManual)
        startBounce();
}
Example #3
0
void UIDragPanel::handleMoveLogic(const CCPoint &touchPoint)
{
    if (!m_bTouchPressed)
    {
        return;
    }
    
    // check touch out of drag panel boundary
    if (m_bTouchCanceld)
    {
        return;
    }
        
    m_bTouchMoved = true;
    
    CCPoint nsp = m_pRenderer->convertToNodeSpace(touchPoint);
    CCPoint delta = ccpSub(nsp, m_touchStartNodeSpace);
    m_touchStartNodeSpace = nsp;
    
    // reset berth dir to none
    if (!m_bBounceEnable)
    {
        m_eBerthDirection = DRAGPANEL_BERTH_DIR_NONE;
    }
    
    // check will berth (bounce disable)
    if (!m_bBounceEnable)
    {
        if (checkToBoundaryWithDeltaPosition(delta))
        {
            delta = calculateToBoundaryDeltaPosition(delta);
        }                        
    }
    // move
    moveWithDelta(delta);
    // check bounce or berth
    if (m_bBounceEnable)
    {
        // bounce
        if (!hitTest(touchPoint))
        {
            m_bTouchMoved = false;
            
            if (checkNeedBounce())
            {
                m_bTouchCanceld = true;
                startBounce();
            }
        }
    }
    else
    {
        // berth
        if (checkBerth())
        {
            berthEvent();
        }
    }        
    // before
    /*
    if (pointAtSelfBody(touchPoint))
    {
        CCPoint innernsp = m_pInnerContainer->getContainerNode()->convertToNodeSpace(touchPoint);
        
        CCPoint delta = ccpSub(innernsp, m_touchStartNodeSpace);        
        moveWithDelta(delta);
        // bounceEnable is disable
        if (!m_bBounceEnable)
        {
            if (checkToBoundaryWithDeltaPosition(delta))
            {
                delta = calculateToBoundaryDeltaPosition(delta);
                moveWithDelta(delta);
                if (checkBerth())
                {                    
                    berthEvent();
                }
            }
        }
    }
    else
    {
        m_bTouchMoved = false;
     
        // bounce
        if (m_bBounceEnable)
        {
            if (checkNeedBounce())
            {
                m_bTouchCanceld = true;
                startBounce();
            }
        }
    }
     */
    //
}