const float MAX_FLOAT = std::numeric_limits<float>::max();
const float MIN_FLOAT = std::numeric_limits<float>::min();
const Dali::Toolkit::Text::CharacterDirection LTR = false; ///< Left To Right direction
-const uint32_t STAR = 0x2A;
} // namespace
EventData::EventData( DecoratorPtr decorator )
: mDecorator( decorator ),
mImfManager(),
+ mPlaceholderText(),
mPlaceholderTextActive(),
mPlaceholderTextInactive(),
mPlaceholderTextColor( 0.8f, 0.8f, 0.8f, 0.8f ),
return false;
}
- Vector<Character> utf32CharactersStar;
- const Length characterCount = mModel->mLogicalModel->mText.Count();
- const bool isPasswordInput = ( mEventData != NULL && mEventData->mPasswordInput &&
- !mEventData->mIsShowingPlaceholderText && characterCount > 0 );
-
- if (isPasswordInput)
+ Vector<Character>& srcCharacters = mModel->mLogicalModel->mText;
+ Vector<Character> displayCharacters;
+ bool useHiddenText = false;
+ if ( mHiddenInput && mEventData != NULL && !mEventData->mIsShowingPlaceholderText)
{
- utf32CharactersStar.Resize( characterCount );
-
- uint32_t* begin = utf32CharactersStar.Begin();
- uint32_t* end = begin + characterCount;
- while ( begin < end )
- {
- *begin++ = STAR;
- }
+ mHiddenInput->Substitute( srcCharacters,displayCharacters );
+ useHiddenText = true;
}
- Vector<Character>& utf32Characters = isPasswordInput ? utf32CharactersStar : mModel->mLogicalModel->mText;
+ Vector<Character>& utf32Characters = useHiddenText ? displayCharacters : srcCharacters;
const Length numberOfCharacters = utf32Characters.Count();
// Index to the first character of the first paragraph to be updated.
const Vector2 cursorPosition = cursorInfo.primaryPosition + mModel->mScrollPosition;
+ mEventData->mDecorator->SetGlyphOffset( PRIMARY_CURSOR, cursorInfo.glyphOffset );
+
// Sets the cursor position.
mEventData->mDecorator->SetPosition( PRIMARY_CURSOR,
cursorPosition.x,
// Get the current cursor position in decorator coords.
const Vector2& currentCursorPosition = mEventData->mDecorator->GetPosition( PRIMARY_CURSOR );
+ const LineIndex lineIndex = mModel->mVisualModel->GetLineOfCharacter( mEventData->mPrimaryCursorPosition );
+
+
+
// Calculate the offset to match the cursor position before the character was deleted.
mModel->mScrollPosition.x = currentCursorPosition.x - cursorInfo.primaryPosition.x;
- mModel->mScrollPosition.y = currentCursorPosition.y - cursorInfo.lineOffset;
+
+ //If text control has more than two lines and current line index is not last, calculate scrollpositionY
+ if( mModel->mVisualModel->mLines.Count() > 1u && lineIndex != mModel->mVisualModel->mLines.Count() -1u )
+ {
+ const float currentCursorGlyphOffset = mEventData->mDecorator->GetGlyphOffset( PRIMARY_CURSOR );
+ mModel->mScrollPosition.y = currentCursorPosition.y - cursorInfo.lineOffset - currentCursorGlyphOffset;
+ }
+
ClampHorizontalScroll( mModel->mVisualModel->GetLayoutSize() );
ClampVerticalScroll( mModel->mVisualModel->GetLayoutSize() );