[problem] Displacement value passed into constraint could be a frame behind, meaning we lose the initial pan started frame displacement
[cause] Update thread was already running at same time as event thread called ApplyConstraint
[solution] Instead of passing in displacement as a property input, create the constraint with event side pan start position
Change-Id: I0ee55c79b8450cdc68f8e04dad4019001b65966f
Signed-off-by: Julien Heanley <j.heanley@partner.samsung.com>
Signed-off-by: Adeel Kazmi <adeel.kazmi@samsung.com>
*/
struct InternalPrePositionConstraint
{
*/
struct InternalPrePositionConstraint
{
- InternalPrePositionConstraint(const Vector2& initialPanMask,
+ InternalPrePositionConstraint(const Vector2& initialPanPosition,
+ const Vector2& initialPanMask,
bool axisAutoLock,
float axisAutoLockGradient,
ScrollView::LockAxis initialLockAxis,
const Vector2& maxOvershoot,
const RulerDomain& domainX, const RulerDomain& domainY)
bool axisAutoLock,
float axisAutoLockGradient,
ScrollView::LockAxis initialLockAxis,
const Vector2& maxOvershoot,
const RulerDomain& domainX, const RulerDomain& domainY)
- : mInitialPanMask(initialPanMask),
+ : mLocalStart(initialPanPosition),
+ mInitialPanMask(initialPanMask),
mDomainMin( -domainX.min, -domainY.min ),
mDomainMax( -domainX.max, -domainY.max ),
mMaxOvershoot(maxOvershoot),
mDomainMin( -domainX.min, -domainY.min ),
mDomainMax( -domainX.max, -domainY.max ),
mMaxOvershoot(maxOvershoot),
Vector3 operator()(const Vector3& current,
const PropertyInput& gesturePositionProperty,
Vector3 operator()(const Vector3& current,
const PropertyInput& gesturePositionProperty,
- const PropertyInput& gestureDisplacementProperty,
const PropertyInput& sizeProperty)
{
Vector3 scrollPostPosition = current;
const PropertyInput& sizeProperty)
{
Vector3 scrollPostPosition = current;
- mLocalStart = gesturePositionProperty.GetVector2() - gestureDisplacementProperty.GetVector2();
mPrePosition = current;
mCurrentPanMask = mInitialPanMask;
mWasPanning = true;
mPrePosition = current;
mCurrentPanMask = mInitialPanMask;
mWasPanning = true;
case Gesture::Started:
{
DALI_LOG_SCROLL_STATE("[0x%X] Pan Started", this);
case Gesture::Started:
{
DALI_LOG_SCROLL_STATE("[0x%X] Pan Started", this);
+ mPanStartPosition = gesture.position - gesture.displacement;
UpdateLocalScrollProperties();
GestureStarted();
mPanning = true;
UpdateLocalScrollProperties();
GestureStarted();
mPanning = true;
{
constraint = Constraint::New<Vector3>( mPropertyPrePosition,
Source( detector, PanGestureDetector::LOCAL_POSITION ),
{
constraint = Constraint::New<Vector3>( mPropertyPrePosition,
Source( detector, PanGestureDetector::LOCAL_POSITION ),
- Source( detector, PanGestureDetector::LOCAL_DISPLACEMENT ),
Source( self, Actor::SIZE ),
Source( self, Actor::SIZE ),
- InternalPrePositionConstraint( initialPanMask, mAxisAutoLock, mAxisAutoLockGradient, mLockAxis, mMaxOvershoot, mRulerX->GetDomain(), mRulerY->GetDomain() ) );
+ InternalPrePositionConstraint( mPanStartPosition, initialPanMask, mAxisAutoLock, mAxisAutoLockGradient, mLockAxis, mMaxOvershoot, mRulerX->GetDomain(), mRulerY->GetDomain() ) );
mScrollMainInternalPrePositionConstraint = self.ApplyConstraint( constraint );
}
mScrollMainInternalPrePositionConstraint = self.ApplyConstraint( constraint );
}
unsigned long mTouchDownTime; ///< The touch down time
int mGestureStackDepth; ///< How many gestures are currently occuring.
unsigned long mTouchDownTime; ///< The touch down time
int mGestureStackDepth; ///< How many gestures are currently occuring.
+ Vector2 mPanStartPosition; ///< Where the pan gesture's touch down occured
Vector3 mPanDelta; ///< Amount currently panned.
unsigned int mScrollStateFlags; ///< flags indicating current state of scrolling
Vector3 mPanDelta; ///< Amount currently panned.
unsigned int mScrollStateFlags; ///< flags indicating current state of scrolling