Ejemplo n.º 1
0
bool TransformCmd::touchEnded(const MgMotion* sender)
{
    bool ret =  _ptIndex >= 0 || (_lastCmd && _lastCmd->touchEnded(sender));
    
    _ptIndex = -1;
    
    return ret;
}
Ejemplo n.º 2
0
bool GiCoreViewImpl::gestureToCommand(const MgMotion& motion)
{
    MgDynShapeLock locker(true, motion.view);
    MgCommand* cmd = _cmds->getCommand();
    bool ret = false;

    if (motion.gestureState == kMgGestureCancel || !cmd) {
        return cmd && cmd->cancel(&motion);
    }
    if (motion.gestureState == kMgGesturePossible
        && motion.gestureType != kGiTwoFingersMove) {
        return true;
    }

    switch (motion.gestureType)
    {
    case kGiTwoFingersMove:
        ret = cmd->twoFingersMove(&motion);
        break;
    case kGiGesturePan:
        switch (motion.gestureState)
        {
        case kMgGestureBegan:
            ret = cmd->touchBegan(&motion);
            break;
        case kMgGestureMoved:
            ret = cmd->touchMoved(&motion);
            break;
        case kMgGestureEnded:
        default:
            ret = cmd->touchEnded(&motion);
            break;
        }
        break;
    case kGiGestureTap:
        ret = cmd->click(&motion);
        break;
    case kGiGestureDblTap:
        ret = cmd->doubleClick(&motion);
        break;
    case kGiGesturePress:
        ret = cmd->longPress(&motion);
        break;
    }

    if (!ret) {
        LOGD("The current command (%s) don't support #%d gesture (state=%d)",
            cmd->getName(), motion.gestureType, motion.gestureState);
    }
    return ret;
}
Ejemplo n.º 3
0
void CDrawShapeView::OnLButtonUp(UINT nFlags, CPoint point)
{
    CBaseView::OnLButtonUp(nFlags, point);
    ReleaseCapture();

    if (m_delayUp)
    {
        m_delayUp = FALSE;
    }
    else if (m_moved)
    {
        MgCommand* cmd = mgGetCommandManager()->getCommand();
        if (cmd) cmd->touchEnded(&m_proxy->motion);
    }
    else if (Point2d((float)point.x, (float)point.y) == m_proxy->motion.startPoint)
    {
        PostMessage(WM_DELAY_LBUTTONUP, m_downTime, m_downFlags);
        m_delayUp = TRUE;
    }
}