#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
-#include <dali/devel-api/common/set-wrapper.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/events/wheel-event.h>
#include <dali/public-api/events/touch-data.h>
#include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/default-item-layout.h>
-#include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
-#include <dali-toolkit/devel-api/controls/scrollable/item-view/item-view-devel.h>
+#include <dali-toolkit/public-api/controls/scrollable/item-view/default-item-layout-property.h>
#include <dali-toolkit/internal/controls/scrollable/item-view/grid-layout.h>
#include <dali-toolkit/internal/controls/scrollable/item-view/depth-layout.h>
#include <dali-toolkit/internal/controls/scrollable/item-view/spiral-layout.h>
#include <dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.h>
using std::string;
-using std::set;
using namespace Dali;
namespace // Unnamed namespace
const Vector4 OVERSHOOT_OVERLAY_NINE_PATCH_BORDER(0.0f, 0.0f, 1.0f, 12.0f);
const float DEFAULT_KEYBOARD_FOCUS_SCROLL_DURATION = 0.2f;
+const unsigned int OVERSHOOT_SIZE_CONSTRAINT_TAG(42);
+
/**
* Local helper to convert pan distance (in actor coordinates) to the layout-specific scrolling direction
*/
DALI_PROPERTY_REGISTRATION( Toolkit, ItemView, "wheelScrollDistanceStep", FLOAT, WHEEL_SCROLL_DISTANCE_STEP )
DALI_PROPERTY_REGISTRATION( Toolkit, ItemView, "snapToItemEnabled", BOOLEAN, SNAP_TO_ITEM_ENABLED )
DALI_PROPERTY_REGISTRATION( Toolkit, ItemView, "refreshInterval", FLOAT, REFRESH_INTERVAL )
-DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, ItemView, "layout", ARRAY, LAYOUT )
+DALI_PROPERTY_REGISTRATION( Toolkit, ItemView, "layout", ARRAY, LAYOUT )
DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ItemView, "layoutPosition", FLOAT, LAYOUT_POSITION)
DALI_TYPE_REGISTRATION_END()
-bool FindById( const ItemContainer& items, ItemId id )
+const ItemIter FindItemById( ItemContainer& items, ItemId id )
{
- for( ConstItemIter iter = items.begin(); items.end() != iter; ++iter )
+ for( ItemIter iter = items.begin(); items.end() != iter; ++iter )
{
if( iter->first == id )
{
- return true;
+ return iter;
}
}
- return false;
+ return items.end();
+}
+
+void InsertToItemContainer( ItemContainer& items, Item item )
+{
+ if( items.end() == FindItemById( items, item.first ) )
+ {
+ ItemIter iterToInsert = std::lower_bound( items.begin(), items.end(), item );
+ items.insert( iterToInsert, item );
+ }
+}
+
+
+/**
+ * Helper to apply size constraint to mOvershootOverlay
+ * @param[in] overshootOverlay The overshootOverlay actor
+ * @param[in] The required height
+ */
+void ApplyOvershootSizeConstraint( Actor overshootOverlay, float height )
+{
+ Constraint constraint = Constraint::New<Vector3>( overshootOverlay, Actor::Property::SIZE, OvershootOverlaySizeConstraint( height ) );
+ constraint.AddSource( ParentSource( Dali::Toolkit::ItemView::Property::SCROLL_DIRECTION ) );
+ constraint.AddSource( ParentSource( Dali::Toolkit::ItemView::Property::LAYOUT_ORIENTATION ) );
+ constraint.AddSource( ParentSource( Dali::Actor::Property::SIZE ) );
+ constraint.SetTag( OVERSHOOT_SIZE_CONSTRAINT_TAG );
+ constraint.Apply();
}
} // unnamed namespace
float ItemView::GetCurrentLayoutPosition(unsigned int itemId) const
{
- return Self().GetProperty<float>( Toolkit::ItemView::Property::LAYOUT_POSITION ) + static_cast<float>( itemId );
+ return Self().GetCurrentProperty< float >( Toolkit::ItemView::Property::LAYOUT_POSITION ) + static_cast<float>( itemId );
}
void ItemView::ActivateLayout(unsigned int layoutIndex, const Vector3& targetSize, float durationSeconds)
// Move the items to the new layout positions...
- for (ConstItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
+ for (ConstItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
{
unsigned int itemId = iter->first;
Actor actor = iter->second;
{
if (mActiveLayout)
{
- for (ConstItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
+ for (ConstItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
{
Actor actor = iter->second;
actor.RemoveConstraints();
void ItemView::Refresh()
{
- for (ItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter )
+ for (ConstItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter )
{
ReleaseActor( iter->first, iter->second );
}
{
ItemRange range = GetItemRange(*mActiveLayout, mActiveLayoutTargetSize, currentLayoutPosition, cacheExtra/*reserve extra*/);
RemoveActorsOutsideRange( range );
- AddActorsWithinRange( range, Self().GetCurrentSize() );
+ AddActorsWithinRange( range, Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ) );
mScrollUpdatedSignal.Emit( Vector2(0.0f, currentLayoutPosition) );
}
{
Actor actor;
- ConstItemPoolIter iter = mItemPool.find( itemId );
- if( iter != mItemPool.end() )
+ for ( ConstItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter )
{
- actor = iter->second;
+ if( iter->first == itemId )
+ {
+ actor = iter->second;
+ break;
+ }
}
return actor;
{
unsigned int itemId( 0 );
- for ( ConstItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter )
+ for ( ConstItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter )
{
if( iter->second == actor )
{
void ItemView::InsertItem( Item newItem, float durationSeconds )
{
mAddingItems = true;
- Vector3 layoutSize = Self().GetCurrentSize();
+ Vector3 layoutSize = Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
Actor displacedActor;
- ItemPoolIter afterDisplacedIter = mItemPool.end();
+ ItemIter afterDisplacedIter = mItemPool.end();
- ItemPoolIter foundIter = mItemPool.find( newItem.first );
+ ItemIter foundIter = FindItemById( mItemPool, newItem.first );
if( mItemPool.end() != foundIter )
{
SetupActor( newItem, layoutSize );
else
{
// Inserting before the existing item range?
- ItemPoolIter iter = mItemPool.begin();
+ ItemIter iter = mItemPool.begin();
if( iter != mItemPool.end() &&
iter->first > newItem.first )
{
displacedActor = iter->second;
- mItemPool.erase( iter++ ); // iter is still valid after the erase
+ iter = mItemPool.erase( iter ); // iter is still valid after the erase
afterDisplacedIter = iter;
}
if( displacedActor )
{
// Move the existing actors to make room
- for( ItemPoolIter iter = afterDisplacedIter; mItemPool.end() != iter; ++iter )
+ for( ItemIter iter = afterDisplacedIter; mItemPool.end() != iter; ++iter )
{
Actor temp = iter->second;
iter->second = displacedActor;
}
// Create last item
- ItemPool::reverse_iterator lastIter = mItemPool.rbegin();
+ ItemContainer::reverse_iterator lastIter = mItemPool.rbegin();
if ( lastIter != mItemPool.rend() )
{
ItemId lastId = lastIter->first;
Item lastItem( lastId + 1, displacedActor );
- mItemPool.insert( lastItem );
+ InsertToItemContainer( mItemPool, lastItem );
lastItem.second.RemoveConstraints();
mActiveLayout->ApplyConstraints( lastItem.second, lastItem.first, layoutSize, Self() );
void ItemView::InsertItems( const ItemContainer& newItems, float durationSeconds )
{
mAddingItems = true;
- Vector3 layoutSize = Self().GetCurrentSize();
+ Vector3 layoutSize = Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
// Insert from lowest id to highest
- std::set<Item> sortedItems;
- for( ConstItemIter iter = newItems.begin(); newItems.end() != iter; ++iter )
- {
- sortedItems.insert( *iter );
- }
+ ItemContainer sortedItems(newItems);
+ std::sort( sortedItems.begin(), sortedItems.end() );
- for( std::set<Item>::iterator iter = sortedItems.begin(); sortedItems.end() != iter; ++iter )
+ for( ItemIter iter = sortedItems.begin(); sortedItems.end() != iter; ++iter )
{
Self().Add( iter->second );
- ItemPoolIter foundIter = mItemPool.find( iter->first );
+ ItemIter foundIter = FindItemById( mItemPool, iter->first );
if( mItemPool.end() != foundIter )
{
Actor moveMe = foundIter->second;
foundIter->second = iter->second;
// Move the existing actors to make room
- for( ItemPoolIter iter = ++foundIter; mItemPool.end() != iter; ++iter )
+ for( ItemIter iter = ++foundIter; mItemPool.end() != iter; ++iter )
{
Actor temp = iter->second;
iter->second = moveMe;
// Create last item
ItemId lastId = mItemPool.rbegin()->first;
Item lastItem( lastId + 1, moveMe );
- mItemPool.insert( lastItem );
+ InsertToItemContainer( mItemPool, lastItem );
}
else
{
- mItemPool.insert( *iter );
+ InsertToItemContainer( mItemPool, *iter );
}
}
// Relayout everything
- for (ItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
+ for (ItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
{
// If newly inserted
- if( FindById( newItems, iter->first ) )
+ if( std::binary_search( sortedItems.begin(), sortedItems.end(), *iter ) )
{
SetupActor( *iter, layoutSize );
}
bool actorsReordered( false );
// Remove from highest id to lowest
- set<ItemId> sortedItems;
- for( ConstItemIdIter iter = itemIds.begin(); itemIds.end() != iter; ++iter )
- {
- sortedItems.insert( *iter );
- }
+ ItemIdContainer sortedItems(itemIds);
+ std::sort( sortedItems.begin(), sortedItems.end() );
- for( set<ItemId>::reverse_iterator iter = sortedItems.rbegin(); sortedItems.rend() != iter; ++iter )
+ for( ItemIdContainer::reverse_iterator iter = sortedItems.rbegin(); sortedItems.rend() != iter; ++iter )
{
if( RemoveActor( *iter ) )
{
{
bool reordered( false );
- ItemPoolIter removeIter = mItemPool.find( itemId );
+ ItemIter removeIter = FindItemById( mItemPool, itemId );
if( removeIter != mItemPool.end() )
{
ReleaseActor(itemId, removeIter->second);
else
{
// Removing before the existing item range?
- ItemPoolIter iter = mItemPool.begin();
+ ItemIter iter = mItemPool.begin();
if( iter != mItemPool.end() &&
iter->first > itemId )
{
// In order to decrement the first visible item ID
- mItemPool.insert( Item(iter->first - 1, Actor()) );
+ InsertToItemContainer( mItemPool, Item(iter->first - 1, Actor()) );
removeIter = mItemPool.begin();
}
// ID 2 - ActorB ID 2 - ActorC (previously ID 3)
// ID 3 - ActorC ID 3 - ActorB (previously ID 4)
// ID 4 - ActorD
- for (ItemPoolIter iter = removeIter; iter != mItemPool.end(); ++iter)
+ for (ItemIter iter = removeIter; iter != mItemPool.end(); ++iter)
{
if( iter->first < mItemPool.rbegin()->first )
{
- iter->second = mItemPool[ iter->first + 1 ];
+ iter->second = ( iter + 1 )->second;
}
else
{
void ItemView::ReplaceItem( Item replacementItem, float durationSeconds )
{
mAddingItems = true;
- Vector3 layoutSize = Self().GetCurrentSize();
+ Vector3 layoutSize = Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
SetupActor( replacementItem, layoutSize );
Self().Add( replacementItem.second );
- const ItemPoolIter iter = mItemPool.find( replacementItem.first );
+ const ItemIter iter = FindItemById( mItemPool, replacementItem.first );
if( mItemPool.end() != iter )
{
ReleaseActor(iter->first, iter->second);
}
else
{
- mItemPool.insert( replacementItem );
+ InsertToItemContainer( mItemPool, replacementItem );
}
CalculateDomainSize( layoutSize );
void ItemView::RemoveActorsOutsideRange( ItemRange range )
{
// Remove unwanted actors from the ItemView & ItemPool
- for (ItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); )
+ for (ItemIter iter = mItemPool.begin(); iter != mItemPool.end(); )
{
unsigned int current = iter->first;
{
ReleaseActor(iter->first, iter->second);
- mItemPool.erase( iter++ ); // erase invalidates the return value of post-increment; iter remains valid
+ iter = mItemPool.erase( iter ); // iter is still valid after the erase
}
else
{
// Total number of items may change dynamically.
// Always recalculate the domain size to reflect that.
- CalculateDomainSize(Self().GetCurrentSize());
+ CalculateDomainSize(Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
}
void ItemView::AddNewActor( unsigned int itemId, const Vector3& layoutSize )
{
mAddingItems = true;
- if( mItemPool.end() == mItemPool.find( itemId ) )
+ if( mItemPool.end() == FindItemById( mItemPool, itemId ) )
{
Actor actor = mItemFactory.NewItem( itemId );
{
Item newItem( itemId, actor );
- mItemPool.insert( newItem );
+ InsertToItemContainer( mItemPool, newItem );
SetupActor( newItem, layoutSize );
Self().Add( actor );
void ItemView::SetupActor( Item item, const Vector3& layoutSize )
{
- item.second.SetParentOrigin( mItemsParentOrigin );
- item.second.SetAnchorPoint( mItemsAnchorPoint );
+ item.second.SetProperty( Actor::Property::PARENT_ORIGIN, mItemsParentOrigin );
+ item.second.SetProperty( Actor::Property::ANCHOR_POINT, mItemsAnchorPoint );
if( mActiveLayout )
{
if (mActiveLayout)
{
Actor self = Self();
- const Vector3 layoutSize = Self().GetCurrentSize();
+ const Vector3 layoutSize = Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
float layoutPositionDelta = GetCurrentLayoutPosition(0) - (event.z * mWheelScrollDistanceStep * mActiveLayout->GetScrollSpeedFactor());
float firstItemScrollPosition = ClampFirstItemPosition(layoutPositionDelta, layoutSize, *mActiveLayout);
void ItemView::ReapplyAllConstraints()
{
- Vector3 layoutSize = Self().GetCurrentSize();
+ Vector3 layoutSize = Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
- for (ConstItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
+ for (ConstItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
{
unsigned int id = iter->first;
Actor actor = iter->second;
void ItemView::OnItemsRemoved()
{
- CalculateDomainSize(Self().GetCurrentSize());
+ CalculateDomainSize(Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
// Adjust scroll-position after an item is removed
if( mActiveLayout )
{
- float firstItemScrollPosition = ClampFirstItemPosition(GetCurrentLayoutPosition(0), Self().GetCurrentSize(), *mActiveLayout);
+ float firstItemScrollPosition = ClampFirstItemPosition(GetCurrentLayoutPosition(0), Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), *mActiveLayout);
Self().SetProperty( Toolkit::ItemView::Property::LAYOUT_POSITION, firstItemScrollPosition );
}
}
void ItemView::OnPan( const PanGesture& gesture )
{
Actor self = Self();
- const Vector3 layoutSize = Self().GetCurrentSize();
+ const Vector3 layoutSize = Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
RemoveAnimation(mScrollAnimation);
mScrollAnimation.AnimateTo( Property(self, Toolkit::ItemView::Property::SCROLL_SPEED), 0.0f, AlphaFunction::EASE_OUT );
mIsFlicking = true;
+
// Check whether it has already scrolled to the end
- if(fabs(currentLayoutPosition - firstItemScrollPosition) > Math::MACHINE_EPSILON_0)
+ if( fabs(currentLayoutPosition - firstItemScrollPosition) < Math::MACHINE_EPSILON_0 )
{
- AnimateScrollOvershoot(0.0f);
+ AnimateScrollOvershoot( 0.0f );
+ RemoveAnimation( mScrollAnimation );
}
}
float firstItemScrollPosition = ClampFirstItemPosition(layoutPositionDelta, layoutSize, *mActiveLayout);
- float currentOvershoot = self.GetProperty<float>(Toolkit::ItemView::Property::OVERSHOOT);
+ float currentOvershoot = self.GetCurrentProperty< float >( Toolkit::ItemView::Property::OVERSHOOT );
self.SetProperty(Toolkit::ItemView::Property::LAYOUT_POSITION, firstItemScrollPosition );
}
}
float layoutPosition = mActiveLayout->GetClosestAnchorPosition( GetCurrentLayoutPosition(0) );
- Vector3 layoutSize = Self().GetCurrentSize();
+ Vector3 layoutSize = Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
if(!nextFocusActor)
{
// likely the current item is not buffered, so not in our item pool, probably best to get first viewable item
{
int nextItemID = GetItemId(commitedFocusableActor);
float layoutPosition = GetCurrentLayoutPosition(0);
- Vector3 layoutSize = Self().GetCurrentSize();
+ Vector3 layoutSize = Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
float scrollTo = mActiveLayout->GetClosestOnScreenLayoutPosition(nextItemID, layoutPosition, layoutSize);
ScrollTo(Vector2(0.0f, scrollTo), DEFAULT_KEYBOARD_FOCUS_SCROLL_DURATION);
void ItemView::ScrollToItem(unsigned int itemId, float durationSeconds)
{
Actor self = Self();
- const Vector3 layoutSize = Self().GetCurrentSize();
+ const Vector3 layoutSize = Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
float firstItemScrollPosition = ClampFirstItemPosition(mActiveLayout->GetItemScrollToPosition(itemId), layoutSize, *mActiveLayout);
if(durationSeconds > 0.0f)
Vector2 ItemView::GetCurrentScrollPosition() const
{
- return Vector2(0.0f, GetScrollPosition(GetCurrentLayoutPosition(0), Self().GetCurrentSize()));
+ return Vector2(0.0f, GetScrollPosition(GetCurrentLayoutPosition(0), Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE )));
}
void ItemView::AddOverlay(Actor actor)
{
- actor.SetDrawMode( DrawMode::OVERLAY_2D );
+ actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
Self().Add(actor);
}
void ItemView::ScrollTo(const Vector2& position, float duration)
{
Actor self = Self();
- const Vector3 layoutSize = Self().GetCurrentSize();
+ const Vector3 layoutSize = Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
float firstItemScrollPosition = ClampFirstItemPosition(position.y, layoutSize, *mActiveLayout);
mRefreshEnabled = true;
}
+void ItemView::SetOvershootSize( const Vector2& size )
+{
+ mOvershootSize = size;
+
+ if( mOvershootOverlay )
+ {
+ // Remove old & add new size constraint
+ mOvershootOverlay.RemoveConstraints( OVERSHOOT_SIZE_CONSTRAINT_TAG );
+ ApplyOvershootSizeConstraint( mOvershootOverlay, mOvershootSize.height );
+ }
+}
+
void ItemView::SetOvershootEffectColor( const Vector4& color )
{
mOvershootEffectColor = color;
if( mOvershootOverlay )
{
- mOvershootOverlay.SetColor( color );
+ mOvershootOverlay.SetProperty( Actor::Property::COLOR, color );
}
}
{
Property::Index effectOvershootPropertyIndex = Property::INVALID_INDEX;
mOvershootOverlay = CreateBouncingEffectActor( effectOvershootPropertyIndex );
- mOvershootOverlay.SetColor(mOvershootEffectColor);
- mOvershootOverlay.SetParentOrigin(ParentOrigin::TOP_LEFT);
- mOvershootOverlay.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- mOvershootOverlay.SetDrawMode( DrawMode::OVERLAY_2D );
+ mOvershootOverlay.SetProperty( Actor::Property::COLOR,mOvershootEffectColor);
+ mOvershootOverlay.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT );
+ mOvershootOverlay.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ mOvershootOverlay.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
self.Add(mOvershootOverlay);
- Constraint constraint = Constraint::New<Vector3>( mOvershootOverlay, Actor::Property::SIZE, OvershootOverlaySizeConstraint(mOvershootSize.height) );
- constraint.AddSource( ParentSource( Toolkit::ItemView::Property::SCROLL_DIRECTION ) );
- constraint.AddSource( ParentSource( Toolkit::ItemView::Property::LAYOUT_ORIENTATION ) );
- constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
- constraint.Apply();
+ ApplyOvershootSizeConstraint( mOvershootOverlay, mOvershootSize.height );
- mOvershootOverlay.SetSize(mOvershootSize.width, mOvershootSize.height);
-
- constraint = Constraint::New<Quaternion>( mOvershootOverlay, Actor::Property::ORIENTATION, OvershootOverlayRotationConstraint );
+ Constraint constraint = Constraint::New<Quaternion>( mOvershootOverlay, Actor::Property::ORIENTATION, OvershootOverlayRotationConstraint );
constraint.AddSource( ParentSource( Toolkit::ItemView::Property::SCROLL_DIRECTION ) );
constraint.AddSource( ParentSource( Toolkit::ItemView::Property::LAYOUT_ORIENTATION ) );
constraint.AddSource( ParentSource( Toolkit::ItemView::Property::OVERSHOOT ) );
Actor self = Self();
float scrollDistance = CalculateScrollDistance(mTotalPanDisplacement, *mActiveLayout) * mActiveLayout->GetScrollSpeedFactor();
float positionDelta = GetCurrentLayoutPosition(0) + scrollDistance;
- float minLayoutPosition = mActiveLayout->GetMinimumLayoutPosition(mItemFactory.GetNumberOfItems(), Self().GetCurrentSize());
+ float minLayoutPosition = mActiveLayout->GetMinimumLayoutPosition(mItemFactory.GetNumberOfItems(), Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX, Vector2(0.0f, -minLayoutPosition));
float clamppedPosition = std::min(0.0f, std::max(minLayoutPosition, positionDelta));
overshoot = positionDelta - clamppedPosition;
if(mOvershootAnimationSpeed > Math::MACHINE_EPSILON_0)
{
- float currentOvershoot = self.GetProperty<float>(Toolkit::ItemView::Property::OVERSHOOT);
+ float currentOvershoot = self.GetCurrentProperty< float >( Toolkit::ItemView::Property::OVERSHOOT );
float duration = 0.0f;
if (mOvershootOverlay)
{
- duration = mOvershootOverlay.GetCurrentSize().height * (animatingOn ? (1.0f - fabsf(currentOvershoot)) : fabsf(currentOvershoot)) / mOvershootAnimationSpeed;
+ duration = mOvershootOverlay.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height * (animatingOn ? (1.0f - fabsf(currentOvershoot)) : fabsf(currentOvershoot)) / mOvershootAnimationSpeed;
}
// Mark the animation as in progress to prevent manual property sets overwriting it.
if( parentOrigin != mItemsParentOrigin )
{
mItemsParentOrigin = parentOrigin;
- for (ItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
+ for (ItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
{
- iter->second.SetParentOrigin(parentOrigin);
+ iter->second.SetProperty( Actor::Property::PARENT_ORIGIN,parentOrigin );
}
}
}
if( anchorPoint != mItemsAnchorPoint )
{
mItemsAnchorPoint = anchorPoint;
- for (ItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
+ for (ItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
{
- iter->second.SetAnchorPoint(anchorPoint);
+ iter->second.SetProperty( Actor::Property::ANCHOR_POINT,anchorPoint);
}
}
}
itemViewImpl.SetMinimumSwipeSpeed( value.Get<float>() );
break;
}
+
case Toolkit::ItemView::Property::MINIMUM_SWIPE_DISTANCE:
{
itemViewImpl.SetMinimumSwipeDistance( value.Get<float>() );
break;
}
+
case Toolkit::ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP:
{
itemViewImpl.SetWheelScrollDistanceStep( value.Get<float>() );
break;
}
+
case Toolkit::ItemView::Property::SNAP_TO_ITEM_ENABLED:
{
itemViewImpl.SetAnchoring( value.Get<bool>() );
break;
}
+
case Toolkit::ItemView::Property::REFRESH_INTERVAL:
{
itemViewImpl.SetRefreshInterval( value.Get<float>() );
break;
}
- case Toolkit::DevelItemView::Property::LAYOUT:
+
+ case Toolkit::ItemView::Property::LAYOUT:
{
// Get a Property::Array from the property if possible.
Property::Array layoutArray;
value = itemViewImpl.GetMinimumSwipeSpeed();
break;
}
+
case Toolkit::ItemView::Property::MINIMUM_SWIPE_DISTANCE:
{
value = itemViewImpl.GetMinimumSwipeDistance();
break;
}
+
case Toolkit::ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP:
{
value = itemViewImpl.GetWheelScrollDistanceStep();
break;
}
+
case Toolkit::ItemView::Property::SNAP_TO_ITEM_ENABLED:
{
value = itemViewImpl.GetAnchoring();
break;
}
+
case Toolkit::ItemView::Property::REFRESH_INTERVAL:
{
value = itemViewImpl.GetRefreshInterval();
break;
}
- case Toolkit::DevelItemView::Property::LAYOUT:
+
+ case Toolkit::ItemView::Property::LAYOUT:
{
Property::Array layouts= itemViewImpl.GetLayoutArray();
value = layouts;
break;
}
-
}
}