Merge pull request #7194 from andyque/fixTouchEvent

fix touch related issue
This commit is contained in:
minggo 2014-06-25 14:05:16 +08:00
commit 728fab706e
7 changed files with 14 additions and 7 deletions

View File

@ -74,7 +74,7 @@ _fontName("Thonburi"),
_fontSize(10),
_type(FontType::SYSTEM)
{
setTouchEnabled(true);
}
Button::~Button()
@ -128,7 +128,6 @@ bool Button::init()
{
if (Widget::init())
{
setTouchEnabled(true);
return true;
}
return false;

View File

@ -62,6 +62,7 @@ _frontCrossRendererAdaptDirty(true),
_backGroundBoxDisabledRendererAdaptDirty(true),
_frontCrossDisabledRendererAdaptDirty(true)
{
setTouchEnabled(true);
}
CheckBox::~CheckBox()
@ -128,7 +129,6 @@ bool CheckBox::init()
if (Widget::init())
{
setSelectedState(false);
setTouchEnabled(true);
return true;
}
return false;

View File

@ -42,7 +42,7 @@ _curSelectedIndex(0),
_refreshViewDirty(true),
_eventCallback(nullptr)
{
this->setTouchEnabled(true);
}
ListView::~ListView()
@ -505,7 +505,9 @@ void ListView::interceptTouchEvent(TouchEventType event, Widget *sender, Touch*
}
parent = dynamic_cast<Widget*>(parent->getParent());
}
selectedItemEvent(event);
if (sender->isHighlighted()) {
selectedItemEvent(event);
}
}
}

View File

@ -46,6 +46,7 @@ _pageViewEventListener(nullptr),
_pageViewEventSelector(nullptr),
_eventCallback(nullptr)
{
this->setTouchEnabled(true);
}
PageView::~PageView()

View File

@ -73,6 +73,7 @@ _scrollViewEventListener(nullptr),
_scrollViewEventSelector(nullptr),
_eventCallback(nullptr)
{
setTouchEnabled(true);
}
ScrollView::~ScrollView()
@ -1544,6 +1545,7 @@ void ScrollView::interceptTouchEvent(Widget::TouchEventType event, Widget *sende
switch (event)
{
case TouchEventType::BEGAN:
_touchBeganPosition = touch->getLocation();
handlePressLogic(touch);
break;
@ -1553,6 +1555,7 @@ void ScrollView::interceptTouchEvent(Widget::TouchEventType event, Widget *sende
if (offset > _childFocusCancelOffset)
{
sender->setHighlighted(false);
_touchMovePosition = touch->getLocation();
handleMoveLogic(touch);
}
}
@ -1560,6 +1563,7 @@ void ScrollView::interceptTouchEvent(Widget::TouchEventType event, Widget *sende
case TouchEventType::CANCELED:
case TouchEventType::ENDED:
_touchEndPosition = touch->getLocation();
handleReleaseLogic(touch);
break;
}

View File

@ -66,6 +66,7 @@ _barRendererAdaptDirty(true),
_progressBarRendererDirty(true),
_eventCallback(nullptr)
{
setTouchEnabled(true);
}
Slider::~Slider()

View File

@ -206,8 +206,9 @@ bool Widget::init()
onFocusChanged = CC_CALLBACK_2(Widget::onFocusChange,this);
onNextFocusedWidget = nullptr;
this->setAnchorPoint(Vec2(0.5f, 0.5f));
ignoreContentAdaptWithSize(true);
this->setTouchEnabled(true);
this->setCascadeColorEnabled(true);
this->setCascadeOpacityEnabled(true);
@ -1033,7 +1034,6 @@ void Widget::copyProperties(Widget *widget)
copySpecialProperties(widget);
//FIXME:copy focus properties, also make sure all the subclass the copy behavior is correct
Map<int, LayoutParameter*>& layoutParameterDic = widget->_layoutParameterDictionary;
for (auto iter = layoutParameterDic.begin(); iter != layoutParameterDic.end(); ++iter)
{