Merge remote-tracking branch 'origin/tizen' into devel/new_mesh
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / scrollable / scroll-view / scroll-view-constraints.cpp
index ac29e53..e7cec29 100644 (file)
@@ -1,18 +1,19 @@
-//
-// 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) 2015 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
 
@@ -29,44 +30,23 @@ namespace Dali
 namespace Toolkit
 {
 
-Vector3 MoveActorConstraint(const Vector3&    current,
-                            const PropertyInput& scrollPositionProperty)
+void MoveActorConstraint( Vector3& current, const PropertyInputContainer& inputs )
 {
-  return current + scrollPositionProperty.GetVector3();
+  current += inputs[0]->GetVector3();
 }
 
-Vector3 MoveScaledActorConstraint(const Vector3&    current,
-                                  const PropertyInput& scrollPositionProperty,
-                                  const PropertyInput& scrollScaleProperty)
+void WrapActorConstraint( Vector3& position, const PropertyInputContainer& inputs )
 {
-  return scrollScaleProperty.GetVector3() * (current + scrollPositionProperty.GetVector3());
-}
-
-Vector3 ScaleActorConstraint(const Vector3&    current,
-                             const PropertyInput& scrollScaleProperty)
-{
- return current * scrollScaleProperty.GetVector3();
-}
-
-Vector3 WrapActorConstraint(const Vector3&    current,
-                            const PropertyInput& actorScaleProperty,
-                            const PropertyInput& actorAnchorPointProperty,
-                            const PropertyInput& actorSizeProperty,
-                            const PropertyInput& scrollPositionMin,
-                            const PropertyInput& scrollPositionMax,
-                            const PropertyInput& scrollWrap)
-{
-  Vector3 position = current;
-  bool wrap = scrollWrap.GetBoolean();
+  bool wrap = inputs[5]->GetBoolean();
 
   if(wrap)
   {
-    const Vector3& min = scrollPositionMin.GetVector3();
-    const Vector3& max = scrollPositionMax.GetVector3();
+    const Vector3& min = inputs[3]->GetVector3();
+    const Vector3& max = inputs[4]->GetVector3();
 
-    const Vector3& anchor = actorAnchorPointProperty.GetVector3();
-    const Vector3 scale = actorScaleProperty.GetVector3();
-    const Vector3 size = actorSizeProperty.GetVector3();
+    const Vector3& anchor = inputs[1]->GetVector3();
+    const Vector3 scale = inputs[0]->GetVector3();
+    const Vector3 size = inputs[2]->GetVector3();
 
     if(fabsf(min.x - max.x) > Math::MACHINE_EPSILON_1)
     {
@@ -82,8 +62,6 @@ Vector3 WrapActorConstraint(const Vector3&    current,
       position.y = WrapInDomain(position.y + offsetY, min.y, max.y) - offsetY;
     }
   }
-
-  return position;
 }
 
 } // namespace Toolkit