From: Kimmo Hoikka Date: Mon, 2 Feb 2015 18:15:24 +0000 (+0000) Subject: Remove dead slide effect code and incorrect ref-objects from scroll effects X-Git-Tag: accepted/tizen/common/20150205.080848^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_3.0.2014.q4_common;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git Remove dead slide effect code and incorrect ref-objects from scroll effects Change-Id: I65568f41211f4810c407118dffe74db6a7877888 --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp index 8e9224c..b7a08fd 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp @@ -267,27 +267,6 @@ int UtcDaliScrollViewSpiralEffectSetup(void) END_TEST; } - - - -int UtcDaliScrollViewSlideEffectSetup(void) -{ - tet_infoline(" UtcDaliScrollViewSlideEffectSetup"); - - ScrollViewSlideEffect effect; - - DALI_TEST_CHECK( !effect ); - - BaseHandle handle = ScrollViewSlideEffect::New(); - - DALI_TEST_CHECK( handle ); - - effect = ScrollViewSlideEffect::DownCast(handle); - - DALI_TEST_CHECK( effect ); - END_TEST; -} - int UtcDaliScrollViewCubeEffectTest(void) { ToolkitTestApplication application; @@ -360,45 +339,3 @@ int UtcDaliScrollViewSpiralEffectTest(void) END_TEST; } - - -int UtcDaliScrollViewSlideEffectTest(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliScrollViewSlideEffectTest"); - - Vector2 size = Stage::GetCurrent().GetSize(); - Vector3 pageSize(size.x, size.y, 0.0f); - - ScrollView scrollView = SetupTestScrollView(1, 3, size); - Actor testPage = gPages[1]; - Wait(application, 500); - - ScrollViewSlideEffect effect = ScrollViewSlideEffect::New(); - effect.SetDelayReferenceOffset(pageSize * 0.25); - DALI_TEST_EQUALS(effect.GetDelayReferenceOffset(), pageSize * 0.25, Math::MACHINE_EPSILON_0, TEST_LOCATION); - effect.SetMaxDelayDuration(0.5f); - DALI_TEST_EQUALS(effect.GetMaxDelayDuration(), 0.5f, Math::MACHINE_EPSILON_0, TEST_LOCATION); - effect.SetSlideDirection(false); - DALI_TEST_CHECK(!effect.GetSlideDirection()); - - scrollView.ApplyEffect(effect); - - Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3); - Wait(application); - Vector3 actorPrePosition = actor.GetCurrentPosition(); - - effect.ApplyToActor(actor, 0.0f, 0.5f); - - scrollView.ScrollTo(1); - while(!gOnScrollCompleteCalled) - { - Wait(application); - } - // test that the first page has reached centre of screen - Vector3 actorPostPosition = actor.GetCurrentPosition(); - // just check the actor has moved - DALI_TEST_CHECK((actorPostPosition - actorPrePosition).Length() > Math::MACHINE_EPSILON_1); - CleanupTest(); - END_TEST; -} diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp index 87e9a58..fd352cb 100644 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp +++ b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp @@ -63,7 +63,7 @@ Property::Index SafeRegisterProperty( Handle& handle, const std::string& name, P * move the Actor's edge visually away from the neighboring actor, as they rotate * around their default anchor point. */ -class ScrollCarouselEffectInfo : public Dali::RefObject +class ScrollCarouselEffectInfo { public: @@ -212,8 +212,6 @@ public: Vector2 mVisibilityThreshold; ///< Threshold for when to to switch off visibility of Actor (for performance) }; -typedef IntrusivePtr ScrollCarouselEffectInfoPtr; - /** * Helper: Applies the 3D scroll carousel constraints to the child actor * @@ -223,7 +221,7 @@ typedef IntrusivePtr ScrollCarouselEffectInfoPtr; */ void ApplyScrollCarouselConstraints(Toolkit::ScrollView scrollView, Actor child, - ScrollCarouselEffectInfoPtr info) + ScrollCarouselEffectInfo& info) { // Apply constraints to this actor // Constraint constraint; @@ -284,7 +282,7 @@ ScrollViewCarouselEffect::~ScrollViewCarouselEffect() void ScrollViewCarouselEffect::ApplyToActor(Actor child, const Vector2& angleSwing) { - ScrollCarouselEffectInfoPtr info(new ScrollCarouselEffectInfo(angleSwing)); + ScrollCarouselEffectInfo info( angleSwing ); ApplyScrollCarouselConstraints( GetScrollView(), child, info ); } diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp index 65fdd5f..d2803f1 100644 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp +++ b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp @@ -44,7 +44,7 @@ namespace // unnamed namespace * When at middle of the screen the position is not altered. * When one screen away from middle the position is rotated about it's origin + mAnchor */ -class ScrollCubeEffectInfo : public Dali::RefObject +class ScrollCubeEffectInfo { public: @@ -285,8 +285,6 @@ public: Vector3 mPositionSwing; ///< Maximum amount in X and Y axes to alter position. }; -typedef IntrusivePtr ScrollCubeEffectInfoPtr; - /** * Helper: Applies the 3D scroll cube constraints to the child actor * @@ -297,7 +295,7 @@ typedef IntrusivePtr ScrollCubeEffectInfoPtr; void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, Actor child, Actor parentPage, - ScrollCubeEffectInfoPtr info) + const ScrollCubeEffectInfo& info) { // Apply constraints to this actor // Constraint constraint; @@ -363,7 +361,7 @@ void ScrollViewCubeEffect::ApplyToActor(Actor child, const Vector2& angleSwing, const Vector2& positionSwing) { - ScrollCubeEffectInfoPtr info(new ScrollCubeEffectInfo(anchor, angleSwing, positionSwing)); + ScrollCubeEffectInfo info( anchor, angleSwing, positionSwing ); ApplyScrollCubeConstraints( GetScrollView(), child, child.GetParent(), info ); } @@ -374,7 +372,7 @@ void ScrollViewCubeEffect::ApplyToActor(Actor child, const Vector2& angleSwing, const Vector2& positionSwing) { - ScrollCubeEffectInfoPtr info(new ScrollCubeEffectInfo(anchor, angleSwing, positionSwing)); + ScrollCubeEffectInfo info( anchor, angleSwing, positionSwing ); ApplyScrollCubeConstraints( GetScrollView(), child, parentPage, info ); } diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.cpp index 47406ab..93d41df 100644 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.cpp +++ b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.cpp @@ -53,7 +53,7 @@ using namespace ScrollViewHelperFunctions; * When at middle of the screen the position is not altered. * When one screen away from middle the position is rotated as per expected in a 3D carousel. */ -class ScrollPageCarouselEffectInfo : public Dali::RefObject +class ScrollPageCarouselEffectInfo { public: @@ -174,8 +174,6 @@ public: const Vector2 mPositionToPageSizeRatio; ///< The page will move its position according to this ratio. }; -typedef IntrusivePtr ScrollPageCarouselEffectInfoPtr; - /** * Helper: Applies the 3D scroll cube constraints to the child actor * @@ -185,7 +183,7 @@ typedef IntrusivePtr ScrollPageCarouselEffectInfoP */ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, Actor child, - ScrollPageCarouselEffectInfoPtr info) + ScrollPageCarouselEffectInfo& info) { // Apply constraints to this actor // Constraint constraint; @@ -227,7 +225,7 @@ ScrollViewPageCarouselEffect::~ScrollViewPageCarouselEffect() void ScrollViewPageCarouselEffect::ApplyToPage( Actor page, const Vector2& positionToPageSizeRatio ) { - ScrollPageCarouselEffectInfoPtr info(new ScrollPageCarouselEffectInfo( positionToPageSizeRatio ) ); + ScrollPageCarouselEffectInfo info( positionToPageSizeRatio ); ApplyScrollCubeConstraints( GetScrollView(), page, info ); } diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp index 4ad55fb..24a0a92 100644 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp +++ b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp @@ -56,7 +56,7 @@ using namespace ScrollViewHelperFunctions; * When at middle of the screen the position is not altered. * When one screen away from middle the position is rotated as per expected in a 3D inner cube. */ -class ScrollPageCubeEffectInfo : public Dali::RefObject +class ScrollPageCubeEffectInfo { public: @@ -243,8 +243,6 @@ public: Vector2 mAngleSwing; ///< Maximum amount in X and Y axes to rotate. }; -typedef IntrusivePtr ScrollPageCubeEffectInfoPtr; - /** * Helper: Applies the 3D scroll cube constraints to the child actor * @@ -254,7 +252,7 @@ typedef IntrusivePtr ScrollPageCubeEffectInfoPtr; */ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, Actor child, - ScrollPageCubeEffectInfoPtr info) + ScrollPageCubeEffectInfo& info) { // Apply constraints to this actor // Constraint constraint; @@ -308,7 +306,7 @@ ScrollViewPageCubeEffect::~ScrollViewPageCubeEffect() void ScrollViewPageCubeEffect::ApplyToPage( Actor page, const Vector2& angleSwing ) { - ScrollPageCubeEffectInfoPtr info(new ScrollPageCubeEffectInfo( angleSwing )); + ScrollPageCubeEffectInfo info( angleSwing ); ApplyScrollCubeConstraints( GetScrollView(), page, info ); } diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp index 61c51ef..3b89b08 100644 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp +++ b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp @@ -69,7 +69,7 @@ using namespace ScrollViewHelperFunctions; * relative to the middle of the screen. * When at middle of the screen the position is not altered. */ -class ScrollPageSpiralEffectInfo : public Dali::RefObject +class ScrollPageSpiralEffectInfo { public: @@ -336,8 +336,6 @@ public: bool mScrollWrap; ///< Whether the scroll view wraps or not. }; -typedef IntrusivePtr ScrollPageSpiralEffectInfoPtr; - /** * Helper: Applies the 3D scroll cube constraints to the child actor * @@ -347,7 +345,7 @@ typedef IntrusivePtr ScrollPageSpiralEffectInfoPtr; */ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, Actor child, - ScrollPageSpiralEffectInfoPtr info) + ScrollPageSpiralEffectInfo& info) { // Apply constraints to this actor // Constraint constraint; @@ -405,7 +403,7 @@ void ScrollViewPageSpiralEffect::ApplyToPage( Actor page, const Vector2& spiralA if ( scrollView ) { - ScrollPageSpiralEffectInfoPtr info(new ScrollPageSpiralEffectInfo( spiralAngle, GetImpl( scrollView ).GetWrapMode() )); + ScrollPageSpiralEffectInfo info( spiralAngle, GetImpl( scrollView ).GetWrapMode() ); ApplyScrollCubeConstraints( scrollView, page, info ); } } diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-slide-effect-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-slide-effect-impl.cpp deleted file mode 100644 index c8a9c32..0000000 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-slide-effect-impl.cpp +++ /dev/null @@ -1,660 +0,0 @@ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL INCLUDES -#include -#include - -// INTERNAL INCLUDES - -using namespace Dali; - -typedef Dali::Toolkit::Internal::ScrollSlideInfo ScrollSlideInfo; -typedef Dali::Toolkit::Internal::ScrollSlideInfoPtr ScrollSlideInfoPtr; - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ - -/** - * ScrollSlideInfo structure contains - * common info that is shared amongst the constraints applied to Actors. - * The constraints + effect all share ownership of this info struct. - * The info is written to by the ScrollSlideInfoUpdate constraint. While - * the other constraints read from by the other constraints. Due to the order - * in which the constraints are applied, all constraints will get the current - * property values for these properties. - * The advantage of doing this is that: - * A) Constraints are not restricted by the 6 property limit. to function. - * B) Properties which rarely change or only change when another property changes - * (e.g. time), such as scroll position, scroll domain, size, wrap mode don't need - * to be checked for each constraint to apply. - */ -class ScrollSlideInfo : public RefObject -{ - -public: - - /** - * Constructor - */ - ScrollSlideInfo() - : mScrollWrap(false), - mVertical(false) - { - } - - /** - * Destructor - */ - virtual ~ScrollSlideInfo() - { - } - -public: - - Vector3 mScrollPosition; - Vector3 mEffectReference; - Vector3 mScrollSize; - Vector3 mScrollPositionMin; - Vector3 mScrollPositionMax; - bool mScrollWrap; - bool mVertical; - -}; - -} // namespace Internal - -} // namespace Toolkit - -} // namespace Dali - - -namespace // unnamed namespace -{ - -const float SLIDEEFFECT_ANIMATION_MAX_TIME = 60.0f; ///< Animation time (every time finishes, checks if it needs to go again) -const float COMPLETION_START_DURATION = 0.25f; ///< Maximum time for completion of effect after scroll-view initially completes (due to delay effect) -const float COMPLETION_END_DURATION = 5.0f; ///< Maximum time for completion of effect after scroll-view initially completes (due to delay effect) -const float ANIMATION_BLEND_COEFFICIENT = 0.05f; ///< Animation blending coefficient (blends between target value e.g. 5% and current value 9%) -const float INV_ANIMATION_BLEND_COEFFICIENT = (1.0f - ANIMATION_BLEND_COEFFICIENT); -const float DEFAULT_MAX_DELAY_DURATION = 0.25f; ///< Default maximum delay duration of the effect after scroll completes is 0.25f -const float EFFECT_SNAP_GROW_DURATION = 0.33f; ///< Take 1/3rd of a second for the snap effect property to grow -const float EFFECT_SNAP_DECAY_DURATION = 0.667f; ///< Take 2/3rds of a second for the snap effect property to decay - -/** - * Gets a property index. If the property doesn't already exist, then - * it will create the property. - * @param[in] handle The handle that owns or will own the property - * @param[in] name The name for this property - * @param[in] propertyValue The initial value for this property - * @return The property index for this property is returned. - */ -Property::Index SafeRegisterProperty( Handle& handle, const std::string& name, Property::Value propertyValue ) -{ - Property::Index index = handle.GetPropertyIndex( name ); - - if(index == Property::INVALID_INDEX) - { - index = handle.RegisterProperty( name, propertyValue ); - } - - return index; -} - -/** - * Re-scales input value x from x0 - x1, to linearly map - * over the values y0 - y1. Values outside of this range - * will also conform to the trend (gradient) set. - * @param[in] y0 output minimum bound - * @param[in] y1 output maximum bound - * @param[in] x input X value - * @param[in] x0 (optional) input minimum bound (default 0.0) - * @param[in] x1 (optional) input maximum bound (default 1.0) - * @return The result of the mapping is returned. - */ -float Mix(float y0, float y1, float x, float x0 = 0.0f, float x1 = 1.0f) -{ - return y0 + (y1 - y0) * (x - x0) / (x1-x0); -} - -/** - * Returns the value of x chasing target. - * returns a value of x which is closer to target. - * but limited by maxDelta. # - * For example: - * x = 10.0f - * target = 50.0f - * maxDelta = 20.0f - * result is 30.0f (x is 20.0f units closer to target) - * However, if x is already within maxDelta units - * of target, x will equal target. - * For example: - * x = 55.0f - * target = 50.0f - * maxDelta = 20.0f - * result is 50.0f (x was already within 20.0f units of target) - */ -float Chase( float x, float target, float maxDelta ) -{ - float delta = target - x; - - if(delta > 0.0f) - { - x = std::min( x + maxDelta, target ); - } - else - { - x = std::max( x - maxDelta, target ); - } - - return x; -} - -// constraints //////////////////////////////////////////////////////////////// - -/** - * ScrollSlideInfoUpdate - * - * Info constraint updates an info struct with property info, - * so that constraints can use this instead of having it passed through - * as parameters. - */ -struct ScrollSlideInfoUpdate -{ - /** - * Constraint constructor - */ - ScrollSlideInfoUpdate(ScrollSlideInfoPtr scrollInfo) - : mScrollSlideInfo(scrollInfo) - { - } - - /** - * @param[in] current The current value - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] effectReferenceProperty The point in the scroll-view where the user touched the screen - * @param[in] effectTimeProperty The current timer. Starting from 0.0 when scroll animation/dragging - * commences. Ensures that constraint is applied and processed every frame (to achieve the delay effect) - * @param[in] sizeProperty The size of the ScrollView. - * @return The new position of this Actor. - */ - float operator()(const float& current, - const PropertyInput& scrollPositionProperty, - const PropertyInput& effectReferenceProperty, - const PropertyInput& scrollSizeProperty, - const PropertyInput& scrollPositionMinProperty, - const PropertyInput& scrollPositionMaxProperty, - const PropertyInput& scrollWrapProperty) - { - mScrollSlideInfo->mScrollPosition = scrollPositionProperty.GetVector3(); - mScrollSlideInfo->mEffectReference = effectReferenceProperty.GetVector3(); - mScrollSlideInfo->mScrollSize = scrollSizeProperty.GetVector3(); - mScrollSlideInfo->mScrollPositionMin = scrollPositionMinProperty.GetVector3(); - mScrollSlideInfo->mScrollPositionMax = scrollPositionMaxProperty.GetVector3(); - mScrollSlideInfo->mScrollWrap = scrollWrapProperty.GetBoolean(); - - return current; - } - -private: - - ScrollSlideInfoPtr mScrollSlideInfo; - -}; - - -/** - * ScrollSlidePositionConstraint - * - * Position constraint adjusts the position of the Actors - * based on their parent page's position relative to the middle of the screen. - * When at middle of the screen the position is not altered. - * When one screen away from middle the position is rotated about it's origin + mAnchor - */ -struct ScrollSlidePositionConstraint -{ - /** - * Constraint constructor - */ - ScrollSlidePositionConstraint(ScrollSlideInfoPtr scrollInfo, float delayMin, float delayMax) - : mScrollSlideInfo(scrollInfo), - mScrollPosition(scrollInfo->mScrollPosition), - mDelayMin(delayMin), - mDelayMax(delayMax), - mAverageSpeed(0.0f) - { - } - - /** - * @param[in] current The current position - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] effectReferenceProperty The point in the scroll-view where the user touched the screen - * @param[in] effectTimeProperty The current timer. Starting from 0.0 when scroll animation/dragging - * commences. Ensures that constraint is applied and processed every frame (to achieve the delay effect) - * @param[in] sizeProperty The size of the ScrollView. - * @return The new position of this Actor. - */ - Vector3 operator()(const Vector3& current, - const PropertyInput& pagePositionProperty, - const PropertyInput& effectTimeProperty, - const PropertyInput& deltaPositionProperty, - const PropertyInput& snapProperty) - { - const float complete = snapProperty.GetFloat(); - bool activate = (complete > Math::MACHINE_EPSILON_1); - const Vector3& pagePosition = pagePositionProperty.GetVector3(); - const Vector3& scrollPosition = mScrollSlideInfo->mScrollPosition; - - // Get position of page. - Vector2 relativePosition(pagePosition + scrollPosition); - - // short circuit: for orthognal view and when the blending has been deactivated. - if( (!activate) && - (fabsf(relativePosition.x) < Math::MACHINE_EPSILON_1) && - (fabsf(relativePosition.y) < Math::MACHINE_EPSILON_1) ) - { - Vector3 actorPosition(current + scrollPosition); - return actorPosition; - } - - const Vector3& referencePoint = mScrollSlideInfo->mEffectReference; - const Vector3& scrollSize = mScrollSlideInfo->mScrollSize; - const Vector3& deltaPosition = deltaPositionProperty.GetVector3(); - - // 1. Determine the relative position of the actor from the scrolling reference point. - // (the further away from the reference, the longer the delay should be) - const Vector3& min = mScrollSlideInfo->mScrollPositionMin; - const Vector3& max = mScrollSlideInfo->mScrollPositionMax; - - relativePosition.y = (pagePosition.y + current.y - referencePoint.y) / scrollSize.height; - - // Smoothen the relativePosition value by averaging with mRelativePosition (avoids sudden jerk when - // user touche different points) - float shortestDirection = ShortestDistanceInDomain(mRelativePosition.y, relativePosition.y, min.y, max.y); - mRelativePosition.y += activate ? shortestDirection * ANIMATION_BLEND_COEFFICIENT : shortestDirection; - - // f represents this absolute distance. Get as a relative distance and inverse exponential - // (as delay equation has an exponential effect i.e. the closer delayFactor to 1.0f, - // the longer the delay would appear exponentially) - float f = fabsf(mRelativePosition.y) * complete; - f = std::min(f, 1.0f); - f = 1.0f - powf(ANIMATION_BLEND_COEFFICIENT, f); - - // at center delay factor is mDelayMin, at maximum (1.0) it is mDelayMax - f = Mix(mDelayMin, mDelayMax, f); - - // 2. Now that f (delay factor) has been determined for this Actor, - // move mScrollPosition towards the actual scroll position, at rate determined by f. - float shortest = ShortestDistanceInDomain(mScrollPosition.x, WrapInDomain(scrollPosition.x, -min.x, -max.x), min.x, max.x); - mScrollPosition.x += activate ? shortest * (1.0f-f) : shortest; - mScrollPosition.x = WrapInDomain(mScrollPosition.x, -min.x, -max.x); - mScrollPosition.y = scrollPosition.y; - - Vector3 actorPosition(current + pagePosition + mScrollPosition); - - // Get position of actor. - bool wrap = mScrollSlideInfo->mScrollWrap; - - if(wrap) - { - if(fabsf(min.x - max.x) > Math::MACHINE_EPSILON_1) - { - // WRAP X (based on the position of the right side) - actorPosition.x = WrapInDomain(actorPosition.x + scrollSize.x, min.x, max.x) - scrollSize.width; - } - } - - const float targetRelativePositionX = (referencePoint.x + deltaPosition.x); - - float blend(Mix(1.0f, ANIMATION_BLEND_COEFFICIENT, 1.0f - (1.0f - complete) * (1.0f - complete) )); - float invBlend(1.0f - blend); - - mRelativePosition.x = activate ? mRelativePosition.x * invBlend + targetRelativePositionX * blend : targetRelativePositionX; - mRelativePosition.x = Chase( mRelativePosition.x, targetRelativePositionX, 1.0f ); - - relativePosition.x = (actorPosition.x - mRelativePosition.x) / scrollSize.width; - - float difference = fabsf(ShortestDistanceInDomain(mScrollPosition.x, scrollPosition.x, -max.x, -min.x)); - mAverageSpeed = activate ? mAverageSpeed * invBlend + difference * blend : 0.0f; - - actorPosition.x += relativePosition.x * mAverageSpeed; - - return actorPosition - pagePosition; - } - -private: - - ScrollSlideInfoPtr mScrollSlideInfo; - Vector3 mScrollPosition; ///< The current scroll position - float mDelayMin; ///< Minimum delay rate (at closest position to touch) - float mDelayMax; ///< Maximum delay rate (at furthest position from touch - 1 page away) - Vector2 mRelativePosition; - float mAverageSpeed; ///< The Average speed of the Actor (proportional to mScrollPosition - scrollPosition) - -}; - -/** - * ScrollSlideScaleConstraint - * - */ -struct ScrollSlideScaleConstraint -{ - /** - * Constraint constructor - */ - ScrollSlideScaleConstraint() - { - } - - /** - * @param[in] current The current position - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] effectReferenceProperty The point in the scroll-view where the user touched the screen - * @param[in] effectTimeProperty The current timer. Starting from 0.0 when scroll animation/dragging - * commences. Ensures that constraint is applied and processed every frame (to achieve the delay effect) - * @param[in] sizeProperty The size of the ScrollView. - * @return The new position of this Actor. - */ - Vector3 operator()(const Vector3& current, - const PropertyInput& snapProperty) - { - float scale = 1.0f + snapProperty.GetFloat() * 0.008f; - return Vector3( current.x * scale, current.y * scale, current.z); - } - -}; - -/** - * Applies the slide constraints to the child actor for overshoot effect. - * - * @param[in] scrollView The ScrollView containing the pages. - * @param[in] child The child to be affected with the slide effect. - * @param[in] angleSwing The maximum amount the child actor should - * rotate in radians for each axis (X and Y) as the page is scrolled. - * move for each axis (X and Y) as the page is scrolled. - */ -void ApplyScrollSlideConstraints(ScrollSlideInfoPtr scrollSlideInfo, - Toolkit::ScrollView scrollView, - Actor child, - float delayMin, - float delayMax) -{ - // Apply constraints to these actors // - Constraint constraint = Constraint::New( Actor::POSITION, - ParentSource(Actor::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollViewSlideEffect::EFFECT_TIME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_DELTA_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollViewSlideEffect::EFFECT_ACTIVE ) ), - ScrollSlidePositionConstraint(scrollSlideInfo, delayMin, delayMax) ); - constraint.SetRemoveAction( Constraint::Discard ); - child.ApplyConstraint( constraint ); - - constraint = Constraint::New( Actor::SCALE, - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollViewSlideEffect::EFFECT_ACTIVE ) ), - ScrollSlideScaleConstraint() ); - constraint.SetRemoveAction( Constraint::Discard ); - child.ApplyConstraint( constraint ); -} - -} // unnamed namespace - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ - -ScrollViewSlideEffect::ScrollViewSlideEffect() -: mScrollSlideInfo(new ScrollSlideInfo()), - mPropertyTime(Property::INVALID_INDEX), - mPropertyReference(Property::INVALID_INDEX), - mPropertyActive(Property::INVALID_INDEX), - mDelayReferenceOffset(Vector3::ZERO), - mMaxDelayDuration(DEFAULT_MAX_DELAY_DURATION) -{ -} - -ScrollViewSlideEffect::~ScrollViewSlideEffect() -{ -} - -bool ScrollViewSlideEffect::GetSlideDirection() const -{ - return mScrollSlideInfo->mVertical; -} - -void ScrollViewSlideEffect::SetSlideDirection(bool vertical) -{ - mScrollSlideInfo->mVertical = vertical; -} - -const Vector3& ScrollViewSlideEffect::GetDelayReferenceOffset() const -{ - return mDelayReferenceOffset; -} - -void ScrollViewSlideEffect::SetDelayReferenceOffset(const Vector3& offset) -{ - mDelayReferenceOffset = offset; -} - -float ScrollViewSlideEffect::GetMaxDelayDuration() const -{ - return mMaxDelayDuration; -} - -void ScrollViewSlideEffect::SetMaxDelayDuration(float duration) -{ - mMaxDelayDuration = duration; -} - -void ScrollViewSlideEffect::ApplyToActor(Actor child, - float delayMin, - float delayMax) -{ - ApplyScrollSlideConstraints( mScrollSlideInfo, - GetScrollView(), - child, - delayMin, - delayMax ); -} - -void ScrollViewSlideEffect::OnAttach(Toolkit::ScrollView& scrollView) -{ - mScrollSlideInfo->mScrollPosition = scrollView.GetProperty( scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ); - mScrollSlideInfo->mScrollSize = scrollView.GetProperty( Actor::SIZE ); - mScrollSlideInfo->mScrollPositionMin = scrollView.GetProperty( scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ); - mScrollSlideInfo->mScrollPositionMax = scrollView.GetProperty( scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ); - mScrollSlideInfo->mScrollWrap = scrollView.GetProperty( scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ); - mScrollSlideInfo->mVertical = false; - - // Create effect-time property if not already created. - if(mPropertyTime == Property::INVALID_INDEX) - { - mPropertyTime = SafeRegisterProperty( scrollView, Toolkit::ScrollViewSlideEffect::EFFECT_TIME, 0.0f ); - mPropertyReference = SafeRegisterProperty( scrollView, Toolkit::ScrollViewSlideEffect::EFFECT_REFERENCE, Vector3::ZERO ); - mPropertyActive = SafeRegisterProperty( scrollView, Toolkit::ScrollViewSlideEffect::EFFECT_ACTIVE, 0.0f ); - } - - // Create constraint to update ScrollSlideInfo - // Doesn't matter what this is applied to and on what property. - // Just needs to update mScrollSlideInfo values as properties change. - // The minor constraints (applied to the Actors) can use this mScrollSlideInfo. - Constraint constraint = Constraint::New( mPropertyTime, - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollViewSlideEffect::EFFECT_REFERENCE ) ), - Source(scrollView, Actor::SIZE), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), - ScrollSlideInfoUpdate(mScrollSlideInfo) ); - constraint.SetRemoveAction( Constraint::Discard ); - mInfoUpdateConstraint = scrollView.ApplyConstraint( constraint ); - - // Connect to the scroll view signals - scrollView.ScrollStartedSignal().Connect(this, &ScrollViewSlideEffect::OnScrollStart); - scrollView.SnapStartedSignal().Connect(this, &ScrollViewSlideEffect::OnScrollSnapStarted); - scrollView.TouchedSignal().Connect(this, &ScrollViewSlideEffect::OnScrollTouched); - - AttachActor(scrollView); -} - -bool ScrollViewSlideEffect::OnScrollTouched(Actor actor, const TouchEvent& event) -{ - // Ignore events with multiple-touch points - if (event.GetPointCount() != 1) - { - return false; - } - - if (event.GetPoint(0).state == TouchPoint::Down) - { - const TouchPoint& point = event.GetPoint(0); - Vector3 touchPosition(point.local - Stage::GetCurrent().GetSize() * 0.5f); - - Vector3 scrollPosition = GetScrollView().GetCurrentScrollPosition(); - GetScrollView().SetProperty(mPropertyReference, scrollPosition + touchPosition + mDelayReferenceOffset); - } - - return false; -} - -void ScrollViewSlideEffect::OnDetach(Toolkit::ScrollView& scrollView) -{ - scrollView.ScrollStartedSignal().Disconnect(this, &ScrollViewSlideEffect::OnScrollStart); - scrollView.SnapStartedSignal().Disconnect(this, &ScrollViewSlideEffect::OnScrollSnapStarted); - scrollView.TouchedSignal().Disconnect(this, &ScrollViewSlideEffect::OnScrollTouched); - scrollView.RemoveConstraint( mInfoUpdateConstraint ); - - if(mAnimation) - { - mAnimation.FinishedSignal().Disconnect(this, &ScrollViewSlideEffect::OnAnimationFinished); - mAnimation.Clear(); - mAnimation.Reset(); - } - - if(mAnimationSnap) - { - mAnimationSnap.FinishedSignal().Disconnect(this, &ScrollViewSlideEffect::OnAnimationSnapFinished); - mAnimationSnap.Clear(); - mAnimationSnap.Reset(); - } -} - -void ScrollViewSlideEffect::AttachActor(Actor actor) -{ - -} - -void ScrollViewSlideEffect::DetachActor(Actor actor) -{ - // TODO: remove the specific constraint defined in AttachActor (and possibly - // unregister property) - neither functionality exists in Dali. -} - -void ScrollViewSlideEffect::ContinueAnimation(float endTime) -{ - // continue animating - if(mAnimation) - { - mAnimation.FinishedSignal().Disconnect(this, &ScrollViewSlideEffect::OnAnimationFinished); - mAnimation.Clear(); - } - - Actor scrollView = GetScrollView(); - - mAnimation = Animation::New(SLIDEEFFECT_ANIMATION_MAX_TIME); - mAnimation.AnimateTo( Property(scrollView, mPropertyTime), endTime, AlphaFunctions::Linear ); - mAnimation.FinishedSignal().Connect(this, &ScrollViewSlideEffect::OnAnimationFinished); - mAnimation.Play(); -} - -void ScrollViewSlideEffect::OnScrollStart( const Vector3& position ) -{ - Actor scrollView = GetScrollView(); - GetScrollView().SetProperty(mPropertyTime, 0.0f); - - ContinueAnimation(SLIDEEFFECT_ANIMATION_MAX_TIME); - - if(mAnimationSnap) - { - mAnimationSnap.FinishedSignal().Disconnect(this, &ScrollViewSlideEffect::OnAnimationSnapFinished); - mAnimationSnap.Clear(); - } - - mAnimationSnap = Animation::New( EFFECT_SNAP_GROW_DURATION ); - mAnimationSnap.AnimateTo( Property(scrollView, mPropertyActive), 1.0f, AlphaFunctions::Linear ); - mAnimationSnap.FinishedSignal().Connect(this, &ScrollViewSlideEffect::OnAnimationSnapFinished); - mAnimationSnap.Play(); -} - -void ScrollViewSlideEffect::OnScrollSnapStarted(const Toolkit::ScrollView::SnapEvent& event) -{ - if(mAnimationSnap) - { - mAnimationSnap.Clear(); - } - - Actor scrollView = GetScrollView(); - mAnimationSnap = Animation::New(EFFECT_SNAP_DECAY_DURATION ); - mAnimationSnap.AnimateTo( Property(scrollView, mPropertyActive), 0.0f, AlphaFunctions::Linear ); - mAnimationSnap.FinishedSignal().Connect(this, &ScrollViewSlideEffect::OnAnimationSnapFinished); - mAnimationSnap.Play(); -} - -void ScrollViewSlideEffect::OnAnimationSnapFinished( Animation& animation ) -{ - mAnimationSnap.FinishedSignal().Disconnect(this, &ScrollViewSlideEffect::OnAnimationSnapFinished); - mAnimationSnap.Clear(); - - // stop time animation - if(mAnimation) - { - mAnimation.FinishedSignal().Disconnect(this, &ScrollViewSlideEffect::OnAnimationFinished); - mAnimation.Clear(); - } -} - -void ScrollViewSlideEffect::OnAnimationFinished( Animation& animation ) -{ - // still unstable, so continue animating. - // TODO: Requires an instability check to ensure time animation finishes when delay is - // less noticeable. i.e. all present scrollPositions are approx the same as mScrollPosition in constraints. - // best solution for this is to switch to a single history vector of scroll position, and compare if - // position has not deviated >= 0.5 pixel for the past 1 second. - float endTime = GetScrollView().GetProperty(mPropertyTime) + SLIDEEFFECT_ANIMATION_MAX_TIME; - ContinueAnimation(endTime); -} - -} // namespace Internal - -} // namespace Toolkit - -} // namespace Dali diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-slide-effect-impl.h b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-slide-effect-impl.h deleted file mode 100644 index 778db0e..0000000 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-slide-effect-impl.h +++ /dev/null @@ -1,225 +0,0 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_SLIDE_EFFECT_H__ -#define __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_SLIDE_EFFECT_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include -#include -#include -#include - -// INTERNAL INCLUDES -#include -#include -#include -#include - -namespace Dali -{ - -class Animation; - -namespace Toolkit -{ - -class ScrollView; - -namespace Internal -{ - -class ScrollSlideInfo; - -typedef IntrusivePtr ScrollSlideInfoPtr; - -/** - * @copydoc Toolkit::ScrollViewSlideEffect - */ -class ScrollViewSlideEffect : public ScrollViewEffect -{ -public: - - /** - * Constructor - */ - ScrollViewSlideEffect(); - -public: - - /** - * @copydoc ScrollViewEffect::GetSlideDirection - */ - bool GetSlideDirection() const; - - /** - * @copydoc ScrollViewEffect::SetSlideDirection - */ - void SetSlideDirection(bool vertical); - - /** - * @copydoc ScrollViewEffect::GetDelayReferenceOffset - */ - const Vector3& GetDelayReferenceOffset() const; - - /** - * @copydoc ScrollViewEffect::SetDelayReferenceOffset - */ - void SetDelayReferenceOffset(const Vector3& offset); - - /** - * @copydoc ScrollViewEffect::GetMaxDelayDuration - */ - float GetMaxDelayDuration() const; - - /** - * @copydoc ScrollViewEffect::SetMaxDelayDuration - */ - void SetMaxDelayDuration(float duration); - - /** - * @copydoc ScrollViewEffect::ApplyToActor - */ - void ApplyToActor( Actor child, - float delayMin, - float delayMax ); -public: - - /** - * @copydoc ScrollViewEffect::OnAttach - */ - virtual void OnAttach(Toolkit::ScrollView& scrollView); - - /** - * @copydoc ScrollViewEffect::OnDetach - */ - virtual void OnDetach(Toolkit::ScrollView& scrollView); - -protected: - - /** - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~ScrollViewSlideEffect(); - -private: - - /** - * Invoked when user touches the scroll-view - * We keep track of the touch as this is used to determine - * the reference point which is used to determine the delay - * factor for the Actors' movements. - * @param[in] actor The actor touched - * @param[in] event The touch Event - * @return Whether to consume the even or not. - */ - bool OnScrollTouched(Actor actor, const TouchEvent& event); - - /** - * Signal handler, called when the ScrollView starts to move - * - * @param[in] position The current scroll position - */ - void OnScrollStart( const Vector3& position ); - - /** - * Signal handler, called when the ScrollView starts to snap - * @param[in] event The snap event. - */ - void OnScrollSnapStarted(const Toolkit::ScrollView::SnapEvent& event); - - /** - * Signal handler, called some time after the ScrollView has completed - * movement. There is a delay as when the ScrollView has completed - * movement, there are Actors that have a delay, and take time to arrive - * at their final destination. - * - * @param[in] animation The animation delegate for this delay - */ - void OnAnimationSnapFinished( Animation& animation ); - - /** - * Signal handler, called when the Wobble Effect animation has completed. - * - * @param[in] animation The animation. - */ - void OnAnimationFinished( Animation& animation ); - - /** - * Attaches effect to Scroll Actor (ScrollView) - * - * Applies the same wobble effect to each Scroll Actor. - * - * @param[in] actor The attached Actor - */ - void AttachActor(Actor actor); - - /** - * Detaches effect from Scroll Actor (ScrollView) - * - * @param[in] actor The attached Actor - */ - void DetachActor(Actor actor); - - /** - * Continues Animation to time reaches endTime - * - * @param[in] endTime the target time to reach. - */ - void ContinueAnimation(float endTime); - -private: - - ScrollSlideInfoPtr mScrollSlideInfo; ///< Info structure to keep track of common properties amongst many constraints. - ActiveConstraint mInfoUpdateConstraint; ///< Constraint applied to scroll-view to update Info structure. - Animation mAnimation; ///< Animation Timer to drive the slide effect constraint. - Animation mAnimationSnap; ///< Animation Snap (this animates from from 1.0 to 0.0 when contents snap) - Property::Index mPropertyTime; ///< Time property used by slide effect constraint to calculate timePassed. - Property::Index mPropertyReference; ///< Reference point in scroll-contents, this point has no delay. - ///< The further out from this point, the further the delay. - Property::Index mPropertyActive; ///< Property indicates the progress of the scrolling from 1.0f (scrolling) to 0.0f (fully snapped) - Vector3 mDelayReferenceOffset; ///< Where to offset the delay reference point when dragging. - float mMaxDelayDuration; ///< Maximum duration of effect after scroll-view completes. -}; - -} // namespace Internal - -// Helpers for public-api forwarding methods - -inline Internal::ScrollViewSlideEffect& GetImpl(Dali::Toolkit::ScrollViewSlideEffect& obj) -{ - DALI_ASSERT_ALWAYS(obj); - - Dali::RefObject& handle = obj.GetBaseObject(); - - return static_cast(handle); -} - -inline const Internal::ScrollViewSlideEffect& GetImpl(const Dali::Toolkit::ScrollViewSlideEffect& obj) -{ - DALI_ASSERT_ALWAYS(obj); - - const Dali::RefObject& handle = obj.GetBaseObject(); - - return static_cast(handle); -} - -} // namespace Toolkit - -} // namespace Dali - -#endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_SLIDE_EFFECT_H__ diff --git a/base/dali-toolkit/internal/file.list b/base/dali-toolkit/internal/file.list index e58b4de..1966d8d 100644 --- a/base/dali-toolkit/internal/file.list +++ b/base/dali-toolkit/internal/file.list @@ -31,7 +31,6 @@ toolkit_base_src_files = \ $(toolkit_base_src_dir)/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp \ $(toolkit_base_src_dir)/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.cpp \ $(toolkit_base_src_dir)/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp \ - $(toolkit_base_src_dir)/controls/scrollable/scroll-view/scroll-view-slide-effect-impl.cpp \ $(toolkit_base_src_dir)/controls/scrollable/scroll-view/scroll-view-wobble-effect-impl.cpp \ $(toolkit_base_src_dir)/controls/table-view/table-view-impl.cpp \ $(toolkit_base_src_dir)/controls/text-input/text-input-decorator-impl.cpp \ diff --git a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-slide-effect.cpp b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-slide-effect.cpp deleted file mode 100644 index 1219ca9..0000000 --- a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-slide-effect.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include - -using namespace Dali; - -namespace Dali -{ - -namespace Toolkit -{ - -const std::string ScrollViewSlideEffect::EFFECT_TIME( "ScrollViewSlideEffect::EFFECT_TIME" ); -const std::string ScrollViewSlideEffect::EFFECT_REFERENCE( "ScrollViewSlideEffect::EFFECT_REFERENCE" ); -const std::string ScrollViewSlideEffect::EFFECT_ACTIVE( "ScrollViewSlideEffect::EFFECT_ACTIVE" ); - -ScrollViewSlideEffect ScrollViewSlideEffect::New() -{ - return ScrollViewSlideEffect(new Internal::ScrollViewSlideEffect()); -} - -ScrollViewSlideEffect::ScrollViewSlideEffect() -{ - -} - -ScrollViewSlideEffect::ScrollViewSlideEffect(Internal::ScrollViewSlideEffect *impl) -: ScrollViewEffect(impl) -{ -} - -bool ScrollViewSlideEffect::GetSlideDirection() const -{ - return GetImpl(*this).GetSlideDirection(); -} - -void ScrollViewSlideEffect::SetSlideDirection(bool vertical) -{ - GetImpl(*this).SetSlideDirection( vertical ); -} - -Vector3 ScrollViewSlideEffect::GetDelayReferenceOffset() const -{ - return GetImpl(*this).GetDelayReferenceOffset(); -} - -void ScrollViewSlideEffect::SetDelayReferenceOffset(const Vector3& offset) -{ - GetImpl(*this).SetDelayReferenceOffset(offset); -} - -float ScrollViewSlideEffect::GetMaxDelayDuration() const -{ - return GetImpl(*this).GetMaxDelayDuration(); -} - -void ScrollViewSlideEffect::SetMaxDelayDuration(float offset) -{ - GetImpl(*this).SetMaxDelayDuration(offset); -} - -ScrollViewSlideEffect ScrollViewSlideEffect::DownCast( BaseHandle handle ) -{ - return ScrollViewSlideEffect( dynamic_cast(handle.GetObjectPtr()) ); -} - -void ScrollViewSlideEffect::ApplyToActor( Actor child, - float delayMin, - float delayMax ) -{ - GetImpl(*this).ApplyToActor( child, - delayMin, - delayMax ); -} - -} // namespace Toolkit - -} // namespace Dali diff --git a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-slide-effect.h b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-slide-effect.h deleted file mode 100644 index f58559c..0000000 --- a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-slide-effect.h +++ /dev/null @@ -1,163 +0,0 @@ -#ifndef __DALI_TOOLKIT_SCROLL_VIEW_SLIDE_EFFECT_H__ -#define __DALI_TOOLKIT_SCROLL_VIEW_SLIDE_EFFECT_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -class Actor; - -namespace Toolkit -{ - -class ScrollViewEffect; - -namespace Internal DALI_INTERNAL -{ -class ScrollViewSlideEffect; -} - -/** - * @brief ScrollView effect that uses slides for transitioning pages. - */ -class DALI_IMPORT_API ScrollViewSlideEffect : public ScrollViewEffect -{ -public: - static const std::string EFFECT_TIME; ///< Effect time property name - static const std::string EFFECT_REFERENCE; ///< Effect reference property name - static const std::string EFFECT_ACTIVE; ///< Effect active property name - -public: - - /** - * @brief Create an initialized ScrollViewSlideEffect. - * - * @return A handle to a newly allocated Dali resource. - */ - static ScrollViewSlideEffect New(); - - /** - * @brief Create an uninitialized ScrollViewSlideEffect; this can be initialized with ScrollViewSlideEffect::New(). - * - * Calling member functions with an uninitialized Toolkit::ScrollViewSlideEffect is not allowed. - */ - ScrollViewSlideEffect(); - - /** - * @brief Downcast an Object handle to ScrollViewSlideEffect. - * - * If handle points to a ScrollViewSlideEffect the downcast produces - * valid handle. If not the returned handle is left uninitialized. - * - * @param[in] handle Handle to an object - * @return handle to a ScrollViewSlideEffect or an uninitialized handle - */ - static ScrollViewSlideEffect DownCast( BaseHandle handle ); - - /** - * @brief Gets the slide direction for this effect. - * - * @return The slide direction (true = vertical, false = horizontal) - */ - bool GetSlideDirection() const; - - /** - * @brief Sets the slide direction for this effect. - * - * If the direction has been set to horizontal (false), then - * the user will see the Actors have a delay in horizontal movement - * based on the vertical distance the actor is away from the initial drag point. - * If the direction has been set to vertical (true), then the - * user will experience the opposite effect (i.e. delay in the vertical movement). - * @param[in] vertical The slide direction (true = vertical, false = horizontal) - * (default is horizontal i.e. false) - */ - void SetSlideDirection(bool vertical); - - /** - * @brief Gets the delay reference offset for this effect. - * - * @return The delay reference offset (Vector3::ZERO - indicates no offset) - */ - Vector3 GetDelayReferenceOffset() const; - - /** - * @brief Sets an offset for where the central delay point on the scroll-view should be - * when dragging. - * - * By default the offset is 0. Which means that the point where the user drags - * the scroll-view content should have no delay, and the further away from this - * point, the delay should increase. Adjusting this offset to for example - * 0.0f, -stageSize.height * 0.5f, will mean that dragging the center of the stage - * will result in the content at the top of the stage moving with no delay, and - * the further away from this point (top of stage), the delay should increase. - * @param[in] offset The offset in local coordinates, relative to the ScrollView. - */ - void SetDelayReferenceOffset(const Vector3& offset); - - /** - * @brief Gets the maximum duration of the effect after scrolling completes. - * - * @return The duration in seconds - */ - float GetMaxDelayDuration() const; - - /** - * @brief Sets the maximum duration of the effect after scrolling completes. - * - * @param[in] duration The duration in seconds (>= 0.0f, default is 0.25 seconds) - */ - void SetMaxDelayDuration(float duration); - - /** - * @brief Manually apply effect to an Actor. - * - * @param[in] child The child Actor to be affected by this effect. - * @param[in] delayMin The minimum delay coefficient for Actors at the - * scroll-view touch point. Set to 0 for instantaneous, and 1 for infinite delay. - * Default is 0.5f - * @param[in] delayMax The maximum delay coefficient for Actors at the - * scroll-view approx 1 ScrollView size from the touch point. Set to 0 for - * instantaneous, and 1 for infinite delay. Default is 0.99f (a noticable delay) - */ - void ApplyToActor( Actor child, - float delayMin = 0.5f, - float delayMax = 0.95f ); - -protected: - - /** - * @brief This constructor is used by Dali New() methods. - * - * @param [in] impl A pointer to a newly allocated Dali resource - */ - explicit DALI_INTERNAL ScrollViewSlideEffect(Internal::ScrollViewSlideEffect *impl); - -}; - -} // namespace Toolkit - -} // namespace Dali - -#endif // __DALI_TOOLKIT_SCROLL_VIEW_SLIDE_EFFECT_H__ diff --git a/base/dali-toolkit/public-api/file.list b/base/dali-toolkit/public-api/file.list index 28fc3d4..9537d61 100755 --- a/base/dali-toolkit/public-api/file.list +++ b/base/dali-toolkit/public-api/file.list @@ -35,7 +35,6 @@ public_api_base_src_files = \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-page-cube-effect.cpp \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-page-carousel-effect.cpp \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-page-spiral-effect.cpp \ - $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-slide-effect.cpp \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-wobble-effect.cpp \ $(public_api_base_src_dir)/controls/table-view/table-view.cpp \ $(public_api_base_src_dir)/controls/text-input/text-input.cpp \ @@ -107,8 +106,7 @@ public_api_base_scroll_view_header_files = \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view.h \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-effect.h \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-cube-effect.h \ - $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-page-spiral-effect.h \ - $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-slide-effect.h + $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-page-spiral-effect.h public_api_base_table_view_header_files = \ $(public_api_base_src_dir)/controls/table-view/table-view.h diff --git a/optional/dali-toolkit/dali-toolkit.h b/optional/dali-toolkit/dali-toolkit.h index 7be7d83..236d9ba 100644 --- a/optional/dali-toolkit/dali-toolkit.h +++ b/optional/dali-toolkit/dali-toolkit.h @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include