X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fscrollable%2Fscroll-view%2Fscroll-view-impl.cpp;h=1d53111b0bf05be12a7fc1a42cad426c50ee0128;hp=82df8cc0952a87dd3657a8c5f3288769e5bbcc55;hb=1f316c7e8f22f1ada38dfdff44d556205bb40ca4;hpb=e10dee76cbcdf041bc522545c323016c9f62e8f7 diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp index 82df8cc..1d53111 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp @@ -23,9 +23,9 @@ #include #include #include -#include +#include #include -#include +#include #include // INTERNAL INCLUDES @@ -683,6 +683,7 @@ void ScrollView::OnInitialize() mGestureStackDepth = 0; + self.TouchSignal().Connect( this, &ScrollView::OnTouch ); EnableGestureDetection( Gesture::Type( Gesture::Pan ) ); // By default we'll allow the user to freely drag the scroll view, @@ -1175,19 +1176,6 @@ Vector2 ScrollView::GetCurrentScrollPosition() const return -GetPropertyPosition(); } -Vector2 ScrollView::GetDomainSize() const -{ - Vector3 size = Self().GetCurrentSize(); - - const RulerDomain& xDomain = GetRulerX()->GetDomain(); - const RulerDomain& yDomain = GetRulerY()->GetDomain(); - - Vector2 domainSize; - domainSize.x = xDomain.max - xDomain.min - size.x; - domainSize.y = yDomain.max - yDomain.min - size.y; - return domainSize; -} - void ScrollView::TransformTo(const Vector2& position, DirectionBias horizontalBias, DirectionBias verticalBias) { @@ -1956,6 +1944,8 @@ void ScrollView::OnSizeSet( const Vector3& size ) void ScrollView::OnChildAdd(Actor& child) { + ScrollBase::OnChildAdd( child ); + Dali::Toolkit::ScrollBar scrollBar = Dali::Toolkit::ScrollBar::DownCast(child); if(scrollBar) { @@ -1987,6 +1977,8 @@ void ScrollView::OnChildRemove(Actor& child) { // TODO: Actor needs a RemoveConstraint method to take out an individual constraint. UnbindActor(child); + + ScrollBase::OnChildRemove( child ); } void ScrollView::StartTouchDownTimer() @@ -2039,7 +2031,7 @@ bool ScrollView::OnTouchDownTimeout() return false; } -bool ScrollView::OnTouchEvent(const TouchEvent& event) +bool ScrollView::OnTouch( Actor actor, const TouchData& touch ) { if(!mSensitive) { @@ -2050,21 +2042,21 @@ bool ScrollView::OnTouchEvent(const TouchEvent& event) } // Ignore events with multiple-touch points - if (event.GetPointCount() != 1) + if (touch.GetPointCount() != 1) { DALI_LOG_SCROLL_STATE("[0x%X], multiple touch, ignoring", this); return false; } - const TouchPoint::State pointState = event.GetPoint(0).state; - if( pointState == TouchPoint::Down ) + const PointState::Type pointState = touch.GetState( 0 ); + if( pointState == PointState::DOWN ) { DALI_LOG_SCROLL_STATE("[0x%X] Down", this); if(mGestureStackDepth==0) { - mTouchDownTime = event.time; + mTouchDownTime = touch.GetTime(); // This allows time for a pan-gesture to start, to avoid breaking snap-animation behavior with fast flicks. // If touch-down does not become a pan (after timeout interval), then snap-animation can be interrupted. @@ -2073,8 +2065,8 @@ bool ScrollView::OnTouchEvent(const TouchEvent& event) StartTouchDownTimer(); } } - else if( ( pointState == TouchPoint::Up ) || - ( ( pointState == TouchPoint::Interrupted ) && ( event.GetPoint(0).hitActor == Self() ) ) ) + else if( ( pointState == PointState::UP ) || + ( ( pointState == PointState::INTERRUPTED ) && ( touch.GetHitActor( 0 )== Self() ) ) ) { DALI_LOG_SCROLL_STATE("[0x%X] %s", this, ( ( pointState == TouchPoint::Up ) ? "Up" : "Interrupted" ) ); @@ -2085,8 +2077,8 @@ bool ScrollView::OnTouchEvent(const TouchEvent& event) // otherwise our scroll could be stopped (interrupted) half way through an animation. if(mGestureStackDepth==0 && mTouchDownTimeoutReached) { - if( ( event.GetPoint(0).state == TouchPoint::Interrupted ) || - ( ( event.time - mTouchDownTime ) >= MINIMUM_TIME_BETWEEN_DOWN_AND_UP_FOR_RESET ) ) + if( ( pointState == PointState::INTERRUPTED ) || + ( ( touch.GetTime() - mTouchDownTime ) >= MINIMUM_TIME_BETWEEN_DOWN_AND_UP_FOR_RESET ) ) { // Reset the velocity only if down was received a while ago mLastVelocity = Vector2( 0.0f, 0.0f );