Use new animatable registered properties in ScrollView
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scrollable / scroll-view / scroll-view-wobble-effect-impl.cpp
index 5e82f95..c8c669b 100644 (file)
@@ -1,19 +1,21 @@
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.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://floralicense.org/license/
-//
-// 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.
-//
+/*
+ * 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 <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h>
 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-wobble-effect-impl.h>
 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h>
@@ -174,9 +176,10 @@ struct ScrollViewWobbleEffectConstraint
 };
 
 ScrollViewWobbleEffect::ScrollViewWobbleEffect()
-: mPropertyTime(Property::INVALID_INDEX)
+: mPropertyTime(Property::INVALID_INDEX),
+  mStableCurrent(0),
+  mAnimationCycleId(0)
 {
-
 }
 
 ScrollViewWobbleEffect::~ScrollViewWobbleEffect()
@@ -228,10 +231,6 @@ void ScrollViewWobbleEffect::OnDetach(Toolkit::ScrollView& scrollView)
 
 void ScrollViewWobbleEffect::AttachActor(Actor actor)
 {
-  Property::Index propertyPosition = actor.GetPropertyIndex(Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME);
-  Property::Index propertyOvershootX = actor.GetPropertyIndex(Toolkit::ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME);
-  Property::Index propertyOvershootY = actor.GetPropertyIndex(Toolkit::ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME);
-
   // Create effect-overshoot property if not already created.
   Property::Index propertyEffectOvershoot = actor.GetPropertyIndex(Toolkit::ScrollViewWobbleEffect::EFFECT_OVERSHOOT);
   if(propertyEffectOvershoot == Property::INVALID_INDEX)
@@ -243,9 +242,9 @@ void ScrollViewWobbleEffect::AttachActor(Actor actor)
 
   Constraint constraint = Constraint::New<Vector3>( propertyEffectOvershoot,
                                                     Source(scrollView, mPropertyTime),
-                                                    Source(actor, propertyPosition),
-                                                    Source(actor, propertyOvershootX),
-                                                    Source(actor, propertyOvershootY),
+                                                    Source(actor, Toolkit::ScrollView::Property::SCROLL_POSITION),
+                                                    Source(actor, Toolkit::ScrollView::Property::OVERSHOOT_X),
+                                                    Source(actor, Toolkit::ScrollView::Property::OVERSHOOT_Y),
                                                     ScrollViewWobbleEffectConstraint(*this) );
   actor.ApplyConstraint(constraint);
 }