X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fscrollable%2Fscroll-view%2Fscroll-view-impl.cpp;h=043ca8d131dcd24a5e67c0d829855abbc150e879;hp=5111cec02f9d803fc31a0bd70b3c4282dbf4d59e;hb=df92f45e89c92ca9b2286d51116ff7b69e75c569;hpb=eea53605c5acb244aebb72d75bdd9b3a68a9678a diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp index 5111cec..043ca8d 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp @@ -19,6 +19,7 @@ #include // EXTERNAL INCLUDES +#include // for strcmp #include #include #include @@ -29,6 +30,7 @@ // INTERNAL INCLUDES #include +#include #include #include #include @@ -168,27 +170,21 @@ float ConstantDecelerationAlphaFunction(float progress) * scroll domain. This is a value from 0.0f to 1.0f in each * scroll position axis. */ -Vector3 InternalRelativePositionConstraint(const Vector3& current, - const PropertyInput& scrollPositionProperty, - const PropertyInput& scrollMinProperty, - const PropertyInput& scrollMaxProperty, - const PropertyInput& scrollSizeProperty) +void InternalRelativePositionConstraint( Vector3& relativePosition, const PropertyInputContainer& inputs) { - Vector3 position = -scrollPositionProperty.GetVector3(); - const Vector3& min = scrollMinProperty.GetVector3(); - const Vector3& max = scrollMaxProperty.GetVector3(); - const Vector3& size = scrollSizeProperty.GetVector3(); + Vector3 position = -inputs[0]->GetVector3(); + const Vector3& min = inputs[1]->GetVector3(); + const Vector3& max = inputs[2]->GetVector3(); + const Vector3& size = inputs[3]->GetVector3(); position.x = WrapInDomain(position.x, min.x, max.x); position.y = WrapInDomain(position.y, min.y, max.y); - Vector3 relativePosition; Vector3 domainSize = (max - min) - size; relativePosition.x = domainSize.x > Math::MACHINE_EPSILON_1 ? fabsf((position.x - min.x) / domainSize.x) : 0.0f; relativePosition.y = domainSize.y > Math::MACHINE_EPSILON_1 ? fabsf((position.y - min.y) / domainSize.y) : 0.0f; - - return relativePosition; + relativePosition.z = 0.0f; } } // unnamed namespace @@ -213,7 +209,19 @@ BaseHandle Create() // Setup properties, signals and actions using the type-registry. DALI_TYPE_REGISTRATION_BEGIN( Toolkit::ScrollView, Toolkit::Scrollable, Create ) -DALI_SIGNAL_REGISTRATION( ScrollView, "value-changed", SIGNAL_SNAP_STARTED ) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ScrollView, "scroll-position", VECTOR3, SCROLL_POSITION ) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ScrollView, "scroll-pre-position", VECTOR3, SCROLL_PRE_POSITION ) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ScrollView, "overshoot-x", FLOAT, OVERSHOOT_X ) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ScrollView, "overshoot-y", FLOAT, OVERSHOOT_Y ) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ScrollView, "scroll-final", VECTOR3, SCROLL_FINAL ) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ScrollView, "wrap", BOOLEAN, WRAP ) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ScrollView, "panning", BOOLEAN, PANNING ) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ScrollView, "scrolling", BOOLEAN, SCROLLING ) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ScrollView, "scroll-domain-offset", VECTOR3, SCROLL_DOMAIN_OFFSET ) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ScrollView, "scroll-position-delta", VECTOR3, SCROLL_POSITION_DELTA ) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ScrollView, "start-page-position", VECTOR3, START_PAGE_POSITION ) + +DALI_SIGNAL_REGISTRATION( Toolkit, ScrollView, "value-changed", SIGNAL_SNAP_STARTED ) DALI_TYPE_REGISTRATION_END() @@ -281,22 +289,19 @@ struct InternalPrePositionConstraint { } - Vector3 operator()(const Vector3& current, - const PropertyInput& gesturePositionProperty, - const PropertyInput& sizeProperty) + void operator()( Vector3& scrollPostPosition, const PropertyInputContainer& inputs ) { - Vector3 scrollPostPosition = current; - Vector2 panPosition = gesturePositionProperty.GetVector2(); + const Vector2& panPosition = inputs[0]->GetVector2(); if(!mWasPanning) { - mPrePosition = current; + mPrePosition = scrollPostPosition; mCurrentPanMask = mInitialPanMask; mWasPanning = true; } // Calculate Deltas... - Vector2 currentPosition = gesturePositionProperty.GetVector2(); + const Vector2& currentPosition = panPosition; Vector2 panDelta( currentPosition - mLocalStart ); // Axis Auto Lock - locks the panning to the horizontal or vertical axis if the pan @@ -322,7 +327,7 @@ struct InternalPrePositionConstraint scrollPostPosition.GetVectorXY() += panDelta; // if no wrapping then clamp preposition to maximum overshoot amount - const Vector3& size = sizeProperty.GetVector3(); + const Vector3& size = inputs[1]->GetVector3(); if( mClampX ) { float newXPosition = Clamp(scrollPostPosition.x, (mDomainMax.x + size.x) - mMaxOvershoot.x, mDomainMin.x + mMaxOvershoot.x ); @@ -345,8 +350,6 @@ struct InternalPrePositionConstraint } scrollPostPosition.y = newYPosition; } - - return scrollPostPosition; } Vector3 mPrePosition; @@ -384,16 +387,12 @@ struct InternalPositionConstraint { } - Vector3 operator()(const Vector3& current, - const PropertyInput& scrollPositionProperty, - const PropertyInput& scrollMinProperty, - const PropertyInput& scrollMaxProperty, - const PropertyInput& scrollSizeProperty) + void operator()( Vector3& position, const PropertyInputContainer& inputs ) { - Vector3 position = scrollPositionProperty.GetVector3(); - const Vector2& size = scrollSizeProperty.GetVector3().GetVectorXY(); - const Vector3& min = scrollMinProperty.GetVector3(); - const Vector3& max = scrollMaxProperty.GetVector3(); + position = inputs[0]->GetVector3(); + const Vector2& size = inputs[3]->GetVector3().GetVectorXY(); + const Vector3& min = inputs[1]->GetVector3(); + const Vector3& max = inputs[2]->GetVector3(); if( mWrap ) { @@ -406,8 +405,6 @@ struct InternalPositionConstraint position.x = mClampX ? Clamp(position.x, mDomainMax.x + size.x, mDomainMin.x ) : position.x; position.y = mClampY ? Clamp(position.y, mDomainMax.y + size.y, mDomainMin.y ) : position.y; } - - return position; } Vector2 mDomainMin; @@ -420,25 +417,25 @@ struct InternalPositionConstraint /** * This constraint updates the X overshoot property using the difference - * mPropertyPrePosition.x and mPropertyPosition.x, returning a relative value between 0.0f and 1.0f + * SCROLL_PRE_POSITION.x and SCROLL_POSITION.x, returning a relative value between 0.0f and 1.0f */ struct OvershootXConstraint { OvershootXConstraint(float maxOvershoot) : mMaxOvershoot(maxOvershoot) {} - float operator()(const float& current, - const PropertyInput& scrollPrePositionProperty, - const PropertyInput& scrollPostPositionProperty, - const PropertyInput& canScrollProperty) + void operator()( float& current, const PropertyInputContainer& inputs ) { - if( canScrollProperty.GetBoolean() ) + if( inputs[2]->GetBoolean() ) { - const Vector3& scrollPrePosition = scrollPrePositionProperty.GetVector3(); - const Vector3& scrollPostPosition = scrollPostPositionProperty.GetVector3(); + const Vector3& scrollPrePosition = inputs[0]->GetVector3(); + const Vector3& scrollPostPosition = inputs[1]->GetVector3(); float newOvershoot = scrollPrePosition.x - scrollPostPosition.x; - return (newOvershoot > 0.0f ? std::min(newOvershoot, mMaxOvershoot) : std::max(newOvershoot, -mMaxOvershoot)) / mMaxOvershoot; + current = (newOvershoot > 0.0f ? std::min(newOvershoot, mMaxOvershoot) : std::max(newOvershoot, -mMaxOvershoot)) / mMaxOvershoot; + } + else + { + current = 0.0f; } - return 0.0f; } float mMaxOvershoot; @@ -446,25 +443,25 @@ struct OvershootXConstraint /** * This constraint updates the Y overshoot property using the difference - * mPropertyPrePosition.y and mPropertyPosition.y, returning a relative value between 0.0f and 1.0f + * SCROLL_PRE_POSITION.y and SCROLL_POSITION.y, returning a relative value between 0.0f and 1.0f */ struct OvershootYConstraint { OvershootYConstraint(float maxOvershoot) : mMaxOvershoot(maxOvershoot) {} - float operator()(const float& current, - const PropertyInput& scrollPrePositionProperty, - const PropertyInput& scrollPostPositionProperty, - const PropertyInput& canScrollProperty) + void operator()( float& current, const PropertyInputContainer& inputs ) { - if( canScrollProperty.GetBoolean() ) + if( inputs[2]->GetBoolean() ) { - const Vector3& scrollPrePosition = scrollPrePositionProperty.GetVector3(); - const Vector3& scrollPostPosition = scrollPostPositionProperty.GetVector3(); + const Vector3& scrollPrePosition = inputs[0]->GetVector3(); + const Vector3& scrollPostPosition = inputs[1]->GetVector3(); float newOvershoot = scrollPrePosition.y - scrollPostPosition.y; - return (newOvershoot > 0.0f ? std::min(newOvershoot, mMaxOvershoot) : std::max(newOvershoot, -mMaxOvershoot)) / mMaxOvershoot; + current = (newOvershoot > 0.0f ? std::min(newOvershoot, mMaxOvershoot) : std::max(newOvershoot, -mMaxOvershoot)) / mMaxOvershoot; + } + else + { + current = 0.0f; } - return 0.0f; } float mMaxOvershoot; @@ -475,14 +472,12 @@ struct OvershootYConstraint * * Generates position-delta property based on scroll-position + scroll-offset properties. */ -Vector3 InternalPositionDeltaConstraint(const Vector3& current, - const PropertyInput& scrollPositionProperty, - const PropertyInput& scrollOffsetProperty) +void InternalPositionDeltaConstraint( Vector3& current, const PropertyInputContainer& inputs ) { - const Vector3& scrollPosition = scrollPositionProperty.GetVector3(); - const Vector3& scrollOffset = scrollOffsetProperty.GetVector3(); + const Vector3& scrollPosition = inputs[0]->GetVector3(); + const Vector3& scrollOffset = inputs[1]->GetVector3(); - return scrollPosition + scrollOffset; + current = scrollPosition + scrollOffset; } /** @@ -494,29 +489,26 @@ Vector3 InternalPositionDeltaConstraint(const Vector3& current, */ struct InternalFinalConstraint { - InternalFinalConstraint(AlphaFunction functionX, - AlphaFunction functionY) + InternalFinalConstraint(AlphaFunctionPrototype functionX, + AlphaFunctionPrototype functionY) : mFunctionX(functionX), mFunctionY(functionY) { } - Vector3 operator()(const Vector3& current, - const PropertyInput& scrollPositionProperty, - const PropertyInput& scrollOvershootXProperty, - const PropertyInput& scrollOvershootYProperty) + void operator()( Vector3& current, const PropertyInputContainer& inputs ) { - const float& overshootx = scrollOvershootXProperty.GetFloat(); - const float& overshooty = scrollOvershootYProperty.GetFloat(); + const float& overshootx = inputs[1]->GetFloat(); + const float& overshooty = inputs[2]->GetFloat(); Vector3 offset( mFunctionX(overshootx), mFunctionY(overshooty), 0.0f); - return scrollPositionProperty.GetVector3() - offset; + current = inputs[0]->GetVector3() - offset; } - AlphaFunction mFunctionX; - AlphaFunction mFunctionY; + AlphaFunctionPrototype mFunctionX; + AlphaFunctionPrototype mFunctionY; }; } @@ -542,7 +534,7 @@ Dali::Toolkit::ScrollView ScrollView::New() } ScrollView::ScrollView() -: ScrollBase(), +: ScrollBase( ControlBehaviour( REQUIRES_MOUSE_WHEEL_EVENTS ) ), // Enable size negotiation mTouchDownTime(0u), mGestureStackDepth(0), mScrollStateFlags(0), @@ -551,13 +543,13 @@ ScrollView::ScrollView() mMaxOvershoot(Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT, Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT), mUserMaxOvershoot(Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT, Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT), mSnapOvershootDuration(Toolkit::ScrollView::DEFAULT_SNAP_OVERSHOOT_DURATION), - mSnapOvershootAlphaFunction(AlphaFunctions::EaseOut), + mSnapOvershootAlphaFunction(AlphaFunction::EASE_OUT), mSnapDuration(Toolkit::ScrollView::DEFAULT_SLOW_SNAP_ANIMATION_DURATION), - mSnapAlphaFunction(AlphaFunctions::EaseOut), + mSnapAlphaFunction(AlphaFunction::EASE_OUT), mMinFlickDistance(DEFAULT_MIN_FLICK_DISTANCE), mFlickSpeedThreshold(DEFAULT_MIN_FLICK_SPEED_THRESHOLD), mFlickDuration(Toolkit::ScrollView::DEFAULT_FAST_SNAP_ANIMATION_DURATION), - mFlickAlphaFunction(AlphaFunctions::EaseOut), + mFlickAlphaFunction(AlphaFunction::EASE_OUT), mAxisAutoLockGradient(Toolkit::ScrollView::DEFAULT_AXIS_AUTO_LOCK_GRADIENT), mFrictionCoefficient(Toolkit::ScrollView::DEFAULT_FRICTION_COEFFICIENT), mFlickSpeedCoefficient(Toolkit::ScrollView::DEFAULT_FLICK_SPEED_COEFFICIENT), @@ -578,7 +570,6 @@ ScrollView::ScrollView() mCanScrollHorizontal(true), mCanScrollVertical(true) { - SetRequiresMouseWheelEvents(true); } void ScrollView::OnInitialize() @@ -590,15 +581,14 @@ void ScrollView::OnInitialize() mInternalActor = Actor::New(); mInternalActor.SetDrawMode(DrawMode::OVERLAY); self.Add(mInternalActor); - mInternalActor.ApplyConstraint( Constraint::New( Actor::Property::SIZE, ParentSource( Actor::Property::SIZE ), EqualToConstraint() ) ); + Constraint constraint = Constraint::New( mInternalActor, Actor::Property::SIZE, EqualToConstraint() ); + constraint.AddSource( ParentSource( Actor::Property::SIZE ) ); + constraint.Apply(); mInternalActor.SetParentOrigin(ParentOrigin::CENTER); mInternalActor.SetAnchorPoint(AnchorPoint::CENTER); mAlterChild = true; - // Register Scroll Properties. - RegisterProperties(); - mScrollPostPosition = mScrollPrePosition = Vector3::ZERO; mMouseWheelScrollDistanceStep = Stage::GetCurrent().GetSize() * DEFAULT_MOUSE_WHEEL_SCROLL_DISTANCE_STEP_PROPORTION; @@ -617,6 +607,9 @@ void ScrollView::OnInitialize() EnableScrollComponent(Toolkit::Scrollable::OvershootIndicator); + self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL, mCanScrollVertical); + self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL, mCanScrollHorizontal); + Vector3 size = GetControlSize(); UpdatePropertyDomain(size); SetInternalConstraints(); @@ -871,24 +864,24 @@ void ScrollView::UpdatePropertyDomain(const Vector3& size) if( mCanScrollVertical != canScrollVertical ) { mCanScrollVertical = canScrollVertical; - self.SetProperty(mPropertyCanScrollVertical, canScrollVertical); + self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL, canScrollVertical); } if( mCanScrollHorizontal != canScrollHorizontal ) { mCanScrollHorizontal = canScrollHorizontal; - self.SetProperty(mPropertyCanScrollHorizontal, canScrollHorizontal); + self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL, canScrollHorizontal); } if( scrollPositionChanged ) { - DALI_LOG_SCROLL_STATE("[0x%X] Domain Changed, setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); - self.SetProperty(mPropertyPrePosition, mScrollPrePosition); + DALI_LOG_SCROLL_STATE("[0x%X] Domain Changed, setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); + self.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollPrePosition); } if( domainChanged ) { mMinScroll = min; mMaxScroll = max; - self.SetProperty(mPropertyPositionMin, mMinScroll ); - self.SetProperty(mPropertyPositionMax, mMaxScroll ); + self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MIN, mMinScroll ); + self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX, mMaxScroll ); } } @@ -961,7 +954,7 @@ bool ScrollView::GetWrapMode() const void ScrollView::SetWrapMode(bool enable) { mWrapMode = enable; - Self().SetProperty(mPropertyWrap, enable); + Self().SetProperty(Toolkit::ScrollView::Property::WRAP, enable); } int ScrollView::GetScrollUpdateDistance() const @@ -1119,7 +1112,7 @@ void ScrollView::TransformTo(const Vector3& position, float duration, AlphaFunct this, position.x, position.y, duration, int(horizontalBias), int(verticalBias)); Vector3 currentScrollPosition = GetCurrentScrollPosition(); - self.SetProperty( mPropertyScrollStartPagePosition, currentScrollPosition ); + self.SetProperty( Toolkit::ScrollView::Property::START_PAGE_POSITION, currentScrollPosition ); if( mScrolling ) // are we interrupting a current scroll? { @@ -1134,15 +1127,15 @@ void ScrollView::TransformTo(const Vector3& position, float duration, AlphaFunct DALI_LOG_SCROLL_STATE("[0x%X] Interrupting Pan, set to false", this ); mPanning = false; mGestureStackDepth = 0; - self.SetProperty( mPropertyPanning, false ); + self.SetProperty( Toolkit::ScrollView::Property::PANNING, false ); if( mScrollMainInternalPrePositionConstraint ) { - self.RemoveConstraint(mScrollMainInternalPrePositionConstraint); + mScrollMainInternalPrePositionConstraint.Remove(); } } - self.SetProperty(mPropertyScrolling, true); + self.SetProperty(Toolkit::ScrollView::Property::SCROLLING, true); mScrolling = true; DALI_LOG_SCROLL_STATE("[0x%X] mScrollStartedSignal 1 [%.2f, %.2f]", this, currentScrollPosition.x, currentScrollPosition.y); @@ -1158,7 +1151,7 @@ void ScrollView::TransformTo(const Vector3& position, float duration, AlphaFunct if(!animating) { // if not animating, then this pan has completed right now. - self.SetProperty(mPropertyScrolling, false); + self.SetProperty(Toolkit::ScrollView::Property::SCROLLING, false); mScrolling = false; // If we have no duration, then in the next update frame, we will be at the position specified as we just set. @@ -1450,7 +1443,7 @@ bool ScrollView::SnapWithVelocity(Vector2 velocity) if(child) { - Vector3 position = Self().GetProperty(mPropertyPosition); + Vector3 position = Self().GetProperty(Toolkit::ScrollView::Property::SCROLL_POSITION); // Get center-point of the Actor. Vector3 childPosition = GetPositionOfAnchor(child, AnchorPoint::CENTER); @@ -1639,15 +1632,15 @@ bool ScrollView::AnimateTo(const Vector3& position, const Vector3& positionDurat if( !(mScrollStateFlags & SCROLL_ANIMATION_FLAGS) ) { - DALI_LOG_SCROLL_STATE("[0x%X] Setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollTargetPosition.x, mScrollTargetPosition.y ); - self.SetProperty(mPropertyPrePosition, mScrollTargetPosition); + DALI_LOG_SCROLL_STATE("[0x%X] Setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollTargetPosition.x, mScrollTargetPosition.y ); + self.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollTargetPosition); mScrollPrePosition = mScrollTargetPosition; mScrollPostPosition = mScrollTargetPosition; WrapPosition(mScrollPostPosition); } DALI_LOG_SCROLL_STATE("[0x%X] position-changed, mScrollTargetPosition[%.2f, %.2f], mScrollPrePosition[%.2f, %.2f], mScrollPostPosition[%.2f, %.2f]", this, mScrollTargetPosition.x, mScrollTargetPosition.y, mScrollPrePosition.x, mScrollPrePosition.y, mScrollPostPosition.x, mScrollPostPosition.y ); - DALI_LOG_SCROLL_STATE("[0x%X] mPropertyPrePosition[%.2f, %.2f], mPropertyPosition[%.2f, %.2f]", this, self.GetProperty( mPropertyPrePosition ).Get().x, self.GetProperty( mPropertyPrePosition ).Get().y, self.GetProperty( mPropertyPosition ).Get().x, self.GetProperty( mPropertyPosition ).Get().y ); + DALI_LOG_SCROLL_STATE("[0x%X] SCROLL_PRE_POSITION[%.2f, %.2f], SCROLL_POSITION[%.2f, %.2f]", this, self.GetProperty( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ).Get().x, self.GetProperty( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ).Get().y, self.GetProperty( Toolkit::ScrollView::Property::SCROLL_POSITION ).Get().x, self.GetProperty( Toolkit::ScrollView::Property::SCROLL_POSITION ).Get().y ); } SetScrollUpdateNotification(true); @@ -1728,14 +1721,14 @@ void ScrollView::FindAndUnbindActor(Actor child) Vector3 ScrollView::GetPropertyPrePosition() const { - Vector3 position = Self().GetProperty(mPropertyPrePosition); + Vector3 position = Self().GetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION); WrapPosition(position); return position; } Vector3 ScrollView::GetPropertyPosition() const { - Vector3 position = Self().GetProperty(mPropertyPosition); + Vector3 position = Self().GetProperty(Toolkit::ScrollView::Property::SCROLL_POSITION); WrapPosition(position); return position; @@ -1751,21 +1744,21 @@ void ScrollView::HandleSnapAnimationFinished() // Emit Signal that scrolling has completed. mScrolling = false; Actor self = Self(); - self.SetProperty(mPropertyScrolling, false); + self.SetProperty(Toolkit::ScrollView::Property::SCROLLING, false); Vector3 deltaPosition(mScrollPrePosition); UpdateLocalScrollProperties(); WrapPosition(mScrollPrePosition); - DALI_LOG_SCROLL_STATE("[0x%X] Setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); - self.SetProperty(mPropertyPrePosition, mScrollPrePosition); + DALI_LOG_SCROLL_STATE("[0x%X] Setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); + self.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollPrePosition); Vector3 currentScrollPosition = GetCurrentScrollPosition(); DALI_LOG_SCROLL_STATE("[0x%X] mScrollCompletedSignal 3 current[%.2f, %.2f], mScrollTargetPosition[%.2f, %.2f]", this, currentScrollPosition.x, currentScrollPosition.y, -mScrollTargetPosition.x, -mScrollTargetPosition.y ); mScrollCompletedSignal.Emit( currentScrollPosition ); mDomainOffset += deltaPosition - mScrollPostPosition; - self.SetProperty(mPropertyDomainOffset, mDomainOffset); + self.SetProperty(Toolkit::ScrollView::Property::SCROLL_DOMAIN_OFFSET, mDomainOffset); HandleStoppedAnimation(); } @@ -1782,7 +1775,7 @@ void ScrollView::SetScrollUpdateNotification( bool enabled ) if( enabled && !mScrollUpdatedSignal.Empty()) { // Only set up the notification when the application has connected to the updated signal - mScrollXUpdateNotification = self.AddPropertyNotification(mPropertyPosition, 0, StepCondition(mScrollUpdateDistance, 0.0f)); + mScrollXUpdateNotification = self.AddPropertyNotification(Toolkit::ScrollView::Property::SCROLL_POSITION, 0, StepCondition(mScrollUpdateDistance, 0.0f)); mScrollXUpdateNotification.NotifySignal().Connect( this, &ScrollView::OnScrollUpdateNotification ); } if( mScrollYUpdateNotification ) @@ -1795,7 +1788,7 @@ void ScrollView::SetScrollUpdateNotification( bool enabled ) if( enabled && !mScrollUpdatedSignal.Empty()) { // Only set up the notification when the application has connected to the updated signal - mScrollYUpdateNotification = self.AddPropertyNotification(mPropertyPosition, 1, StepCondition(mScrollUpdateDistance, 0.0f)); + mScrollYUpdateNotification = self.AddPropertyNotification(Toolkit::ScrollView::Property::SCROLL_POSITION, 1, StepCondition(mScrollUpdateDistance, 0.0f)); mScrollYUpdateNotification.NotifySignal().Connect( this, &ScrollView::OnScrollUpdateNotification ); } } @@ -1869,16 +1862,6 @@ void ScrollView::OnChildRemove(Actor& child) UnbindActor(child); } -void ScrollView::OnPropertySet( Property::Index index, Property::Value propertyValue ) -{ - Actor self = Self(); - if( index == mPropertyPrePosition ) - { - DALI_LOG_SCROLL_STATE("[0x%X]: mPropertyPrePosition[%.2f, %.2f]", this, propertyValue.Get().x, propertyValue.Get().y); - propertyValue.Get(mScrollPrePosition); - } -} - void ScrollView::StartTouchDownTimer() { if ( !mTouchDownTimer ) @@ -1917,7 +1900,7 @@ bool ScrollView::OnTouchDownTimeout() mScrollInterrupted = true; // reset domain offset as scrolling from original plane. mDomainOffset = Vector3::ZERO; - Self().SetProperty(mPropertyDomainOffset, Vector3::ZERO); + Self().SetProperty(Toolkit::ScrollView::Property::SCROLL_DOMAIN_OFFSET, Vector3::ZERO); UpdateLocalScrollProperties(); Vector3 currentScrollPosition = GetCurrentScrollPosition(); @@ -2047,32 +2030,32 @@ bool ScrollView::OnMouseWheelEvent(const MouseWheelEvent& event) void ScrollView::ResetScrolling() { Actor self = Self(); - self.GetProperty(mPropertyPosition).Get(mScrollPostPosition); + self.GetProperty(Toolkit::ScrollView::Property::SCROLL_POSITION).Get(mScrollPostPosition); mScrollPrePosition = mScrollPostPosition; - DALI_LOG_SCROLL_STATE("[0x%X] Setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollPostPosition.x, mScrollPostPosition.y ); - self.SetProperty(mPropertyPrePosition, mScrollPostPosition); + DALI_LOG_SCROLL_STATE("[0x%X] Setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollPostPosition.x, mScrollPostPosition.y ); + self.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollPostPosition); } void ScrollView::UpdateLocalScrollProperties() { Actor self = Self(); - self.GetProperty(mPropertyPrePosition).Get(mScrollPrePosition); - self.GetProperty(mPropertyPosition).Get(mScrollPostPosition); + self.GetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION).Get(mScrollPrePosition); + self.GetProperty(Toolkit::ScrollView::Property::SCROLL_POSITION).Get(mScrollPostPosition); } // private functions void ScrollView::PreAnimatedScrollSetup() { - // mPropertyPrePosition is our unclamped property with wrapping - // mPropertyPosition is our final scroll position after clamping + // SCROLL_PRE_POSITION is our unclamped property with wrapping + // SCROLL_POSITION is our final scroll position after clamping Actor self = Self(); Vector3 deltaPosition(mScrollPostPosition); WrapPosition(mScrollPostPosition); mDomainOffset += deltaPosition - mScrollPostPosition; - Self().SetProperty(mPropertyDomainOffset, mDomainOffset); + Self().SetProperty(Toolkit::ScrollView::Property::SCROLL_DOMAIN_OFFSET, mDomainOffset); if( mScrollStateFlags & SCROLL_X_STATE_MASK ) { @@ -2103,11 +2086,11 @@ void ScrollView::AnimateInternalXTo( float position, float duration, AlphaFuncti if( duration > Math::MACHINE_EPSILON_10 ) { Actor self = Self(); - DALI_LOG_SCROLL_STATE("[0x%X], Animating from[%.2f] to[%.2f]", this, self.GetProperty(mPropertyPrePosition).Get().x, position ); + DALI_LOG_SCROLL_STATE("[0x%X], Animating from[%.2f] to[%.2f]", this, self.GetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION).Get().x, position ); mInternalXAnimation = Animation::New(duration); DALI_LOG_SCROLL_STATE("[0x%X], mInternalXAnimation[0x%X]", this, mInternalXAnimation.GetObjectPtr() ); mInternalXAnimation.FinishedSignal().Connect(this, &ScrollView::OnScrollAnimationFinished); - mInternalXAnimation.AnimateTo( Property(self, mPropertyPrePosition, 0), position, alpha, duration); + mInternalXAnimation.AnimateTo( Property(self, Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, 0), position, alpha, TimePeriod(duration)); mInternalXAnimation.Play(); // erase current state flags @@ -2124,11 +2107,11 @@ void ScrollView::AnimateInternalYTo( float position, float duration, AlphaFuncti if( duration > Math::MACHINE_EPSILON_10 ) { Actor self = Self(); - DALI_LOG_SCROLL_STATE("[0x%X], Animating from[%.2f] to[%.2f]", this, self.GetProperty(mPropertyPrePosition).Get().y, position ); + DALI_LOG_SCROLL_STATE("[0x%X], Animating from[%.2f] to[%.2f]", this, self.GetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION).Get().y, position ); mInternalYAnimation = Animation::New(duration); DALI_LOG_SCROLL_STATE("[0x%X], mInternalYAnimation[0x%X]", this, mInternalYAnimation.GetObjectPtr() ); mInternalYAnimation.FinishedSignal().Connect(this, &ScrollView::OnScrollAnimationFinished); - mInternalYAnimation.AnimateTo( Property(self, mPropertyPrePosition, 1), position, alpha, TimePeriod(duration)); + mInternalYAnimation.AnimateTo( Property(self, Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, 1), position, alpha, TimePeriod(duration)); mInternalYAnimation.Play(); // erase current state flags @@ -2151,7 +2134,7 @@ void ScrollView::OnScrollAnimationFinished( Animation& source ) if( source == mInternalXAnimation ) { - DALI_LOG_SCROLL_STATE("[0x%X] mInternalXAnimation[0x%X], expected[%.2f], actual[%.2f], post[%.2f]", this, mInternalXAnimation.GetObjectPtr(), mScrollTargetPosition.x, Self().GetProperty(mPropertyPrePosition).Get().x, mScrollPostPosition.x ); + DALI_LOG_SCROLL_STATE("[0x%X] mInternalXAnimation[0x%X], expected[%.2f], actual[%.2f], post[%.2f]", this, mInternalXAnimation.GetObjectPtr(), mScrollTargetPosition.x, Self().GetProperty(SCROLL_PRE_POSITION).Get().x, mScrollPostPosition.x ); if( !(mScrollStateFlags & AnimatingInternalY) ) { @@ -2163,15 +2146,15 @@ void ScrollView::OnScrollAnimationFinished( Animation& source ) { const RulerDomain rulerDomain = mRulerX->GetDomain(); mScrollPrePosition.x = -WrapInDomain(-mScrollPrePosition.x, rulerDomain.min, rulerDomain.max); - DALI_LOG_SCROLL_STATE("[0x%X] Setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); - handle.SetProperty(mPropertyPrePosition, mScrollPrePosition); + DALI_LOG_SCROLL_STATE("[0x%X] Setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); + handle.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollPrePosition); } SnapInternalXTo(mScrollPostPosition.x); } if( source == mInternalYAnimation ) { - DALI_LOG_SCROLL_STATE("[0x%X] mInternalYAnimation[0x%X], expected[%.2f], actual[%.2f], post[%.2f]", this, mInternalYAnimation.GetObjectPtr(), mScrollTargetPosition.y, Self().GetProperty(mPropertyPrePosition).Get().y, mScrollPostPosition.y ); + DALI_LOG_SCROLL_STATE("[0x%X] mInternalYAnimation[0x%X], expected[%.2f], actual[%.2f], post[%.2f]", this, mInternalYAnimation.GetObjectPtr(), mScrollTargetPosition.y, Self().GetProperty(SCROLL_PRE_POSITION).Get().y, mScrollPostPosition.y ); if( !(mScrollStateFlags & AnimatingInternalX) ) { @@ -2183,8 +2166,8 @@ void ScrollView::OnScrollAnimationFinished( Animation& source ) // wrap pre scroll y position and set it const RulerDomain rulerDomain = mRulerY->GetDomain(); mScrollPrePosition.y = -WrapInDomain(-mScrollPrePosition.y, rulerDomain.min, rulerDomain.max); - DALI_LOG_SCROLL_STATE("[0x%X] Setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); - handle.SetProperty(mPropertyPrePosition, mScrollPrePosition); + DALI_LOG_SCROLL_STATE("[0x%X] Setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); + handle.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollPrePosition); } SnapInternalYTo(mScrollPostPosition.y); } @@ -2238,7 +2221,7 @@ void ScrollView::SnapInternalXTo(float position) mInternalXAnimation = Animation::New(duration); mInternalXAnimation.FinishedSignal().Connect(this, &ScrollView::OnSnapInternalPositionFinished); - mInternalXAnimation.AnimateTo(Property(self, mPropertyPrePosition, 0), position); + mInternalXAnimation.AnimateTo(Property(self, Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, 0), position); mInternalXAnimation.Play(); // add internal animation state flag @@ -2264,7 +2247,7 @@ void ScrollView::SnapInternalYTo(float position) mInternalYAnimation = Animation::New(duration); mInternalYAnimation.FinishedSignal().Connect(this, &ScrollView::OnSnapInternalPositionFinished); - mInternalYAnimation.AnimateTo(Property(self, mPropertyPrePosition, 1), position); + mInternalYAnimation.AnimateTo(Property(self, Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, 1), position); mInternalYAnimation.Play(); // add internal animation state flag @@ -2357,8 +2340,8 @@ void ScrollView::OnPan( const PanGesture& gesture ) UpdateLocalScrollProperties(); GestureStarted(); mPanning = true; - self.SetProperty( mPropertyPanning, true ); - self.SetProperty( mPropertyScrollStartPagePosition, Vector3(gesture.position.x, gesture.position.y, 0.0f) ); + self.SetProperty( Toolkit::ScrollView::Property::PANNING, true ); + self.SetProperty( Toolkit::ScrollView::Property::START_PAGE_POSITION, Vector3(gesture.position.x, gesture.position.y, 0.0f) ); UpdateMainInternalConstraint(); break; @@ -2389,11 +2372,11 @@ void ScrollView::OnPan( const PanGesture& gesture ) UpdateLocalScrollProperties(); mLastVelocity = gesture.velocity; mPanning = false; - self.SetProperty( mPropertyPanning, false ); + self.SetProperty( Toolkit::ScrollView::Property::PANNING, false ); if( mScrollMainInternalPrePositionConstraint ) { - self.RemoveConstraint(mScrollMainInternalPrePositionConstraint); + mScrollMainInternalPrePositionConstraint.Remove(); } if( mOvershootIndicator ) @@ -2428,7 +2411,7 @@ void ScrollView::OnGestureEx(Gesture::State state) if(state == Gesture::Started) { Vector3 currentScrollPosition = GetCurrentScrollPosition(); - Self().SetProperty(mPropertyScrolling, true); + Self().SetProperty(Toolkit::ScrollView::Property::SCROLLING, true); mScrolling = true; DALI_LOG_SCROLL_STATE("[0x%X] mScrollStartedSignal 2 [%.2f, %.2f]", this, currentScrollPosition.x, currentScrollPosition.y); mScrollStartedSignal.Emit( currentScrollPosition ); @@ -2474,7 +2457,7 @@ void ScrollView::FinishTransform() // if not animating, then this pan has completed right now. SetScrollUpdateNotification(false); mScrolling = false; - Self().SetProperty(mPropertyScrolling, false); + Self().SetProperty(Toolkit::ScrollView::Property::SCROLLING, false); if( fabs(mScrollPrePosition.x - mScrollTargetPosition.x) > Math::MACHINE_EPSILON_10 ) { @@ -2583,14 +2566,14 @@ void ScrollView::UpdateMainInternalConstraint() if(mScrollMainInternalPositionConstraint) { - self.RemoveConstraint(mScrollMainInternalPositionConstraint); - self.RemoveConstraint(mScrollMainInternalDeltaConstraint); - self.RemoveConstraint(mScrollMainInternalFinalConstraint); - self.RemoveConstraint(mScrollMainInternalRelativeConstraint); + mScrollMainInternalPositionConstraint.Remove(); + mScrollMainInternalDeltaConstraint.Remove(); + mScrollMainInternalFinalConstraint.Remove(); + mScrollMainInternalRelativeConstraint.Remove(); } if( mScrollMainInternalPrePositionConstraint ) { - self.RemoveConstraint(mScrollMainInternalPrePositionConstraint); + mScrollMainInternalPrePositionConstraint.Remove(); } // TODO: It's probably better to use a local displacement value as this will give a displacement when scrolling just commences @@ -2607,48 +2590,55 @@ void ScrollView::UpdateMainInternalConstraint() { initialPanMask.x = 0.0f; } - Constraint constraint; if( mPanning ) { - constraint = Constraint::New( mPropertyPrePosition, - Source( detector, PanGestureDetector::Property::LOCAL_POSITION ), - Source( self, Actor::Property::SIZE ), - InternalPrePositionConstraint( mPanStartPosition, initialPanMask, mAxisAutoLock, mAxisAutoLockGradient, mLockAxis, mMaxOvershoot, mRulerX->GetDomain(), mRulerY->GetDomain() ) ); - mScrollMainInternalPrePositionConstraint = self.ApplyConstraint( constraint ); + mScrollMainInternalPrePositionConstraint = Constraint::New( self, + Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, + InternalPrePositionConstraint( mPanStartPosition, + initialPanMask, + mAxisAutoLock, + mAxisAutoLockGradient, + mLockAxis, + mMaxOvershoot, + mRulerX->GetDomain(), + mRulerY->GetDomain() ) ); + mScrollMainInternalPrePositionConstraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) ); + mScrollMainInternalPrePositionConstraint.AddSource( Source( self, Actor::Property::SIZE ) ); + mScrollMainInternalPrePositionConstraint.Apply(); } // 2. Second calculate the clamped position (actual position) - constraint = Constraint::New( mPropertyPosition, - LocalSource( mPropertyPrePosition ), - LocalSource( mPropertyPositionMin ), - LocalSource( mPropertyPositionMax ), - Source( self, Actor::Property::SIZE ), - InternalPositionConstraint( mRulerX->GetDomain(), - mRulerY->GetDomain(), mWrapMode ) ); - mScrollMainInternalPositionConstraint = self.ApplyConstraint( constraint ); - - constraint = Constraint::New( mPropertyPositionDelta, - LocalSource( mPropertyPosition ), - LocalSource( mPropertyDomainOffset ), - InternalPositionDeltaConstraint ); - mScrollMainInternalDeltaConstraint = self.ApplyConstraint( constraint ); - - constraint = Constraint::New( mPropertyFinal, - LocalSource( mPropertyPosition ), - LocalSource( mPropertyOvershootX ), - LocalSource( mPropertyOvershootY ), - InternalFinalConstraint( FinalDefaultAlphaFunction, - FinalDefaultAlphaFunction ) ); - mScrollMainInternalFinalConstraint = self.ApplyConstraint( constraint ); - - constraint = Constraint::New( mPropertyRelativePosition, - LocalSource( mPropertyPosition ), - LocalSource( mPropertyPositionMin ), - LocalSource( mPropertyPositionMax ), - LocalSource( Actor::Property::SIZE ), - InternalRelativePositionConstraint ); - mScrollMainInternalRelativeConstraint = self.ApplyConstraint( constraint ); + mScrollMainInternalPositionConstraint = Constraint::New( self, + Toolkit::ScrollView::Property::SCROLL_POSITION, + InternalPositionConstraint( mRulerX->GetDomain(), + mRulerY->GetDomain(), + mWrapMode ) ); + mScrollMainInternalPositionConstraint.AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ) ); + mScrollMainInternalPositionConstraint.AddSource( LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) ); + mScrollMainInternalPositionConstraint.AddSource( LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) ); + mScrollMainInternalPositionConstraint.AddSource( Source( self, Actor::Property::SIZE ) ); + mScrollMainInternalPositionConstraint.Apply(); + + mScrollMainInternalDeltaConstraint = Constraint::New( self, Toolkit::ScrollView::Property::SCROLL_POSITION_DELTA, InternalPositionDeltaConstraint ); + mScrollMainInternalDeltaConstraint.AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ) ); + mScrollMainInternalDeltaConstraint.AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_DOMAIN_OFFSET ) ); + mScrollMainInternalDeltaConstraint.Apply(); + + mScrollMainInternalFinalConstraint = Constraint::New( self, Toolkit::ScrollView::Property::SCROLL_FINAL, + InternalFinalConstraint( FinalDefaultAlphaFunction, + FinalDefaultAlphaFunction ) ); + mScrollMainInternalFinalConstraint .AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ) ); + mScrollMainInternalFinalConstraint .AddSource( LocalSource( Toolkit::ScrollView::Property::OVERSHOOT_X ) ); + mScrollMainInternalFinalConstraint .AddSource( LocalSource( Toolkit::ScrollView::Property::OVERSHOOT_Y ) ); + mScrollMainInternalFinalConstraint.Apply(); + + mScrollMainInternalRelativeConstraint = Constraint::New( self, Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION, InternalRelativePositionConstraint ); + mScrollMainInternalRelativeConstraint.AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ) ); + mScrollMainInternalRelativeConstraint.AddSource( LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) ); + mScrollMainInternalRelativeConstraint.AddSource( LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) ); + mScrollMainInternalRelativeConstraint.AddSource( LocalSource( Actor::Property::SIZE ) ); + mScrollMainInternalRelativeConstraint.Apply(); // When panning we want to make sure overshoot values are affected by pre position and post position SetOvershootConstraintsEnabled(!mWrapMode); @@ -2660,31 +2650,29 @@ void ScrollView::SetOvershootConstraintsEnabled(bool enabled) // remove and reset, it may now be in wrong order with the main internal constraints if( mScrollMainInternalOvershootXConstraint ) { - self.RemoveConstraint(mScrollMainInternalOvershootXConstraint); + mScrollMainInternalOvershootXConstraint.Remove(); mScrollMainInternalOvershootXConstraint.Reset(); - self.RemoveConstraint(mScrollMainInternalOvershootYConstraint); + mScrollMainInternalOvershootYConstraint.Remove(); mScrollMainInternalOvershootYConstraint.Reset(); } if( enabled ) { - Constraint constraint = Constraint::New( mPropertyOvershootX, - LocalSource( mPropertyPrePosition ), - LocalSource( mPropertyPosition ), - LocalSource( mPropertyCanScrollHorizontal ), - OvershootXConstraint(mMaxOvershoot.x) ); - mScrollMainInternalOvershootXConstraint = self.ApplyConstraint( constraint ); + mScrollMainInternalOvershootXConstraint= Constraint::New( self, Toolkit::ScrollView::Property::OVERSHOOT_X, OvershootXConstraint(mMaxOvershoot.x) ); + mScrollMainInternalOvershootXConstraint.AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ) ); + mScrollMainInternalOvershootXConstraint.AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ) ); + mScrollMainInternalOvershootXConstraint.AddSource( LocalSource( Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL ) ); + mScrollMainInternalOvershootXConstraint.Apply(); - constraint = Constraint::New( mPropertyOvershootY, - LocalSource( mPropertyPrePosition ), - LocalSource( mPropertyPosition ), - LocalSource( mPropertyCanScrollVertical ), - OvershootYConstraint(mMaxOvershoot.y) ); - mScrollMainInternalOvershootYConstraint = self.ApplyConstraint( constraint ); + mScrollMainInternalOvershootYConstraint = Constraint::New( self, Toolkit::ScrollView::Property::OVERSHOOT_Y, OvershootYConstraint(mMaxOvershoot.y) ); + mScrollMainInternalOvershootYConstraint.AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ) ); + mScrollMainInternalOvershootYConstraint.AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ) ); + mScrollMainInternalOvershootYConstraint.AddSource( LocalSource( Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL ) ); + mScrollMainInternalOvershootYConstraint.Apply(); } else { - self.SetProperty(mPropertyOvershootX, 0.0f); - self.SetProperty(mPropertyOvershootY, 0.0f); + self.SetProperty(Toolkit::ScrollView::Property::OVERSHOOT_X, 0.0f); + self.SetProperty(Toolkit::ScrollView::Property::OVERSHOOT_Y, 0.0f); } } @@ -2702,21 +2690,19 @@ void ScrollView::SetInternalConstraints() Constraint constraint; // MoveActor (scrolling) - constraint = Constraint::New( Actor::Property::POSITION, - Source( self, mPropertyPosition ), - MoveActorConstraint ); + constraint = Constraint::New( self, Actor::Property::POSITION, MoveActorConstraint ); + constraint.AddSource( Source( self, Toolkit::ScrollView::Property::SCROLL_POSITION ) ); constraint.SetRemoveAction(Constraint::Discard); ApplyConstraintToBoundActors(constraint); // WrapActor (wrap functionality) - constraint = Constraint::New( Actor::Property::POSITION, - LocalSource( Actor::Property::SCALE ), - LocalSource( Actor::Property::ANCHOR_POINT ), - LocalSource( Actor::Property::SIZE ), - Source( self, mPropertyPositionMin ), - Source( self, mPropertyPositionMax ), - Source( self, mPropertyWrap ), - WrapActorConstraint ); + constraint = Constraint::New( self, Actor::Property::POSITION, WrapActorConstraint ); + constraint.AddSource( LocalSource( Actor::Property::SCALE ) ); + constraint.AddSource( LocalSource( Actor::Property::ANCHOR_POINT ) ); + constraint.AddSource( LocalSource( Actor::Property::SIZE ) ); + constraint.AddSource( Source( self, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) ); + constraint.AddSource( Source( self, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) ); + constraint.AddSource( Source( self, Toolkit::ScrollView::Property::WRAP ) ); constraint.SetRemoveAction(Constraint::Discard); ApplyConstraintToBoundActors(constraint); }