view.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, false );
DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), false, TEST_LOCATION );
+ // Test "overshootSize" property
+ DALI_TEST_CHECK( view.GetPropertyIndex("overshootSize") == Scrollable::Property::OVERSHOOT_SIZE );
+ Vector2 overshootSize = Vector2(100.0f,100.0f);
+ view.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, overshootSize );
+ DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_SIZE).Get<Vector2>(), overshootSize, TEST_LOCATION );
+
// Animatable properties
// Test "layoutPosition" property
// Set up a scrollView...
ScrollView scrollView = ScrollView::New();
scrollView.SetOvershootEnabled(true);
+
+ Vector2 overshootSize = Vector2(100.0f,100.0f);
+ scrollView.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, overshootSize );
+ DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_SIZE).Get<Vector2>(), overshootSize, TEST_LOCATION );
+
Stage::GetCurrent().Add( scrollView );
Vector2 stageSize = Stage::GetCurrent().GetSize();
scrollView.SetSize(stageSize);
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
*/
return false;
}
+/**
+ * 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
Dali::Toolkit::ItemView ItemView::New(ItemFactory& factory)
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;
mOvershootOverlay.SetDrawMode( 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();
-
- mOvershootOverlay.SetSize(mOvershootSize.width, mOvershootSize.height);
+ ApplyOvershootSizeConstraint( mOvershootOverlay, 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 ) );