-//
-// 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/public-api/controls/scrollable/item-view/grid-layout.h>
+// EXTERNAL INCLUDES
#include <algorithm>
-
-#include <dali-toolkit/public-api/controls/scrollable/item-view/grid-layout.h>
+#include <dali/public-api/animation/animation.h>
using namespace Dali;
using namespace Dali::Toolkit;
-using namespace std;
namespace // unnamed namespace
{
{
Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
{
- return Quaternion(0.0f, Vector3::ZAXIS);
+ return Quaternion( Radian( 0.0f ), Vector3::ZAXIS);
}
};
{
Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
{
- return Quaternion(1.5f * Math::PI, Vector3::ZAXIS);
+ return Quaternion( Radian( 1.5f * Math::PI ), Vector3::ZAXIS);
}
};
{
Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
{
- return Quaternion(Math::PI, Vector3::ZAXIS);
+ return Quaternion( Radian( Math::PI ), Vector3::ZAXIS);
}
};
{
Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
{
- return Quaternion(0.5f * Math::PI, Vector3::ZAXIS);
+ return Quaternion( Radian( 0.5f * Math::PI ), Vector3::ZAXIS);
}
};
mTopMargin(DEFAULT_TOP_MARGIN),
mBottomMargin(DEFAULT_BOTTOM_MARGIN),
mSideMargin(DEFAULT_SIDE_MARGIN),
+ mZGap(0.f),
mScrollSpeedFactor(DEFAULT_SCROLL_SPEED_FACTOR),
mMaximumSwipeSpeed(DEFAULT_MAXIMUM_SWIPE_SPEED),
mItemFlickAnimationDuration(DEFAULT_ITEM_FLICK_ANIMATION_DURATION),
Vector3 currentSize( actor.GetCurrentSize() );
Vector3 shrink( currentSize );
- shrink.width = min(size.width, currentSize.width);
- shrink.height = min(size.height, currentSize.height);
+ shrink.width = std::min(size.width, currentSize.width);
+ shrink.height = std::min(size.height, currentSize.height);
// Do a nonlinear size animation to shrink the actor first when the actor size changes,
// so that we can avoid the actors overlapping during orientation change.
- animation.Resize( actor, shrink, AlphaFunctions::EaseOut, 0.0f, durationSeconds * 0.5f );
- animation.Resize( actor, size, AlphaFunctions::EaseIn, 0.0f, durationSeconds );
- animation.SetDestroyAction( Animation::Bake );
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE ), shrink, AlphaFunction::EASE_OUT, TimePeriod( 0.0f, durationSeconds * 0.5f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size, AlphaFunction::EASE_IN, TimePeriod( 0.0f, durationSeconds ) );
}
}
if (mOrientation == ControlOrientation::Up)
{
- scrollDirection = 0.0f;
+ scrollDirection = Degree( 0.0f );
}
else if (mOrientation == ControlOrientation::Left)
{
- scrollDirection = 90.0f;
+ scrollDirection = Degree( 90.0f );
}
else if (mOrientation == ControlOrientation::Down)
{
- scrollDirection = 180.0f;
+ scrollDirection = Degree( 180.0f );
}
else // mOrientation == ControlOrientation::Right
{
- scrollDirection = 270.0f;
+ scrollDirection = Degree( 270.0f );
}
return scrollDirection;