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=001291ff42681bf8caf1a349ac6eab2f5888ee09;hp=5caa208fff3956eca8c1a0a6a955843c43abbf96;hb=a325ccf71f23f1f732cd79a8a5e2e35794f34b05;hpb=f77f0cb417df66a09f468c974e14b881142cf15b 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 5caa208..001291f 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 @@ -410,7 +410,8 @@ ItemView::ItemView(ItemFactory& factory) mScrollOvershoot(0.0f), mIsFlicking(false), mGestureState(Gesture::Clear), - mAddingItems(false) + mAddingItems(false), + mRefreshEnabled(true) { SetRequiresMouseWheelEvents(true); SetKeyboardNavigationSupport(true); @@ -565,7 +566,7 @@ void ItemView::ActivateLayout(unsigned int layoutIndex, const Vector3& targetSiz } // Refresh the new layout - ItemRange range = GetItemRange(*mActiveLayout, targetSize, true/*reserve extra*/); + ItemRange range = GetItemRange(*mActiveLayout, targetSize, GetCurrentLayoutPosition(0), true/*reserve extra*/); AddActorsWithinRange( range, durationSeconds ); // Scroll to an appropriate layout position @@ -636,14 +637,22 @@ AlphaFunction ItemView::GetDefaultAlphaFunction() const void ItemView::OnRefreshNotification(PropertyNotification& source) { + if(mRefreshEnabled) + { + // Only refresh the cache during normal scrolling + DoRefresh(GetCurrentLayoutPosition(0), true); + } +} + +void ItemView::DoRefresh(float currentLayoutPosition, bool cacheExtra) +{ if (mActiveLayout) { - ItemRange range = GetItemRange(*mActiveLayout, mActiveLayoutTargetSize, true/*reserve extra*/); + ItemRange range = GetItemRange(*mActiveLayout, mActiveLayoutTargetSize, currentLayoutPosition, cacheExtra/*reserve extra*/); RemoveActorsOutsideRange( range ); AddActorsWithinRange( range, 0.0f/*immediate*/ ); - Vector3 currentScrollPosition = GetCurrentScrollPosition(); - mScrollUpdatedSignalV2.Emit( currentScrollPosition ); + mScrollUpdatedSignalV2.Emit( Vector3(0.0f, currentLayoutPosition, 0.0f) ); } } @@ -714,6 +723,11 @@ float ItemView::GetRefreshInterval() const return mRefreshIntervalLayoutPositions; } +void ItemView::SetRefreshEnabled(bool enabled) +{ + mRefreshEnabled = enabled; +} + Actor ItemView::GetItem(unsigned int itemId) const { Actor actor; @@ -1030,13 +1044,13 @@ void ItemView::SetupActor( Item item, float durationSeconds ) } } -ItemRange ItemView::GetItemRange(ItemLayout& layout, const Vector3& layoutSize, bool reserveExtra) +ItemRange ItemView::GetItemRange(ItemLayout& layout, const Vector3& layoutSize, float layoutPosition, bool reserveExtra) { unsigned int itemCount = mItemFactory.GetNumberOfItems(); ItemRange available(0u, itemCount); - ItemRange range = layout.GetItemsWithinArea( GetCurrentLayoutPosition(0), layoutSize ); + ItemRange range = layout.GetItemsWithinArea( layoutPosition, layoutSize ); if (reserveExtra) {