Merge pull request #7818 from andyque/fixPageViewTouchBeganPositionIssue

fix pageView touch location
This commit is contained in:
minggo 2014-08-20 10:11:59 +08:00
commit 41905cb4c0
2 changed files with 4 additions and 1 deletions

View File

@ -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())
{

View File

@ -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);
}
}