mirror of https://github.com/axmolengine/axmol.git
Merge pull request #7194 from andyque/fixTouchEvent
fix touch related issue
This commit is contained in:
commit
728fab706e
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ _pageViewEventListener(nullptr),
|
|||
_pageViewEventSelector(nullptr),
|
||||
_eventCallback(nullptr)
|
||||
{
|
||||
this->setTouchEnabled(true);
|
||||
}
|
||||
|
||||
PageView::~PageView()
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ _barRendererAdaptDirty(true),
|
|||
_progressBarRendererDirty(true),
|
||||
_eventCallback(nullptr)
|
||||
{
|
||||
setTouchEnabled(true);
|
||||
}
|
||||
|
||||
Slider::~Slider()
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue