X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fscrollable%2Fitem-view%2Fitem-view-impl.cpp;h=b7c1e579bba0f61169bfa7757760480bd8c337e2;hp=ba2000bf61db139791d34fec52593d2898ed3aa8;hb=1f316c7e8f22f1ada38dfdff44d556205bb40ca4;hpb=d52a13429557137effd2bf7816c8f2171a72faea diff --git a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp index ba2000b..b7c1e57 100644 --- a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp @@ -26,9 +26,9 @@ #include #include #include -#include +#include #include -#include +#include // INTERNAL INCLUDES #include @@ -328,6 +328,7 @@ void ItemView::OnInitialize() Vector2 stageSize = Stage::GetCurrent().GetSize(); mWheelScrollDistanceStep = stageSize.y * DEFAULT_WHEEL_SCROLL_DISTANCE_STEP_PROPORTION; + self.TouchSignal().Connect( this, &ItemView::OnTouch ); EnableGestureDetection(Gesture::Type(Gesture::Pan)); mWheelEventFinishedTimer = Timer::New( WHEEL_EVENT_FINISHED_TIME_OUT ); @@ -980,37 +981,6 @@ void ItemView::OnChildAdd(Actor& child) } } -bool ItemView::OnTouchEvent(const TouchEvent& event) -{ - // Ignore events with multiple-touch points - if (event.GetPointCount() != 1) - { - return false; - } - - if (event.GetPoint(0).state == TouchPoint::Down) - { - // Cancel ongoing scrolling etc. - mGestureState = Gesture::Clear; - - mScrollDistance = 0.0f; - mScrollSpeed = 0.0f; - Self().SetProperty(Toolkit::ItemView::Property::SCROLL_SPEED, mScrollSpeed); - - mScrollOvershoot = 0.0f; - AnimateScrollOvershoot(0.0f); - - if(mScrollAnimation) - { - mScrollCompletedSignal.Emit(GetCurrentScrollPosition()); - } - - RemoveAnimation(mScrollAnimation); - } - - return true; // consume since we're potentially scrolling -} - bool ItemView::OnWheelEvent(const WheelEvent& event) { // Respond the wheel event to scroll @@ -1103,6 +1073,37 @@ float ItemView::ClampFirstItemPosition( float targetPosition, const Vector3& tar return clamppedPosition; } +bool ItemView::OnTouch( Actor actor, const TouchData& touch ) +{ + // Ignore events with multiple-touch points + if (touch.GetPointCount() != 1) + { + return false; + } + + if ( touch.GetState( 0 ) == PointState::DOWN ) + { + // Cancel ongoing scrolling etc. + mGestureState = Gesture::Clear; + + mScrollDistance = 0.0f; + mScrollSpeed = 0.0f; + Self().SetProperty(Toolkit::ItemView::Property::SCROLL_SPEED, mScrollSpeed); + + mScrollOvershoot = 0.0f; + AnimateScrollOvershoot(0.0f); + + if(mScrollAnimation) + { + mScrollCompletedSignal.Emit(GetCurrentScrollPosition()); + } + + RemoveAnimation(mScrollAnimation); + } + + return true; // consume since we're potentially scrolling +} + void ItemView::OnPan( const PanGesture& gesture ) { Actor self = Self(); @@ -1440,16 +1441,6 @@ void ItemView::CalculateDomainSize(const Vector3& layoutSize) } } -Vector2 ItemView::GetDomainSize() const -{ - Actor self = Self(); - - float minScrollPosition = self.GetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MIN_Y); - float maxScrollPosition = self.GetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX_Y); - - return Vector2(0.0f, fabs(GetScrollPosition(minScrollPosition, self.GetCurrentSize()) - GetScrollPosition(-maxScrollPosition, self.GetCurrentSize()))); -} - bool ItemView::IsLayoutScrollable(const Vector3& layoutSize) { Actor self = Self();