X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fevents%2Fpan-gesture-processor.cpp;h=1762821611ea8af75e9a7abb16c074c70813e577;hb=cd0ce6e412df8961b1a5e28b496369fa49fd72d7;hp=dd908c71afa31bd59742f33143d6114f28df2d41;hpb=42817118997121ad95340a14c34e17e1b904b3fe;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/events/pan-gesture-processor.cpp b/dali/internal/event/events/pan-gesture-processor.cpp index dd908c7..1762821 100644 --- a/dali/internal/event/events/pan-gesture-processor.cpp +++ b/dali/internal/event/events/pan-gesture-processor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -101,7 +101,7 @@ struct IsNotAttachedAndOutsideTouchesRangeFunctor } // unnamed namespace -PanGestureProcessor::PanGestureProcessor( Stage& stage, Integration::GestureManager& gestureManager ) +PanGestureProcessor::PanGestureProcessor( Stage& stage, Integration::GestureManager& gestureManager, SceneGraph::UpdateManager& updateManager ) : GestureProcessor( Gesture::Pan ), mStage( stage ), mGestureManager( gestureManager ), @@ -114,17 +114,13 @@ PanGestureProcessor::PanGestureProcessor( Stage& stage, Integration::GestureMana mCurrentPanEvent( NULL ), mSceneObject( SceneGraph::PanGesture::New() ) // Create scene object to store pan information. { - // Pass ownership to scene-graph - AddGestureMessage( mStage.GetUpdateManager(), mSceneObject ); + // Pass ownership to scene-graph; scene object lives for the lifecycle of UpdateManager + updateManager.SetPanGestureProcessor( mSceneObject ); } PanGestureProcessor::~PanGestureProcessor() { - if( Stage::IsInstalled() && ( mSceneObject != NULL ) ) - { - RemoveGestureMessage( mStage.GetUpdateManager(), mSceneObject ); - mSceneObject = NULL; // mSceneObject is about to be destroyed - } + mSceneObject = NULL; // mSceneObject is owned and destroyed by update manager (there is only one of these for now) } void PanGestureProcessor::Process( const Integration::PanGestureEvent& panEvent ) @@ -229,8 +225,10 @@ void PanGestureProcessor::Process( const Integration::PanGestureEvent& panEvent } case Gesture::Clear: - DALI_ASSERT_ALWAYS( false && "Incorrect state received from Integration layer: Clear\n" ); + { + DALI_ABORT( "Incorrect state received from Integration layer: Clear\n" ); break; + } } } @@ -331,6 +329,21 @@ void PanGestureProcessor::SetPredictionAmount(unsigned int amount) mSceneObject->SetPredictionAmount(amount); } +void PanGestureProcessor::SetMaximumPredictionAmount(unsigned int amount) +{ + mSceneObject->SetMaximumPredictionAmount(amount); +} + +void PanGestureProcessor::SetMinimumPredictionAmount(unsigned int amount) +{ + mSceneObject->SetMinimumPredictionAmount(amount); +} + +void PanGestureProcessor::SetPredictionAmountAdjustment(unsigned int amount) +{ + mSceneObject->SetPredictionAmountAdjustment(amount); +} + void PanGestureProcessor::SetSmoothingMode(int mode) { if( (mode < 0) @@ -347,6 +360,46 @@ void PanGestureProcessor::SetSmoothingAmount(float amount) mSceneObject->SetSmoothingAmount(amount); } +void PanGestureProcessor::SetUseActualTimes( bool value ) +{ + mSceneObject->SetUseActualTimes( value ); +} + +void PanGestureProcessor::SetInterpolationTimeRange( int value ) +{ + mSceneObject->SetInterpolationTimeRange( value ); +} + +void PanGestureProcessor::SetScalarOnlyPredictionEnabled( bool value ) +{ + mSceneObject->SetScalarOnlyPredictionEnabled( value ); +} + +void PanGestureProcessor::SetTwoPointPredictionEnabled( bool value ) +{ + mSceneObject->SetTwoPointPredictionEnabled( value ); +} + +void PanGestureProcessor::SetTwoPointInterpolatePastTime( int value ) +{ + mSceneObject->SetTwoPointInterpolatePastTime( value ); +} + +void PanGestureProcessor::SetTwoPointVelocityBias( float value ) +{ + mSceneObject->SetTwoPointVelocityBias( value ); +} + +void PanGestureProcessor::SetTwoPointAccelerationBias( float value ) +{ + mSceneObject->SetTwoPointAccelerationBias( value ); +} + +void PanGestureProcessor::SetMultitapSmoothingRange( int value ) +{ + mSceneObject->SetMultitapSmoothingRange( value ); +} + void PanGestureProcessor::UpdateDetection() { DALI_ASSERT_DEBUG(!mGestureDetectors.empty()); @@ -358,16 +411,19 @@ void PanGestureProcessor::UpdateDetection() { PanGestureDetector* detector(*iter); - unsigned int minimum = detector->GetMinimumTouchesRequired(); - if (minimum < minimumRequired) + if( detector ) { - minimumRequired = minimum; - } + unsigned int minimum = detector->GetMinimumTouchesRequired(); + if (minimum < minimumRequired) + { + minimumRequired = minimum; + } - unsigned int maximum = detector->GetMaximumTouchesRequired(); - if (maximum > maximumRequired) - { - maximumRequired = maximum; + unsigned int maximum = detector->GetMaximumTouchesRequired(); + if (maximum > maximumRequired) + { + maximumRequired = maximum; + } } } @@ -416,11 +472,11 @@ void PanGestureProcessor::EmitPanSignal( Actor* actor, // Avoid dividing by 0 if ( panEvent.timeDelta > 0 ) { - pan.velocity.x = pan.displacement.x / panEvent.timeDelta; - pan.velocity.y = pan.displacement.y / panEvent.timeDelta; + pan.velocity.x = pan.displacement.x / static_cast( panEvent.timeDelta ); + pan.velocity.y = pan.displacement.y / static_cast( panEvent.timeDelta ); - pan.screenVelocity.x = pan.screenDisplacement.x / panEvent.timeDelta; - pan.screenVelocity.y = pan.screenDisplacement.y / panEvent.timeDelta; + pan.screenVelocity.x = pan.screenDisplacement.x / static_cast( panEvent.timeDelta ); + pan.screenVelocity.y = pan.screenDisplacement.y / static_cast( panEvent.timeDelta ); } // When the gesture ends, we may incorrectly get a ZERO velocity (as we have lifted our finger without any movement) @@ -481,7 +537,7 @@ bool PanGestureProcessor::CheckGestureDetector( GestureDetector* detector, Actor actor->ScreenToLocal( renderTaskImpl, currentPosition.x, currentPosition.y, mCurrentPanEvent->currentPosition.x, mCurrentPanEvent->currentPosition.y ); Vector2 displacement( currentPosition - startPosition ); - Radian angle( atan( displacement.y / displacement.x ) ); + Radian angle( atanf( displacement.y / displacement.x ) ); ///////////////////////////// // | // @@ -506,12 +562,12 @@ bool PanGestureProcessor::CheckGestureDetector( GestureDetector* detector, Actor if ( displacement.y >= 0.0f ) { // Quadrant 2 - angle += Math::PI; + angle.radian += Math::PI; } else { // Quadrant 3 - angle -= Math::PI; + angle.radian -= Math::PI; } }