/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
-#include <dali/public-api/common/stage.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>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
+#include <dali-toolkit/devel-api/controls/scroll-bar/scroll-bar.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/default-item-layout.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/default-item-layout-property.h>
Actor self = Self();
// The ItemView size should match the active layout size
- self.SetSize(targetSize);
+ self.SetProperty( Actor::Property::SIZE, targetSize);
mActiveLayoutTargetSize = targetSize;
// Switch to the new layout
Vector3 size;
mActiveLayout->GetItemSize( itemId, targetSize, size );
- actor.SetSize( size.GetVectorXY() );
+ actor.SetProperty( Actor::Property::SIZE, size.GetVectorXY() );
}
// Refresh the new layout
{
Vector3 size;
mActiveLayout->GetItemSize( item.first, mActiveLayoutTargetSize, size );
- item.second.SetSize( size.GetVectorXY() );
+ item.second.SetProperty( Actor::Property::SIZE, size.GetVectorXY() );
mActiveLayout->ApplyConstraints( item.second, item.first, layoutSize, Self() );
}
{
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 );
return clamppedPosition;
}
-bool ItemView::OnTouch( Actor actor, const TouchData& touch )
+bool ItemView::OnTouch( Actor actor, const TouchEvent& touch )
{
// Ignore events with multiple-touch points
if (touch.GetPointCount() != 1)
RemoveAnimation(mScrollAnimation);
}
- return true; // consume since we're potentially scrolling
+ return false; // Do not consume as we're potentially scrolling (detecting pan gestures)
}
void ItemView::OnPan( const PanGesture& gesture )
return;
}
- mGestureState = gesture.state;
+ mGestureState = gesture.GetState();
switch (mGestureState)
{
case Gesture::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.
( firstItemScrollPosition <= mActiveLayout->GetMinimumLayoutPosition(mItemFactory.GetNumberOfItems(), layoutSize) &&
currentOvershoot > -1.0f ) )
{
- mTotalPanDisplacement += gesture.displacement;
+ mTotalPanDisplacement += displacement;
}
mScrollOvershoot = CalculateScrollOvershoot();
void ItemView::AddOverlay(Actor actor)
{
- actor.SetDrawMode( DrawMode::OVERLAY_2D );
+ actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
Self().Add(actor);
}
mOvershootOverlay.SetProperty( Actor::Property::COLOR,mOvershootEffectColor);
mOvershootOverlay.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT );
mOvershootOverlay.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- mOvershootOverlay.SetDrawMode( DrawMode::OVERLAY_2D );
+ mOvershootOverlay.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
self.Add(mOvershootOverlay);
ApplyOvershootSizeConstraint( mOvershootOverlay, mOvershootSize.height );