projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[dali_1.9.29] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git]
/
dali-toolkit
/
internal
/
controls
/
scrollable
/
item-view
/
item-view-impl.cpp
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
0d40921
..
c442fb8
100644
(file)
--- a/
dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp
+++ b/
dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp
@@
-27,7
+27,7
@@
#include <dali/public-api/animation/constraints.h>
#include <dali/devel-api/common/stage.h>
#include <dali/public-api/events/wheel-event.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/devel-api/common/stage.h>
#include <dali/public-api/events/wheel-event.h>
-#include <dali/public-api/events/touch-
data
.h>
+#include <dali/public-api/events/touch-
event
.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/devel-api/object/property-helper-devel.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/devel-api/object/property-helper-devel.h>
@@
-333,7
+333,7
@@
Dali::Toolkit::ItemView ItemView::New(ItemFactory& factory)
}
ItemView::ItemView(ItemFactory& factory)
}
ItemView::ItemView(ItemFactory& factory)
-: Scrollable( ControlBehaviour( DISABLE_SIZE_NEGOTIATION | DISABLE_STYLE_CHANGE_SIGNALS | REQUIRES_
WHEEL_EVENTS | REQUIRES_
KEYBOARD_NAVIGATION_SUPPORT ) ),
+: Scrollable( ControlBehaviour( DISABLE_SIZE_NEGOTIATION | DISABLE_STYLE_CHANGE_SIGNALS | REQUIRES_KEYBOARD_NAVIGATION_SUPPORT ) ),
mItemFactory(factory),
mItemsParentOrigin(ParentOrigin::CENTER),
mItemsAnchorPoint(AnchorPoint::CENTER),
mItemFactory(factory),
mItemsParentOrigin(ParentOrigin::CENTER),
mItemsAnchorPoint(AnchorPoint::CENTER),
@@
-347,7
+347,7
@@
ItemView::ItemView(ItemFactory& factory)
mScrollDistance(0.0f),
mScrollSpeed(0.0f),
mScrollOvershoot(0.0f),
mScrollDistance(0.0f),
mScrollSpeed(0.0f),
mScrollOvershoot(0.0f),
- mGestureState(Gesture
::Clear
),
+ mGestureState(Gesture
State::CLEAR
),
mAnimatingOvershootOn(false),
mAnimateOvershootOff(false),
mAnchoringEnabled(false),
mAnimatingOvershootOn(false),
mAnimateOvershootOff(false),
mAnchoringEnabled(false),
@@
-367,13
+367,16
@@
void ItemView::OnInitialize()
Vector2 stageSize = Stage::GetCurrent().GetSize();
mWheelScrollDistanceStep = stageSize.y * DEFAULT_WHEEL_SCROLL_DISTANCE_STEP_PROPORTION;
Vector2 stageSize = Stage::GetCurrent().GetSize();
mWheelScrollDistanceStep = stageSize.y * DEFAULT_WHEEL_SCROLL_DISTANCE_STEP_PROPORTION;
- self.TouchSignal().Connect( this, &ItemView::OnTouch );
- EnableGestureDetection(Gesture
::Type(Gesture::Pan
));
+ self.Touch
ed
Signal().Connect( this, &ItemView::OnTouch );
+ EnableGestureDetection(Gesture
Type::Value(GestureType::PAN
));
mWheelEventFinishedTimer = Timer::New( WHEEL_EVENT_FINISHED_TIME_OUT );
mWheelEventFinishedTimer.TickSignal().Connect( this, &ItemView::OnWheelEventFinished );
SetRefreshInterval(DEFAULT_REFRESH_INTERVAL_LAYOUT_POSITIONS);
mWheelEventFinishedTimer = Timer::New( WHEEL_EVENT_FINISHED_TIME_OUT );
mWheelEventFinishedTimer.TickSignal().Connect( this, &ItemView::OnWheelEventFinished );
SetRefreshInterval(DEFAULT_REFRESH_INTERVAL_LAYOUT_POSITIONS);
+
+ // Connect wheel event
+ self.WheelEventSignal().Connect( this, &ItemView::OnWheelEvent );
}
ItemView::~ItemView()
}
ItemView::~ItemView()
@@
-1022,14
+1025,14
@@
void ItemView::OnChildAdd(Actor& child)
Scrollable::OnChildAdd( child );
}
Scrollable::OnChildAdd( child );
}
-bool ItemView::OnWheelEvent(const WheelEvent& event)
+bool ItemView::OnWheelEvent(
Actor actor,
const WheelEvent& event)
{
// Respond the wheel event to scroll
if (mActiveLayout)
{
Actor self = Self();
const Vector3 layoutSize = Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
{
// Respond the wheel event to scroll
if (mActiveLayout)
{
Actor self = Self();
const Vector3 layoutSize = Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
- float layoutPositionDelta = GetCurrentLayoutPosition(0) - (event.
z
* mWheelScrollDistanceStep * mActiveLayout->GetScrollSpeedFactor());
+ float layoutPositionDelta = GetCurrentLayoutPosition(0) - (event.
GetDelta()
* mWheelScrollDistanceStep * mActiveLayout->GetScrollSpeedFactor());
float firstItemScrollPosition = ClampFirstItemPosition(layoutPositionDelta, layoutSize, *mActiveLayout);
self.SetProperty(Toolkit::ItemView::Property::LAYOUT_POSITION, firstItemScrollPosition );
float firstItemScrollPosition = ClampFirstItemPosition(layoutPositionDelta, layoutSize, *mActiveLayout);
self.SetProperty(Toolkit::ItemView::Property::LAYOUT_POSITION, firstItemScrollPosition );
@@
-1114,7
+1117,7
@@
float ItemView::ClampFirstItemPosition( float targetPosition, const Vector3& tar
return clamppedPosition;
}
return clamppedPosition;
}
-bool ItemView::OnTouch( Actor actor, const Touch
Data
& touch )
+bool ItemView::OnTouch( Actor actor, const Touch
Event
& touch )
{
// Ignore events with multiple-touch points
if (touch.GetPointCount() != 1)
{
// Ignore events with multiple-touch points
if (touch.GetPointCount() != 1)
@@
-1125,7
+1128,7
@@
bool ItemView::OnTouch( Actor actor, const TouchData& touch )
if ( touch.GetState( 0 ) == PointState::DOWN )
{
// Cancel ongoing scrolling etc.
if ( touch.GetState( 0 ) == PointState::DOWN )
{
// Cancel ongoing scrolling etc.
- mGestureState = Gesture
::Clear
;
+ mGestureState = Gesture
State::CLEAR
;
mScrollDistance = 0.0f;
mScrollSpeed = 0.0f;
mScrollDistance = 0.0f;
mScrollSpeed = 0.0f;
@@
-1155,15
+1158,15
@@
void ItemView::OnPan( const PanGesture& gesture )
// Short-circuit if there is no active layout
if (!mActiveLayout)
{
// Short-circuit if there is no active layout
if (!mActiveLayout)
{
- mGestureState = Gesture
::Clear
;
+ mGestureState = Gesture
State::CLEAR
;
return;
}
return;
}
- mGestureState = gesture.
state
;
+ mGestureState = gesture.
GetState()
;
switch (mGestureState)
{
switch (mGestureState)
{
- case Gesture
::Finished
:
+ case Gesture
State::FINISHED
:
{
// Swipe Detection
if (fabsf(mScrollDistance) > mMinimumSwipeDistance &&
{
// Swipe Detection
if (fabsf(mScrollDistance) > mMinimumSwipeDistance &&
@@
-1218,16
+1221,17
@@
void ItemView::OnPan( const PanGesture& gesture )
}
break;
}
break;
- case Gesture
::Started
: // Fall through
+ case Gesture
State::STARTED
: // Fall through
{
mTotalPanDisplacement = Vector2::ZERO;
mScrollStartedSignal.Emit(GetCurrentScrollPosition());
mRefreshEnabled = true;
}
{
mTotalPanDisplacement = Vector2::ZERO;
mScrollStartedSignal.Emit(GetCurrentScrollPosition());
mRefreshEnabled = true;
}
- case Gesture
::Continuing
:
+ case Gesture
State::CONTINUING
:
{
{
- mScrollDistance = CalculateScrollDistance(gesture.displacement, *mActiveLayout);
+ const Vector2& displacement = gesture.GetDisplacement();
+ mScrollDistance = CalculateScrollDistance(displacement, *mActiveLayout);
mScrollSpeed = Clamp((gesture.GetSpeed() * gesture.GetSpeed() * mActiveLayout->GetFlickSpeedFactor() * MILLISECONDS_PER_SECONDS), 0.0f, mActiveLayout->GetMaximumSwipeSpeed());
// Refresh order depends on the direction of the scroll; negative is towards the last item.
mScrollSpeed = Clamp((gesture.GetSpeed() * gesture.GetSpeed() * mActiveLayout->GetFlickSpeedFactor() * MILLISECONDS_PER_SECONDS), 0.0f, mActiveLayout->GetMaximumSwipeSpeed());
// Refresh order depends on the direction of the scroll; negative is towards the last item.
@@
-1246,7
+1250,7
@@
void ItemView::OnPan( const PanGesture& gesture )
( firstItemScrollPosition <= mActiveLayout->GetMinimumLayoutPosition(mItemFactory.GetNumberOfItems(), layoutSize) &&
currentOvershoot > -1.0f ) )
{
( firstItemScrollPosition <= mActiveLayout->GetMinimumLayoutPosition(mItemFactory.GetNumberOfItems(), layoutSize) &&
currentOvershoot > -1.0f ) )
{
- mTotalPanDisplacement +=
gesture.
displacement;
+ mTotalPanDisplacement += displacement;
}
mScrollOvershoot = CalculateScrollOvershoot();
}
mScrollOvershoot = CalculateScrollOvershoot();
@@
-1277,7
+1281,7
@@
void ItemView::OnPan( const PanGesture& gesture )
}
break;
}
break;
- case Gesture
::Cancelled
:
+ case Gesture
State::CANCELLED
:
{
mScrollAnimation = DoAnchoring();
}
{
mScrollAnimation = DoAnchoring();
}