From bd4f4c078bc02ca029fdbef266f6e7b5b79650e2 Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Tue, 10 Nov 2015 17:01:54 +0000 Subject: [PATCH 1/1] Fix for checkbox tick not animating on gradually Change-Id: I3c9fa6f9508b6f7331d826b6d401a14fb8647239 --- .../internal/controls/buttons/check-box-button-impl.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp b/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp index 30aba5e..e468c0e 100644 --- a/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp @@ -40,6 +40,8 @@ namespace const float DISTANCE_BETWEEN_IMAGE_AND_LABEL( 5.0f ); const float ANIMATION_TIME( 0.26f ); // EFL checkbox tick time +// Required for the UV reveal shader to render the tick on top of the rest of the checkbox. +const float SHADER_DEPTH_OFFSET = 1.0f; BaseHandle Create() { @@ -166,11 +168,13 @@ void CheckBoxButton::PrepareForTranstionIn( Actor actor ) { mTickUVEffect = CreateImageRegionEffect(); } - mTickUVEffect.SetUniform("uBottomRight", Vector2( 0.0f, 1.0f ) ); + mTickUVEffect.SetUniform( "uBottomRight", Vector2( 0.0f, 1.0f ) ); ImageActor imageActor = ImageActor::DownCast( actor ); if( imageActor ) { + // Ensure the tick effect is rendered above the reset of the checkbox. + imageActor.SetSortModifier( SHADER_DEPTH_OFFSET ); imageActor.SetShaderEffect( mTickUVEffect ); } } @@ -185,9 +189,9 @@ void CheckBoxButton::PrepareForTranstionOut( Actor actor ) if( !mTickUVEffect ) { - mTickUVEffect = CreateImageRegionEffect(); + mTickUVEffect = CreateImageRegionEffect(); } - mTickUVEffect.SetUniform("uBottomRight", Vector2::ONE ); + mTickUVEffect.SetUniform( "uBottomRight", Vector2::ONE ); ImageActor imageActor = ImageActor::DownCast( actor ); if( imageActor ) @@ -223,7 +227,7 @@ void CheckBoxButton::OnTransitionIn( Actor actor ) actor.SetScale( Vector3::ONE ); if( mTickUVEffect ) { - mTickUVEffect.SetUniform("uBottomRight", Vector2::ONE ); + mTickUVEffect.SetUniform( "uBottomRight", Vector2::ONE ); } } } -- 2.7.4