Before this patch, the track visual was always longer than the progress visual which meant
that 100% progress could never be shown.
Change-Id: I11fb81daf3b32096d0307904bff5a887311e0647
float DEFAULT_VALUE = 0.0f;
float DEFAULT_LOWER_BOUND = 0.0f;
float DEFAULT_UPPER_BOUND = 1.0f;
float DEFAULT_VALUE = 0.0f;
float DEFAULT_LOWER_BOUND = 0.0f;
float DEFAULT_UPPER_BOUND = 1.0f;
-float DEFAULT_PADDING = 24.0f;
void ProgressBar::OnRelayout( const Vector2& size, RelayoutContainer& container )
{
void ProgressBar::OnRelayout( const Vector2& size, RelayoutContainer& container )
{
- Vector2 trackSize( size );
- trackSize.width = std::max( 0.0f, size.width - DEFAULT_PADDING ); // Ensure we don't go negative
-
- container.Add( mTrack, trackSize );
+ container.Add( mTrack, size );
// mValueTextLabel will have its relayout method called automatically as it's a child of mTrack,
// which is added to the container
// mValueTextLabel will have its relayout method called automatically as it's a child of mTrack,
// which is added to the container
// Progress bar
if( mProgress )
{
// Progress bar
if( mProgress )
{
- mDomain = CalcDomain( trackSize );
+ mDomain = CalcDomain( size );
- Vector2 progressSize( trackSize );
+ Vector2 progressSize( size );
// If no progress, then we do not want a n-patch image shown incorrectly
progressSize.width = std::max( mProgressVisualSize.width, mDomain.from.x + mValue * ( mDomain.to.x - mDomain.from.x ) );
// If no progress, then we do not want a n-patch image shown incorrectly
progressSize.width = std::max( mProgressVisualSize.width, mDomain.from.x + mValue * ( mDomain.to.x - mDomain.from.x ) );
- progressSize.width = std::min( progressSize.width, trackSize.width ); // We should not exceed given size
+ progressSize.width = std::min( progressSize.width, size.width ); // We should not exceed given size
container.Add( mProgress, progressSize );
}
container.Add( mProgress, progressSize );
}
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* This file is part of Dali Toolkit
*
*
* This file is part of Dali Toolkit
*
{
"progressValue": 0,
"trackVisual":{
{
"progressValue": 0,
"trackVisual":{
- "url":"{DALI_IMAGE_DIR}slider-skin.9.png",
+ "url":"{DALI_IMAGE_DIR}progress-skin.9.png",
"size":[24,24]
},
"progressVisual":{
"size":[24,24]
},
"progressVisual":{
- "url":"{DALI_IMAGE_DIR}slider-skin-progress.9.png",
+ "url":"{DALI_IMAGE_DIR}progress-skin-progress.9.png",
{
"progressValue": 0,
"trackVisual":{
{
"progressValue": 0,
"trackVisual":{
- "url":"{DALI_IMAGE_DIR}slider-skin.9.png",
+ "url":"{DALI_IMAGE_DIR}progress-skin.9.png",
"size":[24,24]
},
"progressVisual":{
"size":[24,24]
},
"progressVisual":{
- "url":"{DALI_IMAGE_DIR}slider-skin-progress.9.png",
+ "url":"{DALI_IMAGE_DIR}progress-skin-progress.9.png",
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* This file is part of Dali Toolkit
*
*
* This file is part of Dali Toolkit
*
{
"progressValue": 0,
"trackVisual":{
{
"progressValue": 0,
"trackVisual":{
- "url":"{DALI_IMAGE_DIR}slider-skin.9.png",
+ "url":"{DALI_IMAGE_DIR}progress-skin.9.png",
"size":[24,24]
},
"progressVisual":{
"size":[24,24]
},
"progressVisual":{
- "url":"{DALI_IMAGE_DIR}slider-skin-progress.9.png",
+ "url":"{DALI_IMAGE_DIR}progress-skin-progress.9.png",