From 14455946a98df9b2f7cc5e9d5a972250da70a003 Mon Sep 17 00:00:00 2001 From: Joogab Yun Date: Tue, 23 Jun 2020 15:18:28 +0900 Subject: [PATCH] Refactoring Gestures Class Change-Id: I945af40bbb1a62177fe6bcfeda3c6a85396b90f3 --- .../src/dali-toolkit/utc-Dali-ScrollView.cpp | 12 ++++++++++++ .../src/dali-toolkit/utc-Dali-TextEditor.cpp | 16 ++++++++++++++++ .../accessibility-manager-impl.cpp | 22 ++++++++++------------ .../page-turn-view/page-turn-view-impl.cpp | 13 +++++++------ .../controls/scroll-bar/scroll-bar-impl.cpp | 13 ++++++------- .../internal/controls/scroll-bar/scroll-bar-impl.h | 2 +- .../scrollable/item-view/item-view-impl.cpp | 7 ++++--- .../scrollable/scroll-view/scroll-view-impl.cpp | 18 ++++++++++-------- .../internal/controls/slider/slider-impl.cpp | 6 +++--- .../controls/text-controls/text-editor-impl.cpp | 8 +++++--- .../controls/text-controls/text-field-impl.cpp | 8 +++++--- .../drag-and-drop-detector-impl.cpp | 14 ++++++++------ .../internal/text/decorator/text-decorator.cpp | 16 +++++++++------- .../internal/text/text-controller-impl.cpp | 0 dali-toolkit/public-api/controls/control-impl.cpp | 4 ++-- 15 files changed, 98 insertions(+), 61 deletions(-) mode change 100755 => 100644 dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp mode change 100755 => 100644 dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h mode change 100755 => 100644 dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp mode change 100755 => 100644 dali-toolkit/internal/controls/text-controls/text-field-impl.cpp mode change 100755 => 100644 dali-toolkit/internal/text/text-controller-impl.cpp diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp index 3d4fd83..ebba4e9 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp @@ -686,6 +686,18 @@ int UtcDaliToolkitScrollModeP1(void) // Confirm the final X coord has snapped to exactly one page ahead of the start page. DALI_TEST_EQUALS( viewPageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + // Change scroll mode during pan, should not crash + PerformGestureSwipe( application, startPos, direction, frames - 1, time, false ); + try + { + scrollView.SetScrollSensitive(false); + DALI_TEST_CHECK(true); + } + catch(...) + { + DALI_TEST_CHECK(false); + } + END_TEST; } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp index b01a27f..cb8d8bb 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -1745,6 +1745,13 @@ int utcDaliTextEditorEvent03(void) application.SendNotification(); application.Render(); + // Pan Press + TestGenerateMiniPan(application); + + // Render and notify + application.SendNotification(); + application.Render(); + END_TEST; } @@ -2416,6 +2423,15 @@ int utcDaliTextEditorHandles(void) application.SendNotification(); application.Render(); + // Pan the grab handle + uint32_t time = 100; + TestStartPan( application, Vector2(10.0f, 50.0f), Vector2(10.0f, 50.0f), time ); + TestMovePan( application, Vector2(10.0f, 30.0f), time ); + TestEndPan( application, Vector2(10.0f, 50.0f), time); + application.SendNotification(); + application.Render(); + + // Release the grab handle. event = Dali::Integration::TouchEvent(); event.AddPoint( GetPointUpInside( touchPos ) ); diff --git a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp index 2a6484b..b19ab8d 100644 --- a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp +++ b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include // INTERNAL INCLUDES @@ -1331,14 +1332,12 @@ bool AccessibilityManager::HandlePanGesture(const AccessibilityGestureEvent& pan Actor rootActor = Stage::GetCurrent().GetRootLayer(); - Dali::PanGesture pan( static_cast(panEvent.state) ); - - pan.time = panEvent.time; - pan.numberOfTouches = panEvent.numberOfTouches; - pan.screenPosition = panEvent.currentPosition; - pan.screenDisplacement = mPreviousPosition - panEvent.currentPosition; - pan.screenVelocity.x = pan.screenDisplacement.x / panEvent.timeDelta; - pan.screenVelocity.y = pan.screenDisplacement.y / panEvent.timeDelta; + Dali::PanGesture pan = DevelPanGesture::New( static_cast(panEvent.state) ); + DevelPanGesture::SetTime( pan, panEvent.time ); + DevelPanGesture::SetNumberOfTouches( pan, panEvent.numberOfTouches ); + DevelPanGesture::SetScreenPosition( pan, panEvent.currentPosition ); + DevelPanGesture::SetScreenDisplacement( pan, mPreviousPosition - panEvent.currentPosition ); + DevelPanGesture::SetScreenVelocity( pan, Vector2( pan.GetScreenDisplacement().x / panEvent.timeDelta, pan.GetScreenDisplacement().y / panEvent.timeDelta ) ); // Only handle the pan gesture when the current focused actor is scrollable or within a scrollable actor while(mCurrentGesturedActor && mCurrentGesturedActor != rootActor && !handled) @@ -1348,14 +1347,13 @@ bool AccessibilityManager::HandlePanGesture(const AccessibilityGestureEvent& pan { Vector2 localCurrent; control.ScreenToLocal( localCurrent.x, localCurrent.y, panEvent.currentPosition.x, panEvent.currentPosition.y ); - pan.position = localCurrent; + DevelPanGesture::SetPosition( pan, localCurrent ); Vector2 localPrevious; control.ScreenToLocal( localPrevious.x, localPrevious.y, mPreviousPosition.x, mPreviousPosition.y ); - pan.displacement = localCurrent - localPrevious; - pan.velocity.x = pan.displacement.x / panEvent.timeDelta; - pan.velocity.y = pan.displacement.y / panEvent.timeDelta; + DevelPanGesture::SetDisplacement( pan, localCurrent - localPrevious ); + DevelPanGesture::SetVelocity( pan, Vector2( pan.GetDisplacement().x / panEvent.timeDelta, pan.GetDisplacement().y / panEvent.timeDelta )); handled = GetImplementation( control ).OnAccessibilityPan(pan); } diff --git a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp index 4cba4af..2964578 100644 --- a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp +++ b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -612,19 +612,20 @@ void PageTurnView::RemovePage( int pageIndex ) void PageTurnView::OnPan( const PanGesture& gesture ) { // the pan gesture is attached to control itself instead of each page - switch( gesture.state ) + switch( gesture.GetState() ) { case Gesture::Started: { // check whether the undergoing turning page number already reaches the maximum allowed if( mPageUpdated && mAnimatingCount< MAXIMUM_TURNING_NUM && mSlidingCount < 1 ) { - SetPanActor( gesture.position ); // determine which page actor is panned + const Vector2& position = gesture.GetPosition(); + SetPanActor( position ); // determine which page actor is panned if( mTurningPageIndex != -1 && mPages[mTurningPageIndex % NUMBER_OF_CACHED_PAGES].actor.GetParent() != Self()) // if the page is added to turning layer,it is undergoing an animation currently { mTurningPageIndex = -1; } - PanStarted( SetPanPosition( gesture.position ) ); // pass in the pan position in the local page coordinate + PanStarted( SetPanPosition( position ) ); // pass in the pan position in the local page coordinate } else { @@ -634,13 +635,13 @@ void PageTurnView::OnPan( const PanGesture& gesture ) } case Gesture::Continuing: { - PanContinuing( SetPanPosition( gesture.position ) ); // pass in the pan position in the local page coordinate + PanContinuing( SetPanPosition( gesture.GetPosition() ) ); // pass in the pan position in the local page coordinate break; } case Gesture::Finished: case Gesture::Cancelled: { - PanFinished( SetPanPosition( gesture.position ), gesture.GetSpeed() ); + PanFinished( SetPanPosition( gesture.GetPosition() ), gesture.GetSpeed() ); break; } case Gesture::Clear: diff --git a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp old mode 100755 new mode 100644 index c4b2581..c588487 --- a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp +++ b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp @@ -195,7 +195,7 @@ ScrollBar::ScrollBar(Toolkit::ScrollBar::Direction direction) mIndicatorHideDuration(DEFAULT_INDICATOR_HIDE_DURATION), mTransientIndicatorDuration(DEFAULT_INDICATOR_TRANSIENT_DURATION), mScrollStart(0.0f), - mGestureDisplacement( Vector3::ZERO ), + mGestureDisplacement( Vector2::ZERO ), mCurrentScrollPosition(0.0f), mIndicatorHeightPolicy(Toolkit::ScrollBar::VARIABLE), mIndicatorFixedHeight(DEFAULT_INDICATOR_FIXED_HEIGHT), @@ -459,9 +459,9 @@ void ScrollBar::OnPan( const PanGesture& gesture ) { Dali::Toolkit::ItemView itemView = Dali::Toolkit::ItemView::DownCast(scrollableHandle); - switch(gesture.state) + switch(gesture.GetState()) { - case Gesture::Started: + case Dali::Gesture::Started: { if( !mPanProcessTimer ) { @@ -473,15 +473,14 @@ void ScrollBar::OnPan( const PanGesture& gesture ) ShowIndicator(); mScrollStart = scrollableHandle.GetCurrentProperty< float >( mPropertyScrollPosition ); - mGestureDisplacement = Vector3::ZERO; + mGestureDisplacement = Vector2::ZERO; mIsPanning = true; break; } - case Gesture::Continuing: + case Dali::Gesture::Continuing: { - mGestureDisplacement.x += gesture.displacement.x; - mGestureDisplacement.y += gesture.displacement.y; + mGestureDisplacement += gesture.GetDisplacement(); float minScrollPosition = scrollableHandle.GetCurrentProperty( mPropertyMinScrollPosition ); float maxScrollPosition = scrollableHandle.GetCurrentProperty( mPropertyMaxScrollPosition ); diff --git a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h old mode 100755 new mode 100644 index f56b9a0..3049227 --- a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h +++ b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h @@ -295,7 +295,7 @@ private: float mTransientIndicatorDuration; ///< The duration before hiding transient indicator float mScrollStart; ///< Scroll Start position (start of drag) - Vector3 mGestureDisplacement; ///< Gesture Displacement. + Vector2 mGestureDisplacement; ///< Gesture Displacement. float mCurrentScrollPosition; ///< The current scroll position updated by the pan gesture 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 939ab67..a06cee6 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 @@ -1159,7 +1159,7 @@ void ItemView::OnPan( const PanGesture& gesture ) return; } - mGestureState = gesture.state; + mGestureState = gesture.GetState(); switch (mGestureState) { @@ -1227,7 +1227,8 @@ void ItemView::OnPan( const PanGesture& gesture ) 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. @@ -1246,7 +1247,7 @@ void ItemView::OnPan( const PanGesture& gesture ) ( firstItemScrollPosition <= mActiveLayout->GetMinimumLayoutPosition(mItemFactory.GetNumberOfItems(), layoutSize) && currentOvershoot > -1.0f ) ) { - mTotalPanDisplacement += gesture.displacement; + mTotalPanDisplacement += displacement; } mScrollOvershoot = CalculateScrollOvershoot(); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp index 8b9d384..fb7e086 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include // INTERNAL INCLUDES @@ -1002,7 +1003,7 @@ void ScrollView::SetScrollSensitive(bool sensitive) // while the scroll view is panning, the state needs to be reset. if ( mPanning ) { - PanGesture cancelGesture( Gesture::Cancelled ); + PanGesture cancelGesture = DevelPanGesture::New( Gesture::Cancelled ); OnPan( cancelGesture ); } @@ -2478,17 +2479,18 @@ void ScrollView::OnPan( const PanGesture& gesture ) } // translate Gesture input to get useful data... - switch(gesture.state) + switch(gesture.GetState()) { case Gesture::Started: { DALI_LOG_SCROLL_STATE("[0x%X] Pan Started", this); - mPanStartPosition = gesture.position - gesture.displacement; + const Vector2& position = gesture.GetPosition(); + mPanStartPosition = position - gesture.GetDisplacement(); UpdateLocalScrollProperties(); GestureStarted(); mPanning = true; self.SetProperty( Toolkit::ScrollView::Property::PANNING, true ); - self.SetProperty( Toolkit::ScrollView::Property::START_PAGE_POSITION, Vector3(gesture.position.x, gesture.position.y, 0.0f) ); + self.SetProperty( Toolkit::ScrollView::Property::START_PAGE_POSITION, Vector3(position.x, position.y, 0.0f) ); UpdateMainInternalConstraint(); Toolkit::ScrollBar scrollBar = mScrollBar.GetHandle(); @@ -2511,7 +2513,7 @@ void ScrollView::OnPan( const PanGesture& gesture ) if ( mPanning ) { DALI_LOG_SCROLL_STATE("[0x%X] Pan Continuing", this); - GestureContinuing(gesture.screenDisplacement); + GestureContinuing(gesture.GetScreenDisplacement()); } else { @@ -2526,10 +2528,10 @@ void ScrollView::OnPan( const PanGesture& gesture ) { if ( mPanning ) { - DALI_LOG_SCROLL_STATE("[0x%X] Pan %s", this, ( ( gesture.state == Gesture::Finished ) ? "Finished" : "Cancelled" ) ); + DALI_LOG_SCROLL_STATE("[0x%X] Pan %s", this, ( ( gesture.GetState() == Gesture::Finished ) ? "Finished" : "Cancelled" ) ); UpdateLocalScrollProperties(); - mLastVelocity = gesture.velocity; + mLastVelocity = gesture.GetVelocity(); mPanning = false; self.SetProperty( Toolkit::ScrollView::Property::PANNING, false ); @@ -2561,7 +2563,7 @@ void ScrollView::OnPan( const PanGesture& gesture ) } // end switch(gesture.state) - OnGestureEx(gesture.state); + OnGestureEx(gesture.GetState()); } void ScrollView::OnGestureEx(Gesture::State state) diff --git a/dali-toolkit/internal/controls/slider/slider-impl.cpp b/dali-toolkit/internal/controls/slider/slider-impl.cpp index 757bef8..8879549 100644 --- a/dali-toolkit/internal/controls/slider/slider-impl.cpp +++ b/dali-toolkit/internal/controls/slider/slider-impl.cpp @@ -248,13 +248,13 @@ void Slider::OnPan( Actor actor, const PanGesture& gesture ) // gesture.position is in local actor coordinates if( mState != DISABLED ) { - switch( gesture.state ) + switch( gesture.GetState() ) { case Gesture::Continuing: { if( mState == PRESSED ) { - float value = MapBounds( MarkFilter ( MapPercentage( gesture.position ) ), GetLowerBound(), GetUpperBound() ); + float value = MapBounds( MarkFilter ( MapPercentage( gesture.GetPosition() ) ), GetLowerBound(), GetUpperBound() ); SetValue( value ); DisplayPopup( value ); } @@ -266,7 +266,7 @@ void Slider::OnPan( Actor actor, const PanGesture& gesture ) { if( GetSnapToMarks() ) { - float value = MapBounds( SnapToMark( MapPercentage( gesture.position ) ), GetLowerBound(), GetUpperBound() ); + float value = MapBounds( SnapToMark( MapPercentage( gesture.GetPosition() ) ), GetLowerBound(), GetUpperBound() ); SetValue( value ); DisplayPopup( value ); } diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp old mode 100755 new mode 100644 index 2579f68..a6c6267 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -1576,14 +1576,15 @@ void TextEditor::OnTap( const TapGesture& gesture ) // Deliver the tap before the focus event to controller; this allows us to detect when focus is gained due to tap-gestures Extents padding; padding = Self().GetProperty( Toolkit::Control::Property::PADDING ); - mController->TapEvent( gesture.numberOfTaps, gesture.localPoint.x - padding.start, gesture.localPoint.y - padding.top ); + const Vector2& localPoint = gesture.GetLocalPoint(); + mController->TapEvent( gesture.GetNumberOfTaps(), localPoint.x - padding.start, localPoint.y - padding.top ); SetKeyInputFocus(); } void TextEditor::OnPan( const PanGesture& gesture ) { - mController->PanEvent( gesture.state, gesture.displacement ); + mController->PanEvent( gesture.GetState(), gesture.GetDisplacement() ); } void TextEditor::OnLongPress( const LongPressGesture& gesture ) @@ -1594,7 +1595,8 @@ void TextEditor::OnLongPress( const LongPressGesture& gesture ) } Extents padding; padding = Self().GetProperty( Toolkit::Control::Property::PADDING ); - mController->LongPressEvent( gesture.state, gesture.localPoint.x - padding.start, gesture.localPoint.y - padding.top ); + const Vector2& localPoint = gesture.GetLocalPoint(); + mController->LongPressEvent( gesture.GetState(), localPoint.x - padding.start, localPoint.y - padding.top ); SetKeyInputFocus(); } diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp old mode 100755 new mode 100644 index 8f0381e..cd6eb21 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -1663,14 +1663,15 @@ void TextField::OnTap( const TapGesture& gesture ) // Deliver the tap before the focus event to controller; this allows us to detect when focus is gained due to tap-gestures Extents padding; padding = Self().GetProperty( Toolkit::Control::Property::PADDING ); - mController->TapEvent( gesture.numberOfTaps, gesture.localPoint.x - padding.start, gesture.localPoint.y - padding.top ); + const Vector2& localPoint = gesture.GetLocalPoint(); + mController->TapEvent( gesture.GetNumberOfTaps(), localPoint.x - padding.start, localPoint.y - padding.top ); SetKeyInputFocus(); } void TextField::OnPan( const PanGesture& gesture ) { - mController->PanEvent( gesture.state, gesture.displacement ); + mController->PanEvent( gesture.GetState(), gesture.GetDisplacement() ); } void TextField::OnLongPress( const LongPressGesture& gesture ) @@ -1681,7 +1682,8 @@ void TextField::OnLongPress( const LongPressGesture& gesture ) } Extents padding; padding = Self().GetProperty( Toolkit::Control::Property::PADDING ); - mController->LongPressEvent( gesture.state, gesture.localPoint.x - padding.start, gesture.localPoint.y - padding.top ); + const Vector2& localPoint = gesture.GetLocalPoint(); + mController->LongPressEvent( gesture.GetState(), localPoint.x - padding.start, localPoint.y - padding.top ); SetKeyInputFocus(); } diff --git a/dali-toolkit/internal/drag-drop-detector/drag-and-drop-detector-impl.cpp b/dali-toolkit/internal/drag-drop-detector/drag-and-drop-detector-impl.cpp index 12d42fe..5592004 100644 --- a/dali-toolkit/internal/drag-drop-detector/drag-and-drop-detector-impl.cpp +++ b/dali-toolkit/internal/drag-drop-detector/drag-and-drop-detector-impl.cpp @@ -123,9 +123,11 @@ void DragAndDropDetector::OnPan(Dali::Actor actor, const PanGesture& gesture) { Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor); - if(gesture.state == Gesture::Started) + Gesture::State state = gesture.GetState(); + + if(state == Gesture::Started) { - mDragLocalPosition = gesture.position; + mDragLocalPosition = gesture.GetPosition(); mPointDown = true; mDragControl = control; mFirstEnter.clear(); @@ -144,16 +146,16 @@ void DragAndDropDetector::OnPan(Dali::Actor actor, const PanGesture& gesture) mShadowControl.SetProperty( Actor::Property::PARENT_ORIGIN, control.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ) ); mShadowControl.SetProperty( Actor::Property::ANCHOR_POINT,control.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT )); control.GetParent().Add(mShadowControl); - SetPosition(gesture.screenPosition); + SetPosition(gesture.GetScreenPosition()); EmitStartedSignal(control); } - if(gesture.state == Gesture::Continuing) + if(state == Gesture::Continuing) { - Vector2 screenPosition = gesture.screenPosition; + Vector2 screenPosition = gesture.GetScreenPosition(); control.GetParent().ScreenToLocal(mLocalPosition.x, mLocalPosition.y, screenPosition.x, screenPosition.y); mShadowControl.SetProperty( Actor::Property::POSITION, Vector2(mLocalPosition.x - mDragLocalPosition.x, mLocalPosition.y - mDragLocalPosition.y)); } - if(gesture.state == Gesture::Finished) + if(state == Gesture::Finished) { mDragControl.GetParent().Remove(mShadowControl); EmitEndedSignal(control); diff --git a/dali-toolkit/internal/text/decorator/text-decorator.cpp b/dali-toolkit/internal/text/decorator/text-decorator.cpp index c22ffe7..e369158 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.cpp +++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp @@ -1259,7 +1259,8 @@ struct Decorator::Impl : public ConnectionTracker void DoPan( HandleImpl& handle, HandleType type, const PanGesture& gesture ) { - if( Gesture::Started == gesture.state ) + Gesture::State state = gesture.GetState(); + if( Gesture::Started == state ) { handle.grabDisplacementX = handle.grabDisplacementY = 0.f; @@ -1267,15 +1268,16 @@ struct Decorator::Impl : public ConnectionTracker handle.globalPosition.y = handle.position.y; } - handle.grabDisplacementX += gesture.displacement.x; - handle.grabDisplacementY += ( handle.verticallyFlipped ? -gesture.displacement.y : gesture.displacement.y ); + const Vector2& displacement = gesture.GetDisplacement(); + handle.grabDisplacementX += displacement.x; + handle.grabDisplacementY += ( handle.verticallyFlipped ? -displacement.y : displacement.y ); const float x = handle.globalPosition.x + handle.grabDisplacementX; const float y = handle.globalPosition.y + handle.grabDisplacementY + 0.5f * handle.lineHeight; const float yVerticallyFlippedCorrected = y - ( handle.verticallyFlippedOnTouch ? handle.lineHeight : 0.f ); - if( ( Gesture::Started == gesture.state ) || - ( Gesture::Continuing == gesture.state ) ) + if( ( Gesture::Started == state ) || + ( Gesture::Continuing == state ) ) { Vector2 targetSize; mController.GetTargetSize( targetSize ); @@ -1317,8 +1319,8 @@ struct Decorator::Impl : public ConnectionTracker mIsHandlePanning = true; } - else if( ( Gesture::Finished == gesture.state ) || - ( Gesture::Cancelled == gesture.state ) ) + else if( ( Gesture::Finished == state ) || + ( Gesture::Cancelled == state ) ) { if( mScrollTimer && ( mScrollTimer.IsRunning() || mNotifyEndOfScroll ) ) diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp old mode 100755 new mode 100644 diff --git a/dali-toolkit/public-api/controls/control-impl.cpp b/dali-toolkit/public-api/controls/control-impl.cpp index b66cdd6..5897750 100644 --- a/dali-toolkit/public-api/controls/control-impl.cpp +++ b/dali-toolkit/public-api/controls/control-impl.cpp @@ -507,12 +507,12 @@ void Control::OnPinch(const PinchGesture& pinch) mImpl->mStartingPinchScale = new Vector3; } - if( pinch.state == Gesture::Started ) + if( pinch.GetState() == Gesture::Started ) { *( mImpl->mStartingPinchScale ) = Self().GetCurrentProperty< Vector3 >( Actor::Property::SCALE ); } - Self().SetProperty( Actor::Property::SCALE, *( mImpl->mStartingPinchScale ) * pinch.scale ); + Self().SetProperty( Actor::Property::SCALE, *( mImpl->mStartingPinchScale ) * pinch.GetScale() ); } void Control::OnPan( const PanGesture& pan ) -- 2.7.4