DALI_PAN_SMOOTHING_MODE - Currently only 0 for off and 1 for a simple smoothing technique
DALI_PAN_SMOOTHING_AMOUNT - From 0.0f for no smoothing to 1.0f for full smoothing
[problem] Predicted panning is a little jittery at times
[cause] Any slight error in touch data could skew the calculations a little
[solution] Added smoothing phase
Change-Id: Ifc573419a63904fdadbc169fbeefd9dcae27dc0b
Signed-off-by: Adeel Kazmi <adeel.kazmi@samsung.com>
mPanGestureLoggingLevel(0),
mPanGesturePredictionMode(-1),
mPanGesturePredictionAmount(-1.0f), ///< only sets value in pan gesture if greater than 0
+ mPanGestureSmoothingMode(-1),
+ mPanGestureSmoothingAmount(-1.0f),
mPanMinimumDistance(-1),
mPanMinimumEvents(-1),
mLogFunction( NULL )
return mPanGestureLoggingLevel;
}
-int EnvironmentOptions::GetPanGestureSmoothingMode() const
+int EnvironmentOptions::GetPanGesturePredictionMode() const
{
return mPanGesturePredictionMode;
}
return mPanGesturePredictionAmount;
}
+int EnvironmentOptions::GetPanGestureSmoothingMode() const
+{
+ return mPanGestureSmoothingMode;
+}
+
+float EnvironmentOptions::GetPanGestureSmoothingAmount() const
+{
+ return mPanGestureSmoothingAmount;
+}
+
int EnvironmentOptions::GetMinimumPanDistance() const
{
return mPanMinimumDistance;
return mPanMinimumEvents;
}
-void EnvironmentOptions::SetPanGesturePredictionMode(unsigned int mode)
+void EnvironmentOptions::SetPanGesturePredictionMode( unsigned int mode )
{
mPanGesturePredictionMode = mode;
}
-void EnvironmentOptions::SetPanGesturePredictionAmount(unsigned int amount)
+void EnvironmentOptions::SetPanGesturePredictionAmount( unsigned int amount )
{
mPanGesturePredictionAmount = amount;
}
+void EnvironmentOptions::SetPanGestureSmoothingMode( unsigned int mode )
+{
+ mPanGestureSmoothingMode = mode;
+}
+
+void EnvironmentOptions::SetPanGestureSmoothingAmount( float amount )
+{
+ mPanGestureSmoothingAmount = amount;
+}
+
void EnvironmentOptions::SetMinimumPanDistance( int distance )
{
mPanMinimumDistance = distance;
unsigned int GetPanGestureLoggingLevel() const;
/**
- * @return pan-gesture smoothing mode ( -1 means not set so no smoothing, 0 = no smoothing )
+ * @return pan-gesture prediction mode ( -1 means not set so no prediction, 0 = no prediction )
*/
- int GetPanGestureSmoothingMode() const;
+ int GetPanGesturePredictionMode() const;
/**
* @return pan-gesture prediction amount
float GetPanGesturePredictionAmount() const;
/**
+ * @return pan-gesture smoothing mode ( -1 means not set so no smoothing, 0 = no smoothing )
+ */
+ int GetPanGestureSmoothingMode() const;
+
+ /**
+ * @return pan-gesture smoothing amount
+ */
+ float GetPanGestureSmoothingAmount() const;
+
+ /**
* @return The minimum distance before a pan can be started (-1 means it's not set)
*/
int GetMinimumPanDistance() const;
*
* @param[in] mode The smoothing mode to use
*/
- void SetPanGesturePredictionMode(unsigned int mode);
+ void SetPanGesturePredictionMode( unsigned int mode );
/**
* @brief Sets the prediction amount of the pan gesture
*
* @param[in] amount The prediction amount in milliseconds
*/
- void SetPanGesturePredictionAmount(unsigned int amount);
+ void SetPanGesturePredictionAmount( unsigned int amount );
+
+ /**
+ * @brief Called to set how pan gestures smooth input
+ *
+ * @param[in] mode The smoothing mode to use
+ */
+ void SetPanGestureSmoothingMode( unsigned int mode );
+
+ /**
+ * @brief Sets the prediction amount of the pan gesture
+ *
+ * @param[in] amount The smoothing amount [0.0f,1.0f] - 0.0f would be no smoothing, 1.0f maximum smoothing
+ */
+ void SetPanGestureSmoothingAmount( float amount );
/**
* @brief Sets the minimum distance required before a pan starts
unsigned int mPanGestureLoggingLevel; ///< pan-gesture log level
int mPanGesturePredictionMode; ///< prediction mode for pan gestures
float mPanGesturePredictionAmount; ///< prediction amount for pan gestures
+ int mPanGestureSmoothingMode; ///< prediction mode for pan gestures
+ float mPanGestureSmoothingAmount; ///< prediction amount for pan gestures
int mPanMinimumDistance; ///< minimum distance required before pan starts
int mPanMinimumEvents; ///< minimum events required before pan starts
#define DALI_ENV_PAN_PREDICTION_AMOUNT "DALI_PAN_PREDICTION_AMOUNT"
+#define DALI_ENV_PAN_SMOOTHING_MODE "DALI_PAN_SMOOTHING_MODE"
+
+#define DALI_ENV_PAN_SMOOTHING_AMOUNT "DALI_PAN_SMOOTHING_AMOUNT"
+
#define DALI_ENV_PAN_MINIMUM_DISTANCE "DALI_PAN_MINIMUM_DISTANCE"
#define DALI_ENV_PAN_MINIMUM_EVENTS "DALI_PAN_MINIMUM_EVENTS"
}
mEnvironmentOptions.SetPanGesturePredictionAmount(predictionAmount);
}
+ int smoothingMode;
+ if( GetIntegerEnvironmentVariable(DALI_ENV_PAN_SMOOTHING_MODE, smoothingMode) )
+ {
+ mEnvironmentOptions.SetPanGestureSmoothingMode(smoothingMode);
+ }
+ float smoothingAmount = 1.0f;
+ if( GetFloatEnvironmentVariable(DALI_ENV_PAN_SMOOTHING_AMOUNT, smoothingAmount) )
+ {
+ smoothingAmount = Clamp(smoothingAmount, 0.0f, 1.0f);
+ mEnvironmentOptions.SetPanGestureSmoothingAmount(smoothingAmount);
+ }
int minimumDistance(-1);
if ( GetIntegerEnvironmentVariable(DALI_ENV_PAN_MINIMUM_DISTANCE, minimumDistance ))
{
Integration::EnableProfiling( Dali::Integration::PROFILING_TYPE_PAN_GESTURE );
}
- if( mEnvironmentOptions.GetPanGestureSmoothingMode() >= 0 )
+ if( mEnvironmentOptions.GetPanGesturePredictionMode() >= 0 )
{
- Integration::SetPanGesturePredictionMode(mEnvironmentOptions.GetPanGestureSmoothingMode());
+ Integration::SetPanGesturePredictionMode(mEnvironmentOptions.GetPanGesturePredictionMode());
}
if( mEnvironmentOptions.GetPanGesturePredictionAmount() >= 0.0f )
{
Integration::SetPanGesturePredictionAmount(mEnvironmentOptions.GetPanGesturePredictionAmount());
}
+ if( mEnvironmentOptions.GetPanGestureSmoothingMode() >= 0 )
+ {
+ Integration::SetPanGestureSmoothingMode(mEnvironmentOptions.GetPanGestureSmoothingMode());
+ }
+ if( mEnvironmentOptions.GetPanGestureSmoothingAmount() >= 0.0f )
+ {
+ Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions.GetPanGestureSmoothingAmount());
+ }
}
Adaptor::~Adaptor()