mirror of https://github.com/axmolengine/axmol.git
issue #5183, refactor UIScrollView
This commit is contained in:
parent
ee24e137f7
commit
a9e1c50897
|
@ -858,14 +858,10 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO
|
|||
return scrollenabled;
|
||||
}
|
||||
|
||||
bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY)
|
||||
bool ScrollView::scrollChilderVertical(float touchOffsetX, float touchOffsetY)
|
||||
{
|
||||
bool scrollenabled = true;
|
||||
scrollingEvent();
|
||||
switch (_direction)
|
||||
{
|
||||
case Direction::VERTICAL: // vertical
|
||||
{
|
||||
|
||||
float realOffset = touchOffsetY;
|
||||
if (_bounceEnabled)
|
||||
{
|
||||
|
@ -902,10 +898,14 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY)
|
|||
}
|
||||
}
|
||||
moveChildren(0.0f, realOffset);
|
||||
break;
|
||||
}
|
||||
case Direction::HORIZONTAL: // horizontal
|
||||
{
|
||||
|
||||
return scrollenabled;
|
||||
}
|
||||
|
||||
bool ScrollView::scrollChilderHorizontal(float touchOffsetX, float touchOffsetY)
|
||||
{
|
||||
bool scrollenabled = true;
|
||||
|
||||
float realOffset = touchOffsetX;
|
||||
if (_bounceEnabled)
|
||||
{
|
||||
|
@ -942,10 +942,13 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY)
|
|||
}
|
||||
}
|
||||
moveChildren(realOffset, 0.0f);
|
||||
break;
|
||||
}
|
||||
case Direction::BOTH:
|
||||
{
|
||||
|
||||
return scrollenabled;
|
||||
}
|
||||
|
||||
bool ScrollView::scrollChilderBoth(float touchOffsetX, float touchOffsetY)
|
||||
{
|
||||
bool scrollenabled = true;
|
||||
float realOffsetX = touchOffsetX;
|
||||
float realOffsetY = touchOffsetY;
|
||||
if (_bounceEnabled)
|
||||
|
@ -1171,6 +1174,29 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY)
|
|||
}
|
||||
}
|
||||
moveChildren(realOffsetX, realOffsetY);
|
||||
return scrollenabled;
|
||||
}
|
||||
|
||||
bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY)
|
||||
{
|
||||
bool scrollenabled = true;
|
||||
scrollingEvent();
|
||||
|
||||
switch (_direction)
|
||||
{
|
||||
case Direction::VERTICAL: // vertical
|
||||
{
|
||||
scrollenabled = this->scrollChilderVertical(touchOffsetX, touchOffsetY);
|
||||
break;
|
||||
}
|
||||
case Direction::HORIZONTAL: // horizontal
|
||||
{
|
||||
scrollenabled = this->scrollChilderHorizontal(touchOffsetX, touchOffsetY);
|
||||
break;
|
||||
}
|
||||
case Direction::BOTH:
|
||||
{
|
||||
scrollenabled = this->scrollChilderBoth(touchOffsetX, touchOffsetY);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -356,7 +356,13 @@ protected:
|
|||
void startBounceChildren(float v);
|
||||
void stopBounceChildren();
|
||||
bool checkCustomScrollDestination(float* touchOffsetX, float* touchOffsetY);
|
||||
|
||||
virtual bool scrollChildren(float touchOffsetX, float touchOffsetY);
|
||||
virtual bool scrollChilderHorizontal(float touchOffsetX, float touchOffsetY);
|
||||
virtual bool scrollChilderVertical(float touchOffsetX, float touchOffsetY);
|
||||
virtual bool scrollChilderBoth(float touchOffsetX, float touchOffsetY);
|
||||
|
||||
|
||||
bool bounceScrollChildren(float touchOffsetX, float touchOffsetY);
|
||||
void startRecordSlidAction();
|
||||
virtual void endRecordSlidAction();
|
||||
|
|
Loading…
Reference in New Issue