Exemplo n.º 1
0
bool Widget::onTouchBegan(Touch *touch, Event *unusedEvent)
{
    _hitted = false;
    if (isVisible() && isEnabled() && isAncestorsEnabled() && isAncestorsVisible(this) )
    {
        _touchBeganPosition = touch->getLocation();
        auto camera = Camera::getVisitingCamera();
        if(hitTest(_touchBeganPosition, camera, nullptr))
        {
            _hittedByCamera = camera;
            if (isClippingParentContainsPoint(_touchBeganPosition)) {
                _hitted = true;
            }
        }
    }
    if (!_hitted)
    {
        return false;
    }
    setHighlighted(true);

    /*
     * Propagate touch events to its parents
     */
    if (_propagateTouchEvents)
    {
        this->propagateTouchEvent(TouchEventType::BEGAN, this, touch);
    }

    pushDownEvent();
    return true;
}
void UIWidget::onTouchBegan(const CCPoint &touchPoint)
{
    setFocus(true);
    m_touchStartPos.x = touchPoint.x;
    m_touchStartPos.y = touchPoint.y;
    if (m_pWidgetParent)
    {
        m_pWidgetParent->checkChildInfo(0,this,touchPoint);
    }
    pushDownEvent();
}
Exemplo n.º 3
0
bool UIWidget::onTouchBegan(const CCPoint &touchPoint)
{
    setFocused(true);
    m_touchStartPos.x = touchPoint.x;
    m_touchStartPos.y = touchPoint.y;
    if (m_pWidgetParent)
    {
        m_pWidgetParent->checkChildInfo(0,this,touchPoint);
    }
    pushDownEvent();
    return m_bTouchPassedEnabled;
}
Exemplo n.º 4
0
bool UIImageView::onTouchBegan(const CCPoint &touchPoint)
{
    setFocused(true);
    m_touchStartPos.x = touchPoint.x;
    m_touchStartPos.y = touchPoint.y;
    m_pWidgetParent->checkChildInfo(0,this,touchPoint);
    pushDownEvent();
    
    if (m_bDoubleClickEnabled)
    {
        m_fClickTimeInterval = 0;
        m_bStartCheckDoubleClick = true;
        m_nClickCount++;
        m_touchRelease = false;
    }
    return m_bTouchPassedEnabled;
}
Exemplo n.º 5
0
bool UIImageView::onTouchBegan(const cocos2d::Point &touchPoint)
{
    setFocused(true);
    _touchStartPos.x = touchPoint.x;
    _touchStartPos.y = touchPoint.y;
    _widgetParent->checkChildInfo(0,this,touchPoint);
    pushDownEvent();
    
    if (_doubleClickEnabled)
    {
        _clickTimeInterval = 0;
        _startCheckDoubleClick = true;
        _clickCount++;
        _touchRelease = false;
    }
    return _touchPassedEnabled;
}
Exemplo n.º 6
0
bool Widget::onTouchBegan(Touch *touch, Event *unusedEvent)
{
    _hitted = false;
    if (isEnabled() && isTouchEnabled())
    {
        _touchStartPos = touch->getLocation();
        if(hitTest(_touchStartPos) && clippingParentAreaContainPoint(_touchStartPos))
        {
            _hitted = true;
        }
    }
    if (!_hitted)
    {
        return false;
    }
    setFocused(true);
    Widget* widgetParent = getWidgetParent();
    if (widgetParent)
    {
        widgetParent->checkChildInfo(0,this,_touchStartPos);
    }
    pushDownEvent();
    return !_touchPassedEnabled;
}
Exemplo n.º 7
0
bool Widget::onTouchBegan(Touch *touch, Event *unusedEvent)
{
    _hitted = false;
    if (isVisible() && isEnabled() && isAncestorsEnabled() && isAncestorsVisible(this) )
    {
        _touchBeganPosition = touch->getLocation();
        if(hitTest(_touchBeganPosition) && isClippingParentContainsPoint(_touchBeganPosition))
        {
            _hitted = true;
        }
    }
    if (!_hitted)
    {
        return false;
    }
    setHighlighted(true);
    Widget* widgetParent = getWidgetParent();
    if (widgetParent)
    {
        widgetParent->interceptTouchEvent(TouchEventType::BEGAN, this, touch);
    }
    pushDownEvent();
    return true;
}