X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fscrollable%2Fitem-view%2Fitem-view-impl.cpp;h=405e8198325e4db74d02125cdae882a04e793d8f;hb=10d2080e1d25b75347daa2f8c2dcee494fbcb175;hp=cee9c8cd23f46e84cc80d484914c203efe4e9d74;hpb=e217915091790637a8b4ea7e34480e852d242efd;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp index cee9c8c..405e819 100644 --- a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp @@ -28,21 +28,24 @@ #include #include #include +#include // INTERNAL INCLUDES #include -#include #include +#include using std::string; using std::set; using namespace Dali; -namespace // unnamed namespace +namespace // Unnamed namespace { //Type registration -TypeRegistration mType( typeid(Toolkit::ItemView), typeid(Toolkit::Scrollable), NULL ); + +DALI_TYPE_REGISTRATION_BEGIN( Toolkit::ItemView, Toolkit::Scrollable, NULL ) +DALI_TYPE_REGISTRATION_END() const float DEFAULT_MINIMUM_SWIPE_SPEED = 1.0f; const float DEFAULT_MINIMUM_SWIPE_DISTANCE = 3.0f; @@ -123,8 +126,7 @@ struct OvershootOverlayRotationConstraint const float parentOvershoot = parentOvershootProperty.GetFloat(); const Toolkit::ControlOrientation::Type& parentOrientation = static_cast(parentScrollDirection.z); - Quaternion rotation; - + float multiplier = 0; if(Toolkit::IsVertical(parentOrientation)) { if(fabsf(parentScrollDirection.y) <= Math::MACHINE_EPSILON_1) @@ -132,21 +134,21 @@ struct OvershootOverlayRotationConstraint if( (parentOrientation == Toolkit::ControlOrientation::Up && parentOvershoot < Math::MACHINE_EPSILON_0) || (parentOrientation == Toolkit::ControlOrientation::Down && parentOvershoot > Math::MACHINE_EPSILON_0) ) { - rotation = Quaternion(0.5f * Math::PI, Vector3::ZAXIS); + multiplier = 0.5f; } else { - rotation = Quaternion(1.5f * Math::PI, Vector3::ZAXIS); + multiplier = 1.5f; } } else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.y > Math::MACHINE_EPSILON_0) || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.y < Math::MACHINE_EPSILON_0) ) { - rotation = Quaternion(0.0f, Vector3::ZAXIS); + multiplier = 0.0f; } else { - rotation = Quaternion(Math::PI, Vector3::ZAXIS); + multiplier = 1.0f; } } else @@ -156,24 +158,26 @@ struct OvershootOverlayRotationConstraint if( (parentOrientation == Toolkit::ControlOrientation::Left && parentOvershoot > Math::MACHINE_EPSILON_0) ||(parentOrientation == Toolkit::ControlOrientation::Right && parentOvershoot < Math::MACHINE_EPSILON_0) ) { - rotation = Quaternion(Math::PI, Vector3::ZAXIS); + multiplier = 1.0f; } else { - rotation = Quaternion(0.0f, Vector3::ZAXIS); + multiplier = 0.0f; } } else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.x > Math::MACHINE_EPSILON_0) || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.x < Math::MACHINE_EPSILON_0) ) { - rotation = Quaternion(1.5f * Math::PI, Vector3::ZAXIS); + multiplier = 1.5f; } else { - rotation = Quaternion(0.5f * Math::PI, Vector3::ZAXIS); + multiplier = 0.5f; } } + Quaternion rotation( Radian( multiplier * Math::PI ), Vector3::ZAXIS ); + return rotation; } }; @@ -378,7 +382,7 @@ void ItemView::OnInitialize() LocalSource(mPropertyPosition), LocalSource(mPropertyPositionMin), LocalSource(mPropertyPositionMax), - LocalSource(Actor::SIZE), + LocalSource(Actor::Property::SIZE), RelativePositionConstraint); self.ApplyConstraint(constraint); @@ -1569,28 +1573,28 @@ void ItemView::SetOvershootEnabled( bool enable ) mOvershootOverlay.SetDrawMode(DrawMode::OVERLAY); self.Add(mOvershootOverlay); - Constraint constraint = Constraint::New( Actor::SIZE, + Constraint constraint = Constraint::New( Actor::Property::SIZE, ParentSource( mPropertyScrollDirection ), Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ), - ParentSource( Actor::SIZE ), + ParentSource( Actor::Property::SIZE ), OvershootOverlaySizeConstraint() ); mOvershootOverlay.ApplyConstraint(constraint); mOvershootOverlay.SetSize(OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.width, OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height); - constraint = Constraint::New( Actor::ROTATION, + constraint = Constraint::New( Actor::Property::ORIENTATION, ParentSource( mPropertyScrollDirection ), Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ), OvershootOverlayRotationConstraint() ); mOvershootOverlay.ApplyConstraint(constraint); - constraint = Constraint::New( Actor::POSITION, - ParentSource( Actor::SIZE ), + constraint = Constraint::New( Actor::Property::POSITION, + ParentSource( Actor::Property::SIZE ), ParentSource( mPropertyScrollDirection ), Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ), OvershootOverlayPositionConstraint() ); mOvershootOverlay.ApplyConstraint(constraint); - constraint = Constraint::New( Actor::VISIBLE, + constraint = Constraint::New( Actor::Property::VISIBLE, ParentSource( mPropertyCanScrollVertical ), OvershootOverlayVisibilityConstraint() ); mOvershootOverlay.ApplyConstraint(constraint);