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),
|
_fontSize(10),
|
||||||
_type(FontType::SYSTEM)
|
_type(FontType::SYSTEM)
|
||||||
{
|
{
|
||||||
|
setTouchEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Button::~Button()
|
Button::~Button()
|
||||||
|
@ -128,7 +128,6 @@ bool Button::init()
|
||||||
{
|
{
|
||||||
if (Widget::init())
|
if (Widget::init())
|
||||||
{
|
{
|
||||||
setTouchEnabled(true);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -62,6 +62,7 @@ _frontCrossRendererAdaptDirty(true),
|
||||||
_backGroundBoxDisabledRendererAdaptDirty(true),
|
_backGroundBoxDisabledRendererAdaptDirty(true),
|
||||||
_frontCrossDisabledRendererAdaptDirty(true)
|
_frontCrossDisabledRendererAdaptDirty(true)
|
||||||
{
|
{
|
||||||
|
setTouchEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckBox::~CheckBox()
|
CheckBox::~CheckBox()
|
||||||
|
@ -128,7 +129,6 @@ bool CheckBox::init()
|
||||||
if (Widget::init())
|
if (Widget::init())
|
||||||
{
|
{
|
||||||
setSelectedState(false);
|
setSelectedState(false);
|
||||||
setTouchEnabled(true);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -42,7 +42,7 @@ _curSelectedIndex(0),
|
||||||
_refreshViewDirty(true),
|
_refreshViewDirty(true),
|
||||||
_eventCallback(nullptr)
|
_eventCallback(nullptr)
|
||||||
{
|
{
|
||||||
|
this->setTouchEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView::~ListView()
|
ListView::~ListView()
|
||||||
|
@ -505,8 +505,10 @@ void ListView::interceptTouchEvent(TouchEventType event, Widget *sender, Touch*
|
||||||
}
|
}
|
||||||
parent = dynamic_cast<Widget*>(parent->getParent());
|
parent = dynamic_cast<Widget*>(parent->getParent());
|
||||||
}
|
}
|
||||||
|
if (sender->isHighlighted()) {
|
||||||
selectedItemEvent(event);
|
selectedItemEvent(event);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t ListView::getCurSelectedIndex() const
|
ssize_t ListView::getCurSelectedIndex() const
|
||||||
|
|
|
@ -46,6 +46,7 @@ _pageViewEventListener(nullptr),
|
||||||
_pageViewEventSelector(nullptr),
|
_pageViewEventSelector(nullptr),
|
||||||
_eventCallback(nullptr)
|
_eventCallback(nullptr)
|
||||||
{
|
{
|
||||||
|
this->setTouchEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
PageView::~PageView()
|
PageView::~PageView()
|
||||||
|
|
|
@ -73,6 +73,7 @@ _scrollViewEventListener(nullptr),
|
||||||
_scrollViewEventSelector(nullptr),
|
_scrollViewEventSelector(nullptr),
|
||||||
_eventCallback(nullptr)
|
_eventCallback(nullptr)
|
||||||
{
|
{
|
||||||
|
setTouchEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView::~ScrollView()
|
ScrollView::~ScrollView()
|
||||||
|
@ -1544,6 +1545,7 @@ void ScrollView::interceptTouchEvent(Widget::TouchEventType event, Widget *sende
|
||||||
switch (event)
|
switch (event)
|
||||||
{
|
{
|
||||||
case TouchEventType::BEGAN:
|
case TouchEventType::BEGAN:
|
||||||
|
_touchBeganPosition = touch->getLocation();
|
||||||
handlePressLogic(touch);
|
handlePressLogic(touch);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1553,6 +1555,7 @@ void ScrollView::interceptTouchEvent(Widget::TouchEventType event, Widget *sende
|
||||||
if (offset > _childFocusCancelOffset)
|
if (offset > _childFocusCancelOffset)
|
||||||
{
|
{
|
||||||
sender->setHighlighted(false);
|
sender->setHighlighted(false);
|
||||||
|
_touchMovePosition = touch->getLocation();
|
||||||
handleMoveLogic(touch);
|
handleMoveLogic(touch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1560,6 +1563,7 @@ void ScrollView::interceptTouchEvent(Widget::TouchEventType event, Widget *sende
|
||||||
|
|
||||||
case TouchEventType::CANCELED:
|
case TouchEventType::CANCELED:
|
||||||
case TouchEventType::ENDED:
|
case TouchEventType::ENDED:
|
||||||
|
_touchEndPosition = touch->getLocation();
|
||||||
handleReleaseLogic(touch);
|
handleReleaseLogic(touch);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,7 @@ _barRendererAdaptDirty(true),
|
||||||
_progressBarRendererDirty(true),
|
_progressBarRendererDirty(true),
|
||||||
_eventCallback(nullptr)
|
_eventCallback(nullptr)
|
||||||
{
|
{
|
||||||
|
setTouchEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Slider::~Slider()
|
Slider::~Slider()
|
||||||
|
|
|
@ -206,8 +206,9 @@ bool Widget::init()
|
||||||
onFocusChanged = CC_CALLBACK_2(Widget::onFocusChange,this);
|
onFocusChanged = CC_CALLBACK_2(Widget::onFocusChange,this);
|
||||||
onNextFocusedWidget = nullptr;
|
onNextFocusedWidget = nullptr;
|
||||||
this->setAnchorPoint(Vec2(0.5f, 0.5f));
|
this->setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||||
|
|
||||||
ignoreContentAdaptWithSize(true);
|
ignoreContentAdaptWithSize(true);
|
||||||
this->setTouchEnabled(true);
|
|
||||||
this->setCascadeColorEnabled(true);
|
this->setCascadeColorEnabled(true);
|
||||||
this->setCascadeOpacityEnabled(true);
|
this->setCascadeOpacityEnabled(true);
|
||||||
|
|
||||||
|
@ -1033,7 +1034,6 @@ void Widget::copyProperties(Widget *widget)
|
||||||
|
|
||||||
copySpecialProperties(widget);
|
copySpecialProperties(widget);
|
||||||
|
|
||||||
//FIXME:copy focus properties, also make sure all the subclass the copy behavior is correct
|
|
||||||
Map<int, LayoutParameter*>& layoutParameterDic = widget->_layoutParameterDictionary;
|
Map<int, LayoutParameter*>& layoutParameterDic = widget->_layoutParameterDictionary;
|
||||||
for (auto iter = layoutParameterDic.begin(); iter != layoutParameterDic.end(); ++iter)
|
for (auto iter = layoutParameterDic.begin(); iter != layoutParameterDic.end(); ++iter)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue