X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-controls%2Ftext-field-impl.cpp;h=a32e7f52074268f33d948b27671e3c18c69eaca7;hp=7341032d1e87abef67cd0ae37185c75fd15d9eb6;hb=c8992f93caecf9a341baa7343e81b5e147508634;hpb=fb545906ceea3a2946c8a451f34ea7da283c4ffe diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index 7341032..a32e7f5 100644 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1270,7 +1270,9 @@ void TextField::RenderText( Text::Controller::UpdateTextType updateTextType ) { if( mRenderer ) { - renderableActor = mRenderer->Render( mController->GetView(), DepthIndex::TEXT ); + renderableActor = mRenderer->Render( mController->GetView(), + mAlignmentOffset, + DepthIndex::CONTENT ); } if( renderableActor != mRenderableActor ) @@ -1284,7 +1286,7 @@ void TextField::RenderText( Text::Controller::UpdateTextType updateTextType ) { const Vector2& scrollOffset = mController->GetTextModel()->GetScrollPosition(); - mRenderableActor.SetPosition( scrollOffset.x, scrollOffset.y ); + mRenderableActor.SetPosition( scrollOffset.x + mAlignmentOffset, scrollOffset.y ); // Make sure the actors are parented correctly with/without clipping Actor self = mStencil ? mStencil : Self(); @@ -1401,10 +1403,14 @@ bool TextField::OnKeyEvent( const KeyEvent& event ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnKeyEvent %p keyCode %d\n", mController.Get(), event.keyCode ); - if( Dali::DALI_KEY_ESCAPE == event.keyCode || - "Return" == event.keyPressedName ) // Make a Dali key code for this + if( Dali::DALI_KEY_ESCAPE == event.keyCode || "Return" == event.keyPressedName ) // Make a Dali key code for this { - ClearKeyInputFocus(); + // Make sure ClearKeyInputFocus when only key is up + if( event.state == KeyEvent::Up ) + { + ClearKeyInputFocus(); + } + return true; } @@ -1536,7 +1542,6 @@ void TextField::EnableClipping() mStencil.SetParentOrigin( ParentOrigin::CENTER ); // Creates a background visual. Even if the color is transparent it updates the stencil. - // Property::Map backgroundMap; mStencil.SetProperty( Toolkit::Control::Property::BACKGROUND, Property::Map().Add( Toolkit::Visual::Property::TYPE, DevelVisual::COLOR ). Add( ColorVisual::Property::MIX_COLOR, Color::TRANSPARENT ) ); @@ -1571,13 +1576,13 @@ void TextField::KeyboardStatusChanged(bool keyboardShown) void TextField::OnStageConnection( int depth ) { - // Call the Control::OnStageConnection() to set the depth of the background. - Control::OnStageConnection( depth ); - // Sets the depth to the visuals inside the text's decorator. mDecorator->SetTextDepth( depth ); // The depth of the text renderer is set in the RenderText() called from OnRelayout(). + + // Call the Control::OnStageConnection() to set the depth of the background. + Control::OnStageConnection( depth ); } bool TextField::OnTouched( Actor actor, const TouchData& touch ) @@ -1597,6 +1602,7 @@ void TextField::OnIdleSignal() TextField::TextField() : Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ), mIdleCallback( NULL ), + mAlignmentOffset( 0.f ), mRenderingBackend( DEFAULT_RENDERING_BACKEND ), mExceedPolicy( Dali::Toolkit::TextField::EXCEED_POLICY_CLIP ), mHasBeenStaged( false )