mirror of https://github.com/axmolengine/axmol.git
Merge pull request #7818 from andyque/fixPageViewTouchBeganPositionIssue
fix pageView touch location
This commit is contained in:
commit
41905cb4c0
|
@ -533,6 +533,7 @@ void PageView::interceptTouchEvent(TouchEventType event, Widget *sender, Touch *
|
|||
{
|
||||
case TouchEventType::BEGAN:
|
||||
{
|
||||
_touchBeganPosition = touch->getLocation();
|
||||
_isInterceptTouch = true;
|
||||
}
|
||||
break;
|
||||
|
@ -540,6 +541,7 @@ void PageView::interceptTouchEvent(TouchEventType event, Widget *sender, Touch *
|
|||
{
|
||||
float offset = 0;
|
||||
offset = fabs(sender->getTouchBeganPosition().x - touchPoint.x);
|
||||
_touchMovePosition = touch->getLocation();
|
||||
if (offset > _childFocusCancelOffset)
|
||||
{
|
||||
sender->setHighlighted(false);
|
||||
|
@ -550,6 +552,7 @@ void PageView::interceptTouchEvent(TouchEventType event, Widget *sender, Touch *
|
|||
case TouchEventType::CANCELED:
|
||||
case TouchEventType::ENDED:
|
||||
{
|
||||
_touchEndPosition = touch->getLocation();
|
||||
handleReleaseLogic(touch);
|
||||
if (sender->isSwallowTouches())
|
||||
{
|
||||
|
|
|
@ -1573,10 +1573,10 @@ void ScrollView::interceptTouchEvent(Widget::TouchEventType event, Widget *sende
|
|||
case TouchEventType::MOVED:
|
||||
{
|
||||
float offset = (sender->getTouchBeganPosition() - touchPoint).getLength();
|
||||
_touchMovePosition = touch->getLocation();
|
||||
if (offset > _childFocusCancelOffset)
|
||||
{
|
||||
sender->setHighlighted(false);
|
||||
_touchMovePosition = touch->getLocation();
|
||||
handleMoveLogic(touch);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue