const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
const char* const PROPERTY_NAME_ELLIPSIS = "ellipsis";
+const char* const PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY = "autoScrollLoopDelay";
const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextLabel::Property::OUTLINE );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_PIXEL_SIZE ) == DevelTextLabel::Property::PIXEL_SIZE );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == DevelTextLabel::Property::ELLIPSIS );
+ DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY ) == DevelTextLabel::Property::AUTO_SCROLL_LOOP_DELAY );
END_TEST;
}
const int SCROLL_SPEED = 80;
const int SCROLL_LOOPS = 4;
const float SCROLL_GAP = 50.0f;
+ const float SCROLL_LOOP_DELAY = 0.3f;
label.SetProperty( TextLabel::Property::MULTI_LINE, false ); // Autoscroll only supported in single line
DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ENABLE_AUTO_SCROLL ) );
label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true );
DALI_TEST_EQUALS( SCROLL_LOOPS, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT ), TEST_LOCATION );
label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, SCROLL_GAP );
DALI_TEST_EQUALS( SCROLL_GAP, label.GetProperty<float>( TextLabel::Property::AUTO_SCROLL_GAP ), TEST_LOCATION );
+ label.SetProperty(DevelTextLabel::Property::AUTO_SCROLL_LOOP_DELAY, SCROLL_LOOP_DELAY );
+ DALI_TEST_EQUALS( SCROLL_LOOP_DELAY, label.GetProperty<float>( DevelTextLabel::Property::AUTO_SCROLL_LOOP_DELAY ), TEST_LOCATION );
// Check the line spacing property
DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
* @details name "ellipsis", type bool
*/
ELLIPSIS = OUTLINE + 2,
+
+ /**
+ * @brief delay starting time of auto scrolling and further loops
+ * @details name "autoScrollLoopDelay", type float.
+ */
+ AUTO_SCROLL_LOOP_DELAY = OUTLINE + 3,
};
} // namespace Property
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "outline", MAP, OUTLINE )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "pixelSize", FLOAT, PIXEL_SIZE )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "ellipsis", BOOLEAN, ELLIPSIS )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollLoopDelay", FLOAT, AUTO_SCROLL_LOOP_DELAY )
DALI_TYPE_REGISTRATION_END()
impl.mTextScroller->SetLoopCount( value.Get<int>() );
break;
}
+ case Toolkit::DevelTextLabel::Property::AUTO_SCROLL_LOOP_DELAY:
+ {
+ if( !impl.mTextScroller )
+ {
+ impl.mTextScroller = Text::TextScroller::New( impl );
+ }
+ impl.mTextScroller->SetLoopDelay( value.Get<float>() );
+ break;
+ }
case Toolkit::TextLabel::Property::AUTO_SCROLL_GAP:
{
if( !impl.mTextScroller )
}
break;
}
+ case Toolkit::DevelTextLabel::Property::AUTO_SCROLL_LOOP_DELAY:
+ {
+ if( impl.mController )
+ {
+ TextLabel& impl( GetImpl( label ) );
+ if ( impl.mTextScroller )
+ {
+ value = impl.mTextScroller->GetLoopDelay();
+ }
+ }
+ break;
+ }
case Toolkit::TextLabel::Property::AUTO_SCROLL_GAP:
{
TextLabel& impl( GetImpl( label ) );
return mLoopCount;
}
+void TextScroller::SetLoopDelay( float delay )
+{
+ mLoopDelay = delay;
+}
+
+float TextScroller::GetLoopDelay() const
+{
+ return mLoopDelay;
+}
+
Actor TextScroller::GetSourceCamera() const
{
return mOffscreenCameraActor;
mScrollDeltaIndex( Property::INVALID_INDEX ),
mScrollSpeed( MINIMUM_SCROLL_SPEED ),
mLoopCount( 1 ),
+ mLoopDelay( 0.0f ),
mWrapGap( 0.0f )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller Default Constructor\n" );
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::StartScrolling scrollAmount[%f] scrollDuration[%f], loop[%d] speed[%d]\n", scrollAmount, scrollDuration, loopCount, mScrollSpeed );
mScrollAnimation = Animation::New( scrollDuration );
- mScrollAnimation.AnimateTo( Property( mScrollingTextActor, mScrollDeltaIndex ), scrollAmount );
+ mScrollAnimation.AnimateTo( Property( mScrollingTextActor, mScrollDeltaIndex ), scrollAmount, TimePeriod( mLoopDelay, scrollDuration ) );
mScrollAnimation.SetEndAction( Animation::Discard );
mScrollAnimation.SetLoopCount( loopCount );
mScrollAnimation.FinishedSignal().Connect( this, &TextScroller::AutoScrollAnimationFinished );
int GetLoopCount() const;
/**
+ * @brief Set the delay time of scroll animation loop
+ * @param[in] float delay time seconds of loops
+ */
+ void SetLoopDelay( float delay );
+
+ /**
+ * @brief Get the delay time of scroll
+ * @return float delay time seconds of loops
+ */
+ float GetLoopDelay() const;
+
+ /**
* @brief Get the camera used to look at source, should be added to the parent of target actor.
* @return camera Actor
*/
int mScrollSpeed; ///< Speed which text should automatically scroll at
int mLoopCount; ///< Number of time the text should scroll
+ float mLoopDelay; ///< Time delay of loop start
float mWrapGap; ///< Gap before text wraps around when scrolling
}; // TextScroller class