// CLASS HEADER
#include <dali/internal/event/events/pan-gesture-detector-impl.h>
+// EXTERNAL INCLUDES
+#include <cstring> // for strcmp
+
// INTERNAL INCLUDES
#include <dali/public-api/events/pan-gesture.h>
#include <dali/public-api/object/type-registry.h>
// Name Type writable animatable constraint-input enum for index-checking
DALI_PROPERTY_TABLE_BEGIN
-DALI_PROPERTY( "screen-position", VECTOR2, false, false, true, Dali::PanGestureDetector::Property::ScreenPosition )
-DALI_PROPERTY( "screen-displacement", VECTOR2, false, false, true, Dali::PanGestureDetector::Property::ScreenDisplacement )
-DALI_PROPERTY( "screen-velocity", VECTOR2, false, false, true, Dali::PanGestureDetector::Property::ScreenVelocity )
-DALI_PROPERTY( "local-position", VECTOR2, false, false, true, Dali::PanGestureDetector::Property::LocalPosition )
-DALI_PROPERTY( "local-displacement", VECTOR2, false, false, true, Dali::PanGestureDetector::Property::LocalDisplacement )
-DALI_PROPERTY( "local-velocity", VECTOR2, false, false, true, Dali::PanGestureDetector::Property::LocalVelocity )
-DALI_PROPERTY( "panning", BOOLEAN, false, false, true, Dali::PanGestureDetector::Property::Panning )
+DALI_PROPERTY( "screenPosition", VECTOR2, false, false, true, Dali::PanGestureDetector::Property::SCREEN_POSITION )
+DALI_PROPERTY( "screenDisplacement", VECTOR2, false, false, true, Dali::PanGestureDetector::Property::SCREEN_DISPLACEMENT )
+DALI_PROPERTY( "screenVelocity", VECTOR2, false, false, true, Dali::PanGestureDetector::Property::SCREEN_VELOCITY )
+DALI_PROPERTY( "localPosition", VECTOR2, false, false, true, Dali::PanGestureDetector::Property::LOCAL_POSITION )
+DALI_PROPERTY( "localDisplacement", VECTOR2, false, false, true, Dali::PanGestureDetector::Property::LOCAL_DISPLACEMENT )
+DALI_PROPERTY( "localVelocity", VECTOR2, false, false, true, Dali::PanGestureDetector::Property::LOCAL_VELOCITY )
+DALI_PROPERTY( "panning", BOOLEAN, false, false, true, Dali::PanGestureDetector::Property::PANNING )
DALI_PROPERTY_TABLE_END( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX )
// Signals
-const char* const SIGNAL_PAN_DETECTED = "pan-detected";
+const char* const SIGNAL_PAN_DETECTED = "panDetected";
BaseHandle Create()
{
#if defined(DEBUG_ENABLED)
Integration::Log::Filter* gLogFilter = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_PAN_GESTURE_DETECTOR");
-
-/**
- * When debugging, helper for converting radians to degrees.
- */
-inline float RadiansToDegrees( float radian )
-{
- return radian * 180.0f / Math::PI;
-}
-
#endif
/**
angle = WrapInDomain( angle, -Math::PI, Math::PI );
- DALI_LOG_INFO( gLogFilter, Debug::Concise, "Angle Added: %.2f, Threshold: %.2f\n", RadiansToDegrees(angle), RadiansToDegrees(threshold) );
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "Angle Added: %.2f, Threshold: %.2f\n", Degree(angle), Degree(threshold) );
AngleThresholdPair pair( angle, threshold );
mAngleContainer.push_back( pair );
AddAngle( direction, threshold );
}
-const PanGestureDetector::AngleContainer& PanGestureDetector::GetAngles() const
+size_t PanGestureDetector::GetAngleCount() const
{
- return mAngleContainer;
+ return mAngleContainer.size();
}
+PanGestureDetector::AngleThresholdPair PanGestureDetector::GetAngle(size_t index) const
+{
+ PanGestureDetector::AngleThresholdPair ret( Radian(0),Radian(0) );
+
+ if( index < mAngleContainer.size() )
+ {
+ ret = mAngleContainer[index];
+ }
+
+ return ret;
+}
+
+
void PanGestureDetector::ClearAngles()
{
mAngleContainer.clear();
DALI_LOG_INFO( gLogFilter, Debug::General,
"AngleToCheck: %.2f, CompareWith: %.2f, Threshold: %.2f\n",
- RadiansToDegrees(angle), RadiansToDegrees(angleAllowed), RadiansToDegrees(threshold) );
+ Degree(angle), Degree(angleAllowed), Degree(threshold) );
float relativeAngle( fabsf( WrapInDomain( angle - angleAllowed, -Math::PI, Math::PI ) ) );
if ( relativeAngle <= threshold )
void PanGestureDetector::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
{
- indices.reserve( DEFAULT_PROPERTY_COUNT );
+ indices.Reserve( DEFAULT_PROPERTY_COUNT );
int index = DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX;
for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i, ++index )
{
- indices.push_back( index );
+ indices.PushBack( index );
}
}
const Internal::PropertyDetails* property = &DEFAULT_PROPERTY_DETAILS[ i ];
if( 0 == strcmp( name.c_str(), property->name ) ) // dont want to convert rhs to string
{
- index = i;
+ index = DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX + i;
break;
}
}
switch ( index )
{
- case Dali::PanGestureDetector::Property::ScreenPosition:
+ case Dali::PanGestureDetector::Property::SCREEN_POSITION:
{
if(mSceneObject)
{
break;
}
- case Dali::PanGestureDetector::Property::ScreenDisplacement:
+ case Dali::PanGestureDetector::Property::SCREEN_DISPLACEMENT:
{
if(mSceneObject)
{
break;
}
- case Dali::PanGestureDetector::Property::ScreenVelocity:
+ case Dali::PanGestureDetector::Property::SCREEN_VELOCITY:
{
if(mSceneObject)
{
break;
}
- case Dali::PanGestureDetector::Property::LocalPosition:
+ case Dali::PanGestureDetector::Property::LOCAL_POSITION:
{
if(mSceneObject)
{
break;
}
- case Dali::PanGestureDetector::Property::LocalDisplacement:
+ case Dali::PanGestureDetector::Property::LOCAL_DISPLACEMENT:
{
if(mSceneObject)
{
break;
}
- case Dali::PanGestureDetector::Property::LocalVelocity:
+ case Dali::PanGestureDetector::Property::LOCAL_VELOCITY:
{
if(mSceneObject)
{
break;
}
- case Dali::PanGestureDetector::Property::Panning:
+ case Dali::PanGestureDetector::Property::PANNING:
{
if(mSceneObject)
{
return property;
}
- if ( index >= DEFAULT_PROPERTY_MAX_COUNT )
+ if ( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && // Child properties are also stored as custom properties
+ ( index <= PROPERTY_CUSTOM_MAX_INDEX ) )
{
- CustomProperty* custom = FindCustomProperty( index );
+ CustomPropertyMetadata* custom = FindCustomProperty( index );
DALI_ASSERT_ALWAYS( custom && "Property index is invalid" );
property = custom->GetSceneGraphProperty();
}
{
switch ( index )
{
- case Dali::PanGestureDetector::Property::ScreenPosition:
+ case Dali::PanGestureDetector::Property::SCREEN_POSITION:
{
property = &mSceneObject->GetScreenPositionProperty();
break;
}
- case Dali::PanGestureDetector::Property::ScreenDisplacement:
+ case Dali::PanGestureDetector::Property::SCREEN_DISPLACEMENT:
{
property = &mSceneObject->GetScreenDisplacementProperty();
break;
}
- case Dali::PanGestureDetector::Property::ScreenVelocity:
+ case Dali::PanGestureDetector::Property::SCREEN_VELOCITY:
{
property = &mSceneObject->GetScreenVelocityProperty();
break;
}
- case Dali::PanGestureDetector::Property::LocalPosition:
+ case Dali::PanGestureDetector::Property::LOCAL_POSITION:
{
property = &mSceneObject->GetLocalPositionProperty();
break;
}
- case Dali::PanGestureDetector::Property::LocalDisplacement:
+ case Dali::PanGestureDetector::Property::LOCAL_DISPLACEMENT:
{
property = &mSceneObject->GetLocalDisplacementProperty();
break;
}
- case Dali::PanGestureDetector::Property::LocalVelocity:
+ case Dali::PanGestureDetector::Property::LOCAL_VELOCITY:
{
property = &mSceneObject->GetLocalVelocityProperty();
break;
}
- case Dali::PanGestureDetector::Property::Panning:
+ case Dali::PanGestureDetector::Property::PANNING:
{
property = &mSceneObject->GetPanningProperty();
break;