From 5dfc8a984974c173ce1ebc1969749e8c84268184 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Thu, 29 Dec 2016 17:03:27 +0000 Subject: [PATCH] (ProgressBar) Ensure full progress image is shown when 100% 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 --- .../internal/controls/progress-bar/progress-bar-impl.cpp | 12 ++++-------- .../styles/1920x1080/dali-toolkit-default-theme.json | 6 +++--- .../styles/480x800/dali-toolkit-default-theme.json | 4 ++-- .../styles/720x1280/dali-toolkit-default-theme.json | 6 +++--- .../styles/images-common/progress-skin-progress.9.png | Bin 0 -> 704 bytes dali-toolkit/styles/images-common/progress-skin.9.png | Bin 0 -> 656 bytes 6 files changed, 12 insertions(+), 16 deletions(-) create mode 100644 dali-toolkit/styles/images-common/progress-skin-progress.9.png create mode 100644 dali-toolkit/styles/images-common/progress-skin.9.png diff --git a/dali-toolkit/internal/controls/progress-bar/progress-bar-impl.cpp b/dali-toolkit/internal/controls/progress-bar/progress-bar-impl.cpp index b8d9f59..ff3ed25 100755 --- a/dali-toolkit/internal/controls/progress-bar/progress-bar-impl.cpp +++ b/dali-toolkit/internal/controls/progress-bar/progress-bar-impl.cpp @@ -59,7 +59,6 @@ const char* SKINNED_PROGRESS_VISUAL = DALI_IMAGE_DIR "slider-skin-progress.9.png float DEFAULT_VALUE = 0.0f; float DEFAULT_LOWER_BOUND = 0.0f; float DEFAULT_UPPER_BOUND = 1.0f; -float DEFAULT_PADDING = 24.0f; } // Unnamed namespace @@ -111,13 +110,10 @@ void ProgressBar::OnInitialize() 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 - // Track if( mTrack ) { - 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 @@ -126,13 +122,13 @@ void ProgressBar::OnRelayout( const Vector2& size, RelayoutContainer& container // 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 ) ); - 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 ); } diff --git a/dali-toolkit/styles/1920x1080/dali-toolkit-default-theme.json b/dali-toolkit/styles/1920x1080/dali-toolkit-default-theme.json index 8c5661b..1809436 100644 --- a/dali-toolkit/styles/1920x1080/dali-toolkit-default-theme.json +++ b/dali-toolkit/styles/1920x1080/dali-toolkit-default-theme.json @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * This file is part of Dali Toolkit * @@ -184,11 +184,11 @@ { "progressValue": 0, "trackVisual":{ - "url":"{DALI_IMAGE_DIR}slider-skin.9.png", + "url":"{DALI_IMAGE_DIR}progress-skin.9.png", "size":[24,24] }, "progressVisual":{ - "url":"{DALI_IMAGE_DIR}slider-skin-progress.9.png", + "url":"{DALI_IMAGE_DIR}progress-skin-progress.9.png", "size":[24,24] } }, diff --git a/dali-toolkit/styles/480x800/dali-toolkit-default-theme.json b/dali-toolkit/styles/480x800/dali-toolkit-default-theme.json index b188dab..0684889 100644 --- a/dali-toolkit/styles/480x800/dali-toolkit-default-theme.json +++ b/dali-toolkit/styles/480x800/dali-toolkit-default-theme.json @@ -231,11 +231,11 @@ { "progressValue": 0, "trackVisual":{ - "url":"{DALI_IMAGE_DIR}slider-skin.9.png", + "url":"{DALI_IMAGE_DIR}progress-skin.9.png", "size":[24,24] }, "progressVisual":{ - "url":"{DALI_IMAGE_DIR}slider-skin-progress.9.png", + "url":"{DALI_IMAGE_DIR}progress-skin-progress.9.png", "size":[24,24] } }, diff --git a/dali-toolkit/styles/720x1280/dali-toolkit-default-theme.json b/dali-toolkit/styles/720x1280/dali-toolkit-default-theme.json index 2f24933..69abfe1 100644 --- a/dali-toolkit/styles/720x1280/dali-toolkit-default-theme.json +++ b/dali-toolkit/styles/720x1280/dali-toolkit-default-theme.json @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * This file is part of Dali Toolkit * @@ -205,11 +205,11 @@ { "progressValue": 0, "trackVisual":{ - "url":"{DALI_IMAGE_DIR}slider-skin.9.png", + "url":"{DALI_IMAGE_DIR}progress-skin.9.png", "size":[24,24] }, "progressVisual":{ - "url":"{DALI_IMAGE_DIR}slider-skin-progress.9.png", + "url":"{DALI_IMAGE_DIR}progress-skin-progress.9.png", "size":[24,24] } }, diff --git a/dali-toolkit/styles/images-common/progress-skin-progress.9.png b/dali-toolkit/styles/images-common/progress-skin-progress.9.png new file mode 100644 index 0000000000000000000000000000000000000000..f02cd0d5c39ef86e7c0c2865ca40f17689a844a4 GIT binary patch literal 704 zcmV;x0zdtUP)P000^Y1^@s6LVfqm00006VoOIv0RI30 z001*5eDeSR010qNS#tmY3ljhU3ljkVnw%H_000McNliru;0zrQ88Y(Xh=~9I0!>Lo zK~zY`&6dqi6JZdCpV<;iX%|XLtR?hhgyO}h2?kE4F<=z_05l;)xq5<=R};L*$(tqy zHR8ns31EaMa>CdIya{TIhY|?QZYZVlDf@b`fV(Zob5j;%P^z+km#m zw^)e0LT&bfHfon3pf>U31D*p~halZRd_T3h_ys}gK~{lDdr<6PYZd2|6Vc_*0&exn7jfD07fZuy0K)~-M64v{j?@C@19z6O0 zFrJ)A*U!x_9T*S^>qM)9pAr+v2B*JZryoBV2N=#QtzP>)k<^q@dp7yX<)~Gv7r!6* z_`S*Dr&KTA{nZ>ykMBwZ)SRBpt-TO8(<;5jA1Tg mm|4v93eAnRoOnC*&)r`iXt?OiPCvQ;00005b literal 0 HcmV?d00001 diff --git a/dali-toolkit/styles/images-common/progress-skin.9.png b/dali-toolkit/styles/images-common/progress-skin.9.png new file mode 100644 index 0000000000000000000000000000000000000000..e1c2ca045d9f29e7ce86c9b8cb0f22d49b5c93bb GIT binary patch literal 656 zcmV;B0&o3^P)Ku5ey&nj75S=(m4fB$|KqAY1>>(R>0DO(;DoA#9$ zOJFz*h*L8QPLx+S`V+LQt!lzZI3%CSbLwy0)b`B0Bjm zH7o+*f|9BOSS>0ltvgOFOF%d)r{o=0i!yUcUQ*K{V3PlX)uOn>%wN>B2!yd(1WeNZ z=weZNRuO$Hs;zJPNli;q)AO-g)YCupDK#yss%gfa7-r91ye=U*hiVp0oHXMxR*P1w zUhmdFaXM8pY*A^=|3yodPseHzu*Bt9wQBv&lJYu=ECGee!bK~etzW;{3}>ObYSlW+ z6|2^N%FZh#H(7!h(tMVflJkGTqUC=#ZP__( z%a$#I1S`I6+qSW9-MS-c&%Ps{Cr_RIKQ1u~e}xyB^uNBbR<;XHy{BW!HUEJS_Sa{0000