/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
} // 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 ),
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 )
}
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;
+ }
}
}
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)
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());
{
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;
+ }
}
}
if ( displacement.y >= 0.0f )
{
// Quadrant 2
- angle += Math::PI;
+ angle.radian += Math::PI;
}
else
{
// Quadrant 3
- angle -= Math::PI;
+ angle.radian -= Math::PI;
}
}