mScrollConnector = Dali::Toolkit::ScrollConnector::New();
mScrollPositionObject = mScrollConnector.GetScrollPositionObject();
+ mScrollConnector.ScrollPositionChangedSignal().Connect( this, &ItemView::OnScrollPositionChanged );
mPropertyMinimumLayoutPosition = self.RegisterProperty(MINIMUM_LAYOUT_POSITION_PROPERTY_NAME, 0.0f);
mPropertyPosition = self.RegisterProperty(POSITION_PROPERTY_NAME, 0.0f);
float ItemView::GetCurrentLayoutPosition(unsigned int itemId) const
{
- return mScrollPositionObject.GetProperty<float>( ScrollConnector::SCROLL_POSITION ) + static_cast<float>( itemId );
+ return mScrollConnector.GetScrollPosition() + static_cast<float>( itemId );
}
void ItemView::ActivateLayout(unsigned int layoutIndex, const Vector3& targetSize, float durationSeconds)
void ItemView::OnRefreshNotification(PropertyNotification& source)
{
- if(mRefreshEnabled)
+ if(mRefreshEnabled || mScrollAnimation)
{
// Only refresh the cache during normal scrolling
DoRefresh(GetCurrentLayoutPosition(0), true);
range.end = mItemPool.rbegin()->first + 1;
}
+void ItemView::OnScrollPositionChanged( float position )
+{
+ // Cancel scroll animation to prevent any fighting of setting the scroll position property.
+ RemoveAnimation(mScrollAnimation);
+
+ // Refresh the cache immediately when the scroll position is changed.
+ DoRefresh(position, false); // No need to cache extra items.
+}
+
} // namespace Internal
} // namespace Toolkit