From: Kimmo Hoikka Date: Wed, 5 Nov 2014 18:37:19 +0000 (+0000) Subject: Remove handle::operator=(NULL) as it is duplicating handle.Reset() functionality... X-Git-Tag: dali_1.0.17~11^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=b54d9cd65c353af149eb2bafa60ae02a825fd9c1 Remove handle::operator=(NULL) as it is duplicating handle.Reset() functionality and thus redundant Change-Id: Ia644b8245d5b999325738c1d6a790a75d11a26b2 --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp index 553dc7a..02d0df1 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp @@ -307,24 +307,6 @@ int UtcDaliScrollViewSlideEffectSetup(void) END_TEST; } -int UtcDaliScrollViewTwistEffectSetup(void) -{ - tet_infoline(" UtcDaliScrollViewTwistEffectSetup"); - - ScrollViewTwistEffect effect; - - DALI_TEST_CHECK( !effect ); - - BaseHandle handle = ScrollViewTwistEffect::New(); - - DALI_TEST_CHECK( handle ); - - effect = ScrollViewTwistEffect::DownCast(handle); - - DALI_TEST_CHECK( effect ); - END_TEST; -} - int UtcDaliScrollViewCubeEffectTest(void) { ToolkitTestApplication application; @@ -440,46 +422,6 @@ int UtcDaliScrollViewSlideEffectTest(void) END_TEST; } -int UtcDaliScrollViewTwistEffectTest(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliScrollViewTwistEffectTest"); - - Vector2 size = Stage::GetCurrent().GetSize(); - - ScrollView scrollView = SetupTestScrollView(1, 3, size); - Actor testPage = gPages[1]; - Wait(application, 500); - - ScrollViewTwistEffect effect = ScrollViewTwistEffect::New(); - float shrinkDist = 0.2f; - effect.SetMinimumDistanceForShrink(shrinkDist); - DALI_TEST_CHECK((shrinkDist - effect.GetMinimumDistanceForShrink()) < Math::MACHINE_EPSILON_0); - effect.EnableEffect(true); - scrollView.ApplyEffect(effect); - - Actor actor = AddActorToPage(testPage, 0.5f, 0.5f, 3, 3); - Wait(application); - Vector3 actorPrePosition = actor.GetCurrentPosition(); - - effect.ApplyToActor( actor, - true, - Vector2(Math::PI_2, Math::PI_2), - 0.0f); - - 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; -} - int UtcDaliScrollViewCustomEffectTest(void) { ToolkitTestApplication application; diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp index fd63390..e6876dc 100644 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp +++ b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp @@ -357,8 +357,7 @@ void ScrollOvershootEffectRipple::SetOvershoot(float amount, bool animate) { mScrollOvershootAnimation.FinishedSignal().Disconnect( this, &ScrollOvershootEffectRipple::OnOvershootAnimFinished ); mScrollOvershootAnimation.Stop(); - mScrollOvershootAnimation.Clear(); - mScrollOvershootAnimation = NULL; + mScrollOvershootAnimation.Reset(); } mScrollOvershootAnimation = Animation::New(duration); mScrollOvershootAnimation.FinishedSignal().Connect( this, &ScrollOvershootEffectRipple::OnOvershootAnimFinished ); @@ -391,8 +390,7 @@ void ScrollOvershootEffectRipple::OnOvershootAnimFinished(Animation& animation) } mScrollOvershootAnimation.FinishedSignal().Disconnect( this, &ScrollOvershootEffectRipple::OnOvershootAnimFinished ); mScrollOvershootAnimation.Stop(); - mScrollOvershootAnimation.Clear(); - mScrollOvershootAnimation = NULL; + mScrollOvershootAnimation.Reset(); mAnimationStateFlags = 0; if( animateOff ) { 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 index f00411a..778db0e 100644 --- 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 @@ -186,9 +186,9 @@ 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 twist effect constraint. + 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 twist effect constraint to calculate timePassed. + 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) diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.cpp deleted file mode 100755 index c93d264..0000000 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.cpp +++ /dev/null @@ -1,738 +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 - -using namespace Dali; - -namespace // unnamed namespace -{ - -const char * const EFFECT_TIME( "ScrollViewTwistEffect::EFFECT_TIME" ); -const char * const EFFECT_REFERENCE( "ScrollViewTwistEffect::EFFECT_REFERENCE" ); -const char * const EFFECT_DEPTH( "ScrollViewTwistEffect::EFFECT_DEPTH"); -const char * const EFFECT_ACTIVATE( "ScrollViewTwistEffect::EFFECT_ACTIVATE"); - -const float TWISTEFFECT_ANIMATION_MAX_TIME = 60.0f; ///< Animation time (every time finishes, checks if it needs to go again) -const float TWISTEFFECT_DEFAULT_DROPOFF = 0.7f; ///< Default drop off amount -const float TWISTEFFECT_DEFAULT_DROPOFF_DISTANCE_X = 720.0f; ///< Default drop off distance -const float TWISTEFFECT_DEFAULT_DROPOFF_DISTANCE_Y = 1280.0f; ///< Default drop off distance - -// Hop Easing equation. -// Starts with a -ve cosine ranging from 0 to pi. -// Then plateaus. -// Then finishes with a -ve cosine ranging from pi to 0 -// 0......(RISE).....PI (SUSTAIN) PI.....(FALL)......0 -// xxxxxxxxxxxxxxxxxxxxx -// x x -// x x -// x x -// x x -// x x -// x x -// xxxxxx xxxxxx - -const float HOP_RISE(0.25f); -const float HOP_FALL(0.5f); -const float DELAY(0.5f); - -float HopEasing(float progress) -{ - // progress from 0.0 - HOP_RISE (go from 0.0 to 1.0) - if(progress < HOP_RISE) - { - return 0.5f - cosf(progress/HOP_RISE * Math::PI) * 0.5f; - } - - progress += HOP_FALL - 1.0f; - - // progress from 0.0 - HOP_FALL (go from 1.0 to 0.0) - if(progress > 0.0f ) - { - return 0.5f + cosf(progress/HOP_FALL * Math::PI) * 0.5f; - } - - // progress at plateau. - return 1.0f; -} - -/** - * 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] x input X value - * @param[in] x0 input minimum bound - * @param[in] x1 input maximum bound - * @param[in] y0 output minimum bound - * @param[in] y1 output maximum bound - * @return The result of the mapping is returned. - */ -float Rescale(float x, float x0, float x1, float y0, float y1) -{ - 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 //////////////////////////////////////////////////////////////// - -/** - * ScrollTwistRotationConstraint - * - * Rotate constraint adjusts the angle of the Actors - * based on actor's world-position relative to the middle of the screen. - * When at middle of screen Angles on X and Y Axes is 0. - * When one screen away from the middle Angle is 90 degrees (pi/2) - */ -struct ScrollDropoffTwistRotationConstraint -{ - /** - * Constraint constructor - * @param[in] angleSwing The amount the Actor should revolve in radians - * for a given page worth of distance. - */ - ScrollDropoffTwistRotationConstraint(const Vector2& angleSwing, const Vector2& dropOff, const Vector2& distance, AlphaFunction function) - : mAngleSwing(angleSwing), - mDropOff(dropOff), - mDropOffDistance(distance), - mDropOffFunction(function) - { - } - - /** - * @param[in] current The current orientation of this Actor - * @param[in] actorPositionProperty The actor's world-position property - * @param[in] scrollOvershootXProperty The scroll-view's overshoot property (SCROLL_OVERSHOOT_X_PROPERTY_NAME) - * @param[in] scrollOvershootYProperty The scroll-view's overshoot property (SCROLL_OVERSHOOT_Y_PROPERTY_NAME) - * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @return The new orientation of this Actor. - */ - Quaternion operator()(const Quaternion& current, - const PropertyInput& actorPositionProperty, - const PropertyInput& scrollablePositionProperty, - const PropertyInput& scrollOvershootXProperty, - const PropertyInput& scrollOvershootYProperty, - const PropertyInput& pageSizeProperty) - { - const Vector3& position = actorPositionProperty.GetVector3(); - const Vector3& parentPosition = scrollablePositionProperty.GetVector3(); - const Vector3& pageSize = pageSizeProperty.GetVector3(); - const Vector2 overshoot(scrollOvershootXProperty.GetFloat(), scrollOvershootYProperty.GetFloat()); - - if(fabsf(overshoot.x) < Math::MACHINE_EPSILON_0 && fabsf(overshoot.y) < Math::MACHINE_EPSILON_0) - { - return current; - } - - // get distance from centre of scrollable container - Vector2 distance = position.GetVectorXY() - parentPosition.GetVectorXY(); - - if( overshoot.x > 0.0f ) - { - distance.x += pageSize.x * 0.5f; - } - else - { - distance.x -= pageSize.x * 0.5f; - } - distance.x = Clamp(fabsf(distance.x), 0.0f, mDropOffDistance.x); - - if( overshoot.y > 0.0f ) - { - distance.y += pageSize.y * 0.5f; - } - else - { - distance.y -= pageSize.y * 0.5f; - } - distance.y = Clamp(fabsf(distance.y), 0.0f, mDropOffDistance.y); - - Vector2 angleMod = distance / mDropOffDistance; - if(mDropOffFunction) - { - angleMod.x = mDropOffFunction(angleMod.x); - angleMod.y = mDropOffFunction(angleMod.y); - } - angleMod = Vector2::ONE - (angleMod * mDropOff); - - Vector2 angle = angleMod * mAngleSwing * overshoot; - - Quaternion rotation = Quaternion(angle.x, Vector3::YAXIS) * - Quaternion(-angle.y, Vector3::XAXIS) * - current; - - return rotation; - } - - const Vector2 mAngleSwing; ///< Maximum amount in X and Y axes to rotate. - const Vector2 mDropOff; - const Vector2 mDropOffDistance; - AlphaFunction mDropOffFunction; -}; - -/** - * ScrollTwistRotationConstraint - * - * Rotate constraint adjusts the angle of the Actors - * based on actor's world-position relative to the middle of the screen. - * When at middle of screen Angles on X and Y Axes is 0. - * When one screen away from the middle Angle is 90 degrees (pi/2) - */ -struct ScrollTwistRotationConstraint -{ - /** - * Constraint constructor - * @param[in] angleSwing The amount the Actor should revolve in radians - * for a given page worth of distance. - */ - ScrollTwistRotationConstraint(const Vector2& angleSwing) - : mAngleSwing(angleSwing) - { - } - - /** - * @param[in] current The current orientation of this Actor - * @param[in] actorPositionProperty The actor's world-position property - * @param[in] scrollOvershootXProperty The scroll-view's overshoot property (SCROLL_OVERSHOOT_X_PROPERTY_NAME) - * @param[in] scrollOvershootYProperty The scroll-view's overshoot property (SCROLL_OVERSHOOT_Y_PROPERTY_NAME) - * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @return The new orientation of this Actor. - */ - Quaternion operator()(const Quaternion& current, - const PropertyInput& scrollOvershootXProperty, - const PropertyInput& scrollOvershootYProperty) - { - const Vector2 overshoot(scrollOvershootXProperty.GetFloat(), scrollOvershootYProperty.GetFloat()); - - if( fabsf(overshoot.x) < Math::MACHINE_EPSILON_0 && fabsf(overshoot.y) < Math::MACHINE_EPSILON_0 ) - { - return current; - } - - Quaternion rotation = Quaternion(overshoot.x * mAngleSwing.x, Vector3::YAXIS) * - Quaternion(-overshoot.y * mAngleSwing.y, Vector3::XAXIS) * - current; - - return rotation; - } - - const Vector2 mAngleSwing; -}; - -/** - * ScrollTwistPositionConstraint - * - * 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 ScrollTwistPositionConstraint -{ - /** - * Constraint constructor - */ - ScrollTwistPositionConstraint(float delayMin, float delayMax) - : mDelayMin(delayMin), - mDelayMax(delayMax), - mCurrentDelayFactor(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& scrollPositionProperty, - const PropertyInput& effectReferenceProperty, - const PropertyInput& effectTimeProperty, - const PropertyInput& sizeProperty, - const PropertyInput& activateProperty) - { - const Vector3& scrollPosition = scrollPositionProperty.GetVector3(); - const float& activate = activateProperty.GetFloat(); - - if(activate < Math::MACHINE_EPSILON_0) - { - mScrollPosition = scrollPosition; - return current + mScrollPosition; - } - const Vector3& pagePosition = pagePositionProperty.GetVector3(); - const Vector3& referencePoint = effectReferenceProperty.GetVector3(); - // Determine the relative position of the actor from the scrolling reference point. - // (the further away from the refernce, the longer the delay should be) - Vector3 relativePosition = pagePosition + current - referencePoint; - float f = relativePosition.x; - - // f represents this absolute distance. Get as a relative distance and inverse exponential - // (as delay equation is has an exponential effect i.e. the closer delayFactor to 1.0f, - // the longer the delay would appear exponentially) - f = fabsf(f / sizeProperty.GetVector3().width); - f = std::min(f, 1.0f); - f = 1.0f - (1.0f - f) * (1.0f - f); - // at center delay factor is mDelayMin, at maximum (1.0) it is mDelayMax - f = Rescale(f, 0.0f, 1.0f, mDelayMin, mDelayMax); - - // Will take 0.25s for current delay factor to equal target delay factor - // This prevents users quickly dragging from different points and noticing a jerk. - mCurrentDelayFactor = Chase( mCurrentDelayFactor, f, 4.0f/60.0f ); - float delay = activate * mCurrentDelayFactor; - mScrollPosition = mScrollPosition * delay + scrollPosition * (1.0f-delay); - - return current + mScrollPosition; - } - -private: - - Vector3 mScrollPosition; ///< The current scroll position - float mDelayMin; - float mDelayMax; - float mCurrentDelayFactor; - -}; - -/** - * ScrollTwistScaleConstraint - * - * Scale constraint adjusts the scale of the Actors - * based on a supplied depth property value. - */ -struct ScrollTwistScaleConstraint -{ - /** - * Constraint constructor - */ - ScrollTwistScaleConstraint(float scaleAmount) - : mScaleAmount(scaleAmount) - { - } - - /** - * @param[in] current The current position - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @return The new position of this Actor. - */ - Vector3 operator()(const Vector3& current, - const PropertyInput& depthProperty) - { - float depth = depthProperty.GetFloat(); - - return current * (1.0f - depth * mScaleAmount); // contract by mScaleAmount of original size. - } - -private: - - float mScaleAmount; -}; - -} // unnamed namespace - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ - -ScrollViewTwistEffect::ScrollViewTwistEffect() -: mFlags(DefaultFlags), - mPropertyTime(Property::INVALID_INDEX), - mEnableEffect(true), - mAdditionalEffects(false), - mPropertyReference(Property::INVALID_INDEX), - mPropertyActivate(Property::INVALID_INDEX), - mMinimumDistanceForShrink(Toolkit::ScrollViewTwistEffect::DEFAULT_MINIMUM_DISTANCE_FOR_SHRINK), - mMaxSwingAngle(Math::PI_2, Math::PI_2), - mDropOff(TWISTEFFECT_DEFAULT_DROPOFF, TWISTEFFECT_DEFAULT_DROPOFF), - mDropOffDistance(TWISTEFFECT_DEFAULT_DROPOFF_DISTANCE_X, TWISTEFFECT_DEFAULT_DROPOFF_DISTANCE_Y), - mDropOffFunction(NULL) -{ -} - -ScrollViewTwistEffect::~ScrollViewTwistEffect() -{ -} - - -float ScrollViewTwistEffect::GetMinimumDistanceForShrink() const -{ - return mMinimumDistanceForShrink; -} - -void ScrollViewTwistEffect::SetMinimumDistanceForShrink(float distance) -{ - mMinimumDistanceForShrink = distance; -} - -void ScrollViewTwistEffect::EnableEffect(bool enableFlag) -{ - mEnableEffect = enableFlag; -} - -void ScrollViewTwistEffect::ApplyToActor(Actor child, - bool additionalEffects, - const Vector2& angleSwing, - float scaleAmount, - float delayMin, - float delayMax) -{ - mMaxSwingAngle = angleSwing; - mAdditionalEffects = additionalEffects; - mScaleFactor = scaleAmount; - mDelayMin = delayMin; - mDelayMax = delayMax; - if(mFlags & FlagDefaultDropOff) - { - Vector3 size = GetScrollView().GetCurrentSize(); - // size may still be 0 if the effect is applied before scroll view hits the stage - if(size.x > Math::MACHINE_EPSILON_1) - { - mDropOffDistance.x = size.x; - } - if(size.y > Math::MACHINE_EPSILON_1) - { - mDropOffDistance.y = size.y; - } - } - if(scaleAmount > Math::MACHINE_EPSILON_0) - { - mFlags |= FlagScale; - } - else - { - mFlags = mFlags & ~FlagScale; - } - if(mMaxSwingAngle.LengthSquared() > Math::MACHINE_EPSILON_0) - { - mFlags |= FlagTwist; - } - else - { - mFlags = mFlags & ~FlagTwist; - } - Apply(child); -} - -void ScrollViewTwistEffect::Apply(Actor child) -{ - // Apply constraints to these actors // - Constraint constraint; - - Toolkit::ScrollView scrollView = GetScrollView(); - - if( mFlags & FlagScale ) - { - constraint = Constraint::New( Actor::SCALE, - Source(scrollView, scrollView.GetPropertyIndex( EFFECT_DEPTH ) ), - ScrollTwistScaleConstraint(mScaleFactor) ); - constraint.SetRemoveAction( Constraint::Discard ); - child.ApplyConstraint( constraint ); - } - - constraint = Constraint::New( Actor::POSITION, - ParentSource(Actor::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( EFFECT_REFERENCE ) ), - Source(scrollView, scrollView.GetPropertyIndex( EFFECT_TIME ) ), - Source(scrollView, Actor::SIZE), - Source(scrollView, scrollView.GetPropertyIndex( EFFECT_ACTIVATE) ), - ScrollTwistPositionConstraint(mDelayMin, mDelayMax) ); - constraint.SetRemoveAction( Constraint::Discard ); - child.ApplyConstraint( constraint ); - - // use actor position to affect rotation - if(mFlags & FlagTwist) - { - if(mFlags & FlagDropOff) - { - constraint = Constraint::New( Actor::ROTATION, - LocalSource(Actor::WORLD_POSITION), - Source(scrollView, Actor::WORLD_POSITION ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME ) ), - Source(scrollView, Actor::SIZE ), - ScrollDropoffTwistRotationConstraint(mMaxSwingAngle, mDropOff, mDropOffDistance, mDropOffFunction) ); - } - else - { - constraint = Constraint::New( Actor::ROTATION, - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME ) ), - ScrollTwistRotationConstraint(mMaxSwingAngle) ); - } - constraint.SetRemoveAction( Constraint::Discard ); - child.ApplyConstraint( constraint ); - } -} - -void ScrollViewTwistEffect::SetMaxSwingAngle(const Vector2& maxSwingAngle) -{ - mMaxSwingAngle = maxSwingAngle; -} - -Vector2 ScrollViewTwistEffect::GetMaxSwingAngle() const -{ - return mMaxSwingAngle; -} - -void ScrollViewTwistEffect::SetSwingDropOff(const Vector2& dropOff, const Vector2& distance, AlphaFunction function) -{ - if( distance.LengthSquared() > Math::MACHINE_EPSILON_1 && dropOff.LengthSquared() > Math::MACHINE_EPSILON_1 ) - { - mFlags |= FlagDropOff; - mDropOff = dropOff; - mDropOffDistance = distance; - mDropOffFunction = function; - } - else - { - mFlags = mFlags & ~FlagDropOff; - } - // can no longer use default dop off - mFlags = mFlags & ~FlagDefaultDropOff; -} - -void ScrollViewTwistEffect::GetSwingDropOff( Vector2& dropOff, Vector2& distance, AlphaFunction& function ) const -{ - dropOff = mDropOff; - distance = mDropOffDistance; - function = mDropOffFunction; -} - -void ScrollViewTwistEffect::OnAttach(Toolkit::ScrollView& scrollView) -{ - // Create effect-time property if not already created. - if(mPropertyTime == Property::INVALID_INDEX) - { - mPropertyTime = SafeRegisterProperty( scrollView, EFFECT_TIME, 0.0f ); - mPropertyReference = SafeRegisterProperty( scrollView, EFFECT_REFERENCE, Vector3::ZERO ); - mPropertyDepth = SafeRegisterProperty( scrollView, EFFECT_DEPTH, 0.0f); - mPropertyActivate = SafeRegisterProperty(scrollView, EFFECT_ACTIVATE, 0.0f); - } - // currently cant change overshoot snap back duration, use the constant one from ScrollView - mActivationTime = Toolkit::ScrollView::DEFAULT_SNAP_OVERSHOOT_DURATION; - - // Connect to the scroll view signals - scrollView.ScrollStartedSignal().Connect(this, &ScrollViewTwistEffect::OnScrollStart); - scrollView.SnapStartedSignal().Connect(this, &ScrollViewTwistEffect::OnScrollSnap); - scrollView.ScrollUpdatedSignal().Connect(this, &ScrollViewTwistEffect::OnScrollUpdate); - scrollView.ScrollCompletedSignal().Connect(this, &ScrollViewTwistEffect::OnScrollComplete); - - AttachActor(scrollView); -} - -void ScrollViewTwistEffect::OnDetach(Toolkit::ScrollView& scrollView) -{ - scrollView.ScrollStartedSignal().Disconnect(this, &ScrollViewTwistEffect::OnScrollStart); - scrollView.SnapStartedSignal().Disconnect(this, &ScrollViewTwistEffect::OnScrollSnap); - scrollView.ScrollUpdatedSignal().Disconnect(this, &ScrollViewTwistEffect::OnScrollUpdate); - scrollView.ScrollCompletedSignal().Disconnect(this, &ScrollViewTwistEffect::OnScrollComplete); - - if(mAnimation) - { - mAnimation.FinishedSignal().Disconnect(this, &ScrollViewTwistEffect::OnAnimationFinished); - mAnimation.Clear(); - mAnimation.Reset(); - } -} - -void ScrollViewTwistEffect::AttachActor(Actor actor) -{ - -} - -void ScrollViewTwistEffect::DetachActor(Actor actor) -{ - // TODO: remove the specific constraint defined in AttachActor (and possibly - // unregister property) - neither functionality exists in Dali. -} - -void ScrollViewTwistEffect::ContinueAnimation(float endTime) -{ - // continue animating - if(mAnimation) - { - mAnimation.FinishedSignal().Disconnect(this, &ScrollViewTwistEffect::OnAnimationFinished); - mAnimation.Clear(); - } - - Actor scrollView = GetScrollView(); - - mAnimation = Animation::New(TWISTEFFECT_ANIMATION_MAX_TIME); - mAnimation.AnimateTo( Property(scrollView, mPropertyTime), endTime, AlphaFunctions::Linear ); - mAnimation.FinishedSignal().Connect(this, &ScrollViewTwistEffect::OnAnimationFinished); - mAnimation.Play(); -} - -void ScrollViewTwistEffect::OnScrollStart( const Vector3& position ) -{ - if(mActivateAnimation) - { - // if the animation after Scroll complete not terminate before another scroll action, stop the animation before start again - mActivateAnimation.Stop(); - mActivateAnimation.Clear(); - mActivateAnimation = NULL; - } - - GetScrollView().SetProperty(mPropertyTime, 0.0f); - if(mEnableEffect) - { - GetScrollView().SetProperty(mPropertyActivate, 1.0f); - } - else - { - GetScrollView().SetProperty(mPropertyActivate, 0.0f); - } - GetScrollView().SetProperty(mPropertyReference, position); - - ContinueAnimation(TWISTEFFECT_ANIMATION_MAX_TIME); -} - -void ScrollViewTwistEffect::OnScrollUpdate( const Vector3& position ) -{ - // nothing to do -} - -void ScrollViewTwistEffect::OnScrollComplete( const Vector3& position ) -{ - if(!mEnableEffect) - { - OnActivateAnimationFinished(mAnimation); - return; - } - Actor scrollView = GetScrollView(); - scrollView.SetProperty(mPropertyActivate, 1.0f); - mActivateAnimation = Animation::New(mActivationTime); - mActivateAnimation.AnimateTo( Property(scrollView, mPropertyActivate), 0.0f, AlphaFunctions::Linear); - mActivateAnimation.FinishedSignal().Connect(this, &ScrollViewTwistEffect::OnActivateAnimationFinished); - mActivateAnimation.Play(); -} - -void ScrollViewTwistEffect::OnScrollSnap( const Toolkit::ScrollView::SnapEvent& event ) -{ - // If a Flicking snap is occuring and the distance is more than mMinimumDistanceForShrink - // then animate depth effect i.e. shrink actors and then bring back in to regular size. - // NOTE: ScrollView Snap returns a value opposite of GetCurrentScrollPosition - // i.e. if you've "scrolled 100 pixels right" (so content on screen has shifted 100 pixels left) - // then GetCurrentScrollPosition returns a positive value (100.0f, 0.0f) (position of where you're - // look, not where content has been moved to). - // event.position returns a negative value (-100.0f, 0.0f) - // Would be a good idea to change SnapEvent in the API so it reflects GetCurrentScrollPosition. - // TODO: Change scroll-view API, check if anything uses SnapEvent and change them correspondingly - Vector3 targetScrollPosition(-event.position); - - Vector3 delta = targetScrollPosition - GetScrollView().GetCurrentScrollPosition(); - - if(event.type==Flick && delta.Length() > mMinimumDistanceForShrink) - { - Actor scrollView = GetScrollView(); - - Animation animation = Animation::New(event.duration); - animation.AnimateTo( Property(scrollView, mPropertyDepth), 1.0f, HopEasing); - animation.Play(); - } -} - -void ScrollViewTwistEffect::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) + TWISTEFFECT_ANIMATION_MAX_TIME; - ContinueAnimation(endTime); -} - -void ScrollViewTwistEffect::OnActivateAnimationFinished( Animation& animation ) -{ - if(mAnimation) - { - mAnimation.FinishedSignal().Disconnect(this, &ScrollViewTwistEffect::OnAnimationFinished); - mAnimation.Clear(); - mAnimation.Reset(); - } -} - - -} // namespace Internal - -} // namespace Toolkit - -} // namespace Dali diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.h b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.h deleted file mode 100644 index 5aca6a0..0000000 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.h +++ /dev/null @@ -1,242 +0,0 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_TWIST_EFFECT_H__ -#define __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_TWIST_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. - * - */ - -// INTERNAL INCLUDES -#include -#include -#include -#include -#include -#include -#include - -namespace Dali -{ - -class Animation; - -namespace Toolkit -{ - -class ScrollView; - -namespace Internal -{ - -class ScrollViewEffect; - -/** - * @copydoc Toolkit::ScrollViewTwistEffect - */ -class ScrollViewTwistEffect : public ScrollViewEffect -{ - -public: - enum Flag - { - FlagTwist = 0x01, - FlagScale = 0x02, - FlagDropOff = 0x04, - FlagDefaultDropOff = 0x08, - DefaultFlags = FlagTwist | FlagDropOff | FlagDefaultDropOff - }; - - /** - * Constructor - */ - ScrollViewTwistEffect(); - -public: - - /** - * @copydoc ScrollViewEffect::GetMinimumDistanceForShrink - */ - float GetMinimumDistanceForShrink() const; - - /** - * @copydoc ScrollViewEffect::SetMinimumDistanceForShrink - */ - void SetMinimumDistanceForShrink(float distance); - - /** - * enable or disable this effect - * @param[in] enable when enableFlag is true, disable when enableFlag is false. - */ - void EnableEffect(bool enableFlag); - - /** - * @copydoc ScrollViewEffect::ApplyToActor - */ - void ApplyToActor( Actor child, - bool additionalEffects, - const Vector2& angleSwing, - float scaleAmount, - float delayMin, - float delayMax ); - - /** - * @copydoc Toolkit::ScrollViewEffect::Apply - */ - void Apply(Actor child); - - /** - * @copydoc Toolkit::ScrollViewEffect::SetMaxSwingAngle - */ - void SetMaxSwingAngle(const Vector2& maxSwingAngle); - - /** - * @copydoc Toolkit::ScrollViewEffect::GetMaxSwingAngle - */ - Vector2 GetMaxSwingAngle() const; - - /** - * @copydoc Toolkit::ScrollViewEffect::SetSwingDropOff - */ - void SetSwingDropOff(const Vector2& dropOff, const Vector2& distance, AlphaFunction function = NULL); - - /** - * @copydoc Toolkit::ScrollViewEffect::GetSwingDropOff - */ - void GetSwingDropOff( Vector2& dropOff, Vector2& distance, AlphaFunction& function ) const; - -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 ~ScrollViewTwistEffect(); - -private: - - /** - * 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 is moving - * - * @param[in] position The current scroll positionApply - */ - void OnScrollUpdate( const Vector3& position ); - - /** - * Signal handler, called when the ScrollView has completed movement - * - * @param[in] position The current scroll position - */ - void OnScrollComplete( const Vector3& position ); - - void OnScrollSnap( const Toolkit::ScrollView::SnapEvent& event ); - - /** - * Signal handler, called when the Wobble Effect animation has completed. - * - * @param[in] animation The animation. - */ - void OnAnimationFinished( Animation& animation ); - - void OnActivateAnimationFinished( 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: - - ushort mFlags; - Animation mAnimation; ///< Animation Timer to drive the twist effect constraint. - float mActivationTime; ///< Time taken for overshoot to reach zero, which is the time we need to allow effect to be active - Animation mActivateAnimation; - Property::Index mPropertyTime; ///< Time property used by twist effect constraint to calculate timePassed. - bool mEnableEffect; ///< flag that decide whether enable or disable the twist effect. - bool mAdditionalEffects; ///< whether we want to apply extra effects - Property::Index mPropertyReference; ///< Reference point in scroll-contents, this point has no delay. - Property::Index mPropertyActivate; ///::< The further out from this point, the further the delay. - Property::Index mPropertyDepth; ///< Depth property used by twist effect constraint to shrink Actors. - float mMinimumDistanceForShrink; ///< Scrolling animation must last for longer than this amount to do shrink effect.s - Vector2 mMaxSwingAngle; ///< Maximum swing angle to be applied to x and y axes - Vector2 mDropOff; ///< Amount to drop off the angle on each axis of drop off distance - Vector2 mDropOffDistance; ///< Distance to apply the full drop off over - AlphaFunction mDropOffFunction; ///< Function to adjust how drop off is aplied over the distance, NULL for linear - float mScaleFactor; ///< Amount to scale by during translation - float mDelayMin; - float mDelayMax; -}; - -} // namespace Internal - -// Helpers for public-api forwarding methods - -inline Internal::ScrollViewTwistEffect& GetImpl(Dali::Toolkit::ScrollViewTwistEffect& obj) -{ - DALI_ASSERT_ALWAYS(obj); - - Dali::RefObject& handle = obj.GetBaseObject(); - - return static_cast(handle); -} - -inline const Internal::ScrollViewTwistEffect& GetImpl(const Dali::Toolkit::ScrollViewTwistEffect& 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_TWIST_EFFECT_H__ diff --git a/base/dali-toolkit/internal/file.list b/base/dali-toolkit/internal/file.list index 5e8af9c..5083694 100644 --- a/base/dali-toolkit/internal/file.list +++ b/base/dali-toolkit/internal/file.list @@ -33,7 +33,6 @@ toolkit_base_src_files = \ $(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-twist-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/control-impl.cpp b/base/dali-toolkit/public-api/controls/control-impl.cpp index 65e0aa8..87e7a0d 100644 --- a/base/dali-toolkit/public-api/controls/control-impl.cpp +++ b/base/dali-toolkit/public-api/controls/control-impl.cpp @@ -749,7 +749,7 @@ void Control::SetBackground( Image image ) { // Remove Current actor, unset AFTER removal so that we do not inform deriving classes Self().Remove( background.actor ); - background.actor = NULL; + background.actor.Reset(); } ImageActor imageActor = ImageActor::New( image ); diff --git a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.cpp b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.cpp deleted file mode 100644 index 0472917..0000000 --- a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.cpp +++ /dev/null @@ -1,105 +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 -#include - -using namespace Dali; - -namespace Dali -{ - -namespace Toolkit -{ - -const float ScrollViewTwistEffect::DEFAULT_MINIMUM_DISTANCE_FOR_SHRINK( 0.0f ); - -ScrollViewTwistEffect ScrollViewTwistEffect::New() -{ - return ScrollViewTwistEffect(new Internal::ScrollViewTwistEffect()); -} - -ScrollViewTwistEffect::ScrollViewTwistEffect() -{ - -} - -ScrollViewTwistEffect::ScrollViewTwistEffect(Internal::ScrollViewTwistEffect *impl) -: ScrollViewEffect(impl) -{ -} - -ScrollViewTwistEffect ScrollViewTwistEffect::DownCast( BaseHandle handle ) -{ - return ScrollViewTwistEffect( dynamic_cast(handle.GetObjectPtr()) ); -} - -float ScrollViewTwistEffect::GetMinimumDistanceForShrink() const -{ - return GetImpl(*this).GetMinimumDistanceForShrink(); -} - -void ScrollViewTwistEffect::SetMinimumDistanceForShrink(float distance) -{ - GetImpl(*this).SetMinimumDistanceForShrink( distance ); -} - -void ScrollViewTwistEffect::EnableEffect(bool enableFlag) -{ - GetImpl(*this).EnableEffect(enableFlag); -} - -void ScrollViewTwistEffect::ApplyToActor( Actor child, - bool additionalEffects, - const Vector2& angleSwing, - float scaleAmount, - float delayMin, - float delayMax ) -{ - GetImpl(*this).ApplyToActor( child, - additionalEffects, - angleSwing, - scaleAmount, - delayMin, - delayMax ); -} - -void ScrollViewTwistEffect::SetMaxSwingAngle(const Vector2& maxSwingAngle) -{ - GetImpl(*this).SetMaxSwingAngle(maxSwingAngle); -} - -Vector2 ScrollViewTwistEffect::GetMaxSwingAngle() const -{ - return GetImpl( *this ).GetMaxSwingAngle(); -} - -void ScrollViewTwistEffect::SetSwingDropOff(const Vector2& dropOff, const Vector2& distance, AlphaFunction function) -{ - GetImpl(*this).SetSwingDropOff(dropOff, distance, function); -} - -void ScrollViewTwistEffect::GetSwingDropOff( Vector2& dropOff, Vector2& distance, AlphaFunction& function ) const -{ - GetImpl(*this).GetSwingDropOff(dropOff, distance, function); -} - -} // namespace Toolkit - -} // namespace Dali diff --git a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.h b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.h deleted file mode 100644 index d07839d..0000000 --- a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.h +++ /dev/null @@ -1,183 +0,0 @@ -#ifndef __DALI_TOOLKIT_SCROLL_VIEW_TWIST_EFFECT_H__ -#define __DALI_TOOLKIT_SCROLL_VIEW_TWIST_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 - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -class Actor; - -namespace Toolkit -{ - -class ScrollViewEffect; - -namespace Internal DALI_INTERNAL -{ -class ScrollViewTwistEffect; -} - -/** - * @brief ScrollView effect that twists pages onto screen when transitioning. - */ -class DALI_IMPORT_API ScrollViewTwistEffect : public ScrollViewEffect -{ - -public: - - static const float DEFAULT_MINIMUM_DISTANCE_FOR_SHRINK; ///< The min distance for shrink - -public: - - /** - * @brief Create an initialized ScrollViewTwistEffect. - * - * @return A handle to a newly allocated Dali resource. - */ - static ScrollViewTwistEffect New(); - - /** - * @brief Create an uninitialized ScrollViewTwistEffect; this can be initialized with ScrollViewTwistEffect::New(). - * - * Calling member functions with an uninitialized Toolkit::ScrollViewTwistEffect is not allowed. - */ - ScrollViewTwistEffect(); - - /** - * @brief Downcast an Object handle to ScrollViewTwistEffect. - * - * If handle points to a ScrollViewTwistEffect the - * downcast produces valid handle. If not the returned handle is left uninitialized. - * @param[in] handle Handle to an object - * @return handle to a ScrollViewTwistEffect or an uninitialized handle - */ - static ScrollViewTwistEffect DownCast( BaseHandle handle ); - - /** - * @brief Gets the minimum animation distance for the shrink effect to - * occur. - * - * @return The minimum distance in seconds is returned. - */ - float GetMinimumDistanceForShrink() const; - - /** - * @brief Sets the minimum animation distance for the shrink effect - * to occur. - * - * @param[in] distance The minimum distance in pixels (default = 0.0) - * i.e. any flick will result in shrinking. - */ - void SetMinimumDistanceForShrink(float distance); - - /** - * @brief Enable or disable this effect. - * - * @param[in] enableFlag Set to true if the effect should be enabled. - */ - void EnableEffect(bool enableFlag); - - /** - * @brief Manually apply effect to an Actor. - * - * @param[in] child The child Actor to be affected by this effect. - * @param[in] additionalEffects Whether just the basic effect (delay) - * should be applied. Or all effects (delay, rotation, scaling). - * For all effects set to true. Default is true i.e. apply all effects. - * @param[in] angleSwing The maximum amount the child actor should - * rotate in radians for each axis (X and Y) if the scrollview reaches - * overshoot. Default is PI/2 i.e. 90 degrees rotation. - * @param[in] scaleAmount The relative amount to shrink Actors as they - * are panned fast (flick animation). default is 0.125 (12.5% shrinkage) - * @param[in] delayMin The minimum delay coefficient for Actors at the - * scroll-view center. Set to 0 for instantaneous, and 1 for infinite delay. - * Default is 0.0f - * @param[in] delayMax The maximum delay coefficient for Actors at the - * scroll-view approx 1 ScrollView size from the center. Set to 0 for - * instantaneous, and 1 for infinite delay. Default is 0.9f (a slight delay) - */ - void ApplyToActor( Actor child, - bool additionalEffects = true, - const Vector2& angleSwing = Vector2( Math::PI_4, Math::PI_4 ), - float scaleAmount = 0.125f, - float delayMin = 0.0f, - float delayMax = 0.9f ); - - /** - * @brief Set the maximum swing angle when at zero drop off. - * - * @param[in] maxSwingAngle maximum swing angle for x and y axes - */ - void SetMaxSwingAngle(const Vector2& maxSwingAngle); - - /** - * @brief Retrieve the maximum swing angle when at zero drop off. - * - * @return The maximum swing angle for x and y axes - */ - Vector2 GetMaxSwingAngle() const; - - /** - * @brief Set the drop off values to affect the amount of swing - * angle applied to an actor the further it is from the scroll - * position. - * - * A drop off of 0.0f means no angle drop off while 1.0f will reduce - * the angle to zero over the distance supplied for that axis. - * - * Example maxSwingAngle.x is Pi, dropOff.x is 0.5f and distance.x is 100.0f: - * The angle on the x axis will reduce to (0.5f * Pi) over 100 pixels - * - * @param[in] dropOff amount to reduce swing angle by in the range [0.0f, 1.0f]. 0.0f - * @param[in] distance distance to apply dropOff in pixels - * @param[in] function Alpha Function to affect how drop off is applied over distance, NULL for linear application - */ - void SetSwingDropOff(const Vector2& dropOff, const Vector2& distance, AlphaFunction function = NULL); - - /** - * @brief Get the drop off values that affect the amount of swing angle that is applied to an actor. - * - * @param[out] dropOff The current drop-off amount. - * @param[out] distance The current distance to apply drop-off in pixels. - * @param[out] function The current alpha function used to affect how the drop iff is applied over the distance. - */ - void GetSwingDropOff( Vector2& dropOff, Vector2& distance, AlphaFunction& function ) const; - -protected: - - /** - * @brief This constructor is used by Dali New() methods. - * - * @param [in] impl A pointer to a newly allocated Dali resource - */ - explicit DALI_INTERNAL ScrollViewTwistEffect(Internal::ScrollViewTwistEffect *impl); - -}; - -} // namespace Toolkit - -} // namespace Dali - -#endif // __DALI_TOOLKIT_SCROLL_VIEW_TWIST_EFFECT_H__ diff --git a/base/dali-toolkit/public-api/file.list b/base/dali-toolkit/public-api/file.list index d497cea..44ee7aa 100755 --- a/base/dali-toolkit/public-api/file.list +++ b/base/dali-toolkit/public-api/file.list @@ -38,7 +38,6 @@ public_api_base_src_files = \ $(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-twist-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 \ @@ -113,8 +112,7 @@ public_api_base_scroll_view_header_files = \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-custom-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-twist-effect.h + $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-slide-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 0f49da3..75931b3 100644 --- a/optional/dali-toolkit/dali-toolkit.h +++ b/optional/dali-toolkit/dali-toolkit.h @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include