X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fscrollable%2Fscroll-view%2Fscroll-view.cpp;h=471f37114ed440647ef0ba104b2dd5515e898354;hp=be7a991d9cf374ffd6f8b9961bb365340e8dbf46;hb=b7847ff75f88d0ce9bf0bb2e03e338218a446671;hpb=6e824d3bfb11cab305d0d8375b202076d59222b0 diff --git a/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp b/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp index be7a991..471f371 100644 --- a/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp +++ b/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * 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. @@ -190,7 +190,7 @@ FixedRuler::FixedRuler(float spacing) { if(fabsf(mSpacing) <= Math::MACHINE_EPSILON_1) { - DALI_LOG_ERROR( "Page spacing too small (%f).", double(spacing) ); + DALI_LOG_ERROR( "Page spacing too small (%f).\n", double(spacing) ); mSpacing = spacing >= 0.0f ? Math::MACHINE_EPSILON_1 : -Math::MACHINE_EPSILON_1; } mType = Fixed; @@ -248,7 +248,7 @@ unsigned int FixedRuler::GetPageFromPosition(float position, bool wrap) const { position = WrapInDomain(position, mDomain.min, mDomain.max); } - page = floor((position - mDomain.min) / mSpacing + 0.5f); + page = std::max(static_cast(0.0f), static_cast(floor((position - mDomain.min) / mSpacing + 0.5f))); if(wrap) { @@ -257,7 +257,7 @@ unsigned int FixedRuler::GetPageFromPosition(float position, bool wrap) const if(pagesPerVolume < 1u) { pagesPerVolume = 1u; - DALI_LOG_ERROR("Ruler domain(%f) is smaller than its spacing(%f).", mDomain.GetSize() * 1.0, mSpacing * 1.0 ); + DALI_LOG_ERROR("Ruler domain(%f) is smaller than its spacing(%f).\n", mDomain.GetSize() * 1.0, mSpacing * 1.0 ); } page %= pagesPerVolume; } @@ -283,16 +283,6 @@ unsigned int FixedRuler::GetTotalPages() const // ScrollView /////////////////////////////////////////////////////////////////////////////////////////////////// -const float ScrollView::DEFAULT_SLOW_SNAP_ANIMATION_DURATION(0.5f); -const float ScrollView::DEFAULT_FAST_SNAP_ANIMATION_DURATION(0.25f); -const float ScrollView::DEFAULT_SNAP_OVERSHOOT_DURATION(0.5f); -const float ScrollView::DEFAULT_MAX_OVERSHOOT(100.0f); // 100 pixels - -const float ScrollView::DEFAULT_AXIS_AUTO_LOCK_GRADIENT(0.36f); -const float ScrollView::DEFAULT_FRICTION_COEFFICIENT(1.0f); -const float ScrollView::DEFAULT_FLICK_SPEED_COEFFICIENT(1.0f); -const float ScrollView::DEFAULT_MAX_FLICK_SPEED(3.0f); - ScrollView::ScrollView() { } @@ -496,53 +486,48 @@ void ScrollView::SetMaxFlickSpeed(float speed) GetImpl(*this).SetMaxFlickSpeed(speed); } -Vector2 ScrollView::GetMouseWheelScrollDistanceStep() const +Vector2 ScrollView::GetWheelScrollDistanceStep() const { - return GetImpl(*this).GetMouseWheelScrollDistanceStep(); + return GetImpl(*this).GetWheelScrollDistanceStep(); } -void ScrollView::SetMouseWheelScrollDistanceStep(Vector2 step) +void ScrollView::SetWheelScrollDistanceStep(Vector2 step) { - GetImpl(*this).SetMouseWheelScrollDistanceStep(step); + GetImpl(*this).SetWheelScrollDistanceStep(step); } -Vector3 ScrollView::GetCurrentScrollPosition() const +Vector2 ScrollView::GetCurrentScrollPosition() const { return GetImpl(*this).GetCurrentScrollPosition(); } -void ScrollView::SetScrollPosition(const Vector3& position) -{ - GetImpl(*this).SetScrollPosition(position); -} - unsigned int ScrollView::GetCurrentPage() const { return GetImpl(*this).GetCurrentPage(); } -void ScrollView::ScrollTo(const Vector3 &position) +void ScrollView::ScrollTo(const Vector2 &position) { GetImpl(*this).ScrollTo(position); } -void ScrollView::ScrollTo(const Vector3 &position, float duration) +void ScrollView::ScrollTo(const Vector2 &position, float duration) { GetImpl(*this).ScrollTo(position, duration); } -void ScrollView::ScrollTo(const Vector3 &position, float duration, AlphaFunction alpha) +void ScrollView::ScrollTo(const Vector2 &position, float duration, AlphaFunction alpha) { GetImpl(*this).ScrollTo(position, duration, alpha); } -void ScrollView::ScrollTo(const Vector3 &position, float duration, +void ScrollView::ScrollTo(const Vector2 &position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias) { GetImpl(*this).ScrollTo(position, duration, horizontalBias, verticalBias); } -void ScrollView::ScrollTo(const Vector3 &position, float duration, AlphaFunction alpha, +void ScrollView::ScrollTo(const Vector2 &position, float duration, AlphaFunction alpha, DirectionBias horizontalBias, DirectionBias verticalBias) { GetImpl(*this).ScrollTo(position, duration, alpha, horizontalBias, verticalBias);