Prevent slider setting handle text if no change 29/83429/2
authorDavid Steele <david.steele@samsung.com>
Wed, 10 Aug 2016 17:00:58 +0000 (18:00 +0100)
committerDavid Steele <david.steele@samsung.com>
Wed, 10 Aug 2016 17:43:33 +0000 (10:43 -0700)
Hover events cause relayout to occur, and slider doesn't prevent relayout
if there is no size change. Modified Slider::DisplayValue to prevent text
label being set if there is no change to the current text.

Change-Id: Ib8651ff618f8b3452810d0d0bf1237803cdf1206
Signed-off-by: David Steele <david.steele@samsung.com>
dali-toolkit/internal/controls/slider/slider-impl.cpp

index de7e5c6..03883d2 100755 (executable)
@@ -317,9 +317,9 @@ Slider::Domain Slider::CalcDomain( const Vector2& currentSize )
 
 void Slider::DisplayValue( float value, bool raiseSignals )
 {
 
 void Slider::DisplayValue( float value, bool raiseSignals )
 {
-  float clampledValue = Clamp( value, GetLowerBound(), GetUpperBound() );
+  float clampedValue = Clamp( value, GetLowerBound(), GetUpperBound() );
 
 
-  float percent = MapValuePercentage( clampledValue );
+  float percent = MapValuePercentage( clampedValue );
 
   float x = mDomain.from.x + percent * ( mDomain.to.x - mDomain.from.x );
 
 
   float x = mDomain.from.x + percent * ( mDomain.to.x - mDomain.from.x );
 
@@ -335,7 +335,7 @@ void Slider::DisplayValue( float value, bool raiseSignals )
   if( raiseSignals )
   {
     Toolkit::Slider self = Toolkit::Slider::DownCast( Self() );
   if( raiseSignals )
   {
     Toolkit::Slider self = Toolkit::Slider::DownCast( Self() );
-    mValueChangedSignal.Emit( self, clampledValue );
+    mValueChangedSignal.Emit( self, clampedValue );
 
     int markIndex;
     if( MarkReached( percent, markIndex ) )
 
     int markIndex;
     if( MarkReached( percent, markIndex ) )
@@ -348,9 +348,13 @@ void Slider::DisplayValue( float value, bool raiseSignals )
   {
     std::stringstream ss;
     ss.precision( GetValuePrecision() );
   {
     std::stringstream ss;
     ss.precision( GetValuePrecision() );
-    ss << std::fixed << clampledValue;
+    ss << std::fixed << clampedValue;
 
 
-    mHandleValueTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, ss.str() );
+    std::string label = mHandleValueTextLabel.GetProperty<std::string>( Toolkit::TextLabel::Property::TEXT );
+    if( label.compare(ss.str()) )
+    {
+      mHandleValueTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, ss.str() );
+    }
   }
 }
 
   }
 }