return true;
}
- if (__pEdit->GetEditStyle() & EDIT_STYLE_SINGLE_LINE)
+ if (__pEdit->GetEditStyle() & EDIT_STYLE_SINGLE_LINE || __pEdit->GetEditStyle() & EDIT_STYLE_TOKEN)
{
float horizontalGap = touchInfo.GetCurrentPosition().x - __pScrollEffect->currentX;
FloatRectangle lineBounds = __pTextObject->GetBoundsAtLineF(0);
newTextDisplayPositionX = textDisplayPositionX - horizontalGap;
- if (newTextDisplayPositionX > lineBounds.width - __textObjectBounds.width)
+ if (newTextDisplayPositionX > lineBounds.width - __textObjectBounds.width)
{
newTextDisplayPositionX = lineBounds.width - __textObjectBounds.width;
}
return true;
}
-
- if (__pEdit->GetEditStyle() & EDIT_STYLE_TOKEN)
- {
- float horizontalGap = touchInfo.GetCurrentPosition().x - fromBounds.x;
- FloatDimension currentCharacterDimension;
- if (horizontalGap > 0.0f && __cursorPos < GetTextLength())
- {
- currentCharacterDimension = __pTextObject->GetTextExtentF(__cursorPos, 1);
- if (horizontalGap >= currentCharacterDimension.width)
- {
- SetCursorPosition(__cursorPos+1);
- __pEdit->Invalidate();
- return true;
- }
- }
- if (horizontalGap < 0.0f && __cursorPos > 0)
- {
- currentCharacterDimension = __pTextObject->GetTextExtentF(__cursorPos-1, 1);
- if (Math::Abs(horizontalGap) >= currentCharacterDimension.width)
- {
- SetCursorPosition(__cursorPos-1);
- __pEdit->Invalidate();
- return true;
- }
- }
- }
}
if (__isMovingCursorByTouchMove)
{
result
_EditPresenter::SetTextBounds(Rectangle& bounds)
{
- __textObjectBounds = _CoordinateSystemUtils::ConvertToFloat(bounds);
- if (__pEdit->GetEditStyle() & EDIT_STYLE_TOKEN)
+ FloatRectangle floatBounds = _CoordinateSystemUtils::ConvertToFloat(bounds);
+ if (__textObjectBounds != floatBounds)
{
- __pTextObject->SetBounds(__textObjectBounds);
- __pTextObject->Compose();
- __isCursorChanged = true;
+ __textObjectBounds = floatBounds;
+ if (__pEdit->GetEditStyle() & EDIT_STYLE_TOKEN)
+ {
+ __pTextObject->SetBounds(__textObjectBounds);
+ __pTextObject->Compose();
+ __isCursorChanged = true;
+ }
}
return E_SUCCESS;
}
result
_EditPresenter::SetTextBounds(FloatRectangle& bounds)
{
- __textObjectBounds = bounds;
- if (__pEdit->GetEditStyle() & EDIT_STYLE_TOKEN)
+ if (__textObjectBounds != bounds)
{
- __pTextObject->SetBounds(__textObjectBounds);
- __pTextObject->Compose();
- __isCursorChanged = true;
+ __textObjectBounds = bounds;
+ if (__pEdit->GetEditStyle() & EDIT_STYLE_TOKEN)
+ {
+ __pTextObject->SetBounds(__textObjectBounds);
+ __pTextObject->Compose();
+ __isCursorChanged = true;
+ }
}
return E_SUCCESS;
}
r = CalculateTokenPositionFromIndex(index);
SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to calculate token position.");
+
r = SetInitialBounds();
SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to set bounds.");
result r = E_SUCCESS;
float currentYPosition = touchinfo.GetCurrentPosition().y;
- if (_FloatCompare(__prevScrollValue, 0.0f))
- {
- __prevScrollValue = currentYPosition;
- }
- else // Adjust moved y position to all tokens.
+ if (!IsHorizontalDirection(touchinfo))
{
- if (__isNeedToScroll) // Need to scroll
+ if (_FloatCompare(__prevScrollValue, 0.0f))
{
- float tempDefference = __prevScrollValue - currentYPosition;
-
__prevScrollValue = currentYPosition;
- __scrollValue -= tempDefference;
-
- if (__scrollValue < -__maxScrollValue)
+ }
+ else // Adjust moved y position to all tokens.
+ {
+ if (__isNeedToScroll) // Need to scroll
{
- __scrollValue = -__maxScrollValue;
+ float tempDefference = __prevScrollValue - currentYPosition;
- return E_SUCCESS;
- }
+ __prevScrollValue = currentYPosition;
+ __scrollValue -= tempDefference;
- if (__scrollValue > 0.0f)
- {
- __scrollValue = 0.0f;
+ if (__scrollValue < -__maxScrollValue)
+ {
+ __scrollValue = -__maxScrollValue;
- return E_SUCCESS;
- }
+ return E_SUCCESS;
+ }
- int tokenCount = GetTokenCount();
- CalculateTokenPositionFromIndex(0);
- for (int i = 0; i < tokenCount; i++)
- {
- _Token* pToken = null;
- pToken = static_cast< _Token* >(__pTokenList->GetAt(i));
+ if (__scrollValue > 0.0f)
+ {
+ __scrollValue = 0.0f;
- if (pToken != null)
+ return E_SUCCESS;
+ }
+
+ int tokenCount = GetTokenCount();
+ CalculateTokenPositionFromIndex(0);
+ for (int i = 0; i < tokenCount; i++)
+ {
+ _Token* pToken = null;
+ pToken = static_cast< _Token* >(__pTokenList->GetAt(i));
+
+ if (pToken != null)
+ {
+ pToken->SetBounds(pToken->displayRect);
+ }
+ TrimTokenAndAdjustEllipsisAt(i);
+ InitializeTokenVisibilityAt(i);
+ }
+
+ if (__pTitleTextObject->GetTextLength() != 0)
{
- pToken->SetBounds(pToken->displayRect);
+ __titleTextRect.y = __titleTextRectForScroll.y + __scrollValue;
}
- TrimTokenAndAdjustEllipsisAt(i);
- InitializeTokenVisibilityAt(i);
- }
- if (__pTitleTextObject->GetTextLength() != 0)
+ __pTokenEdit->Invalidate();
+ }
+ else
{
- __titleTextRect.y = __titleTextRectForScroll.y + __scrollValue;
+ __prevScrollValue = 0.0f;
+ __scrollValue = 0.0f;
}
-
- __pTokenEdit->Invalidate();
- }
- else
- {
- __prevScrollValue = 0.0f;
- __scrollValue = 0.0f;
}
- }
- r = SetInitialBounds();
- SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to set bounds.");
+ r = SetInitialBounds();
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to set bounds.");
+ }
return r;
}
float totalHeight = GetTextBoundsF().y + GetTextBoundsF().height - __scrollValue + tokenBottomMargin;
float controlHeight = __pTokenEdit->GetBoundsF().height;
- if (totalHeight > controlHeight)
+ if (totalHeight > controlHeight && (!IsHorizontalDirection(touchinfo)))
{
pScroll->SetScrollVisibility(true);
}
_Edit* GetEditView(void) const;
bool AdjustRTLTextAlignment(const _EditTextType textType);
void RestoreCopyPasteManager(void);
+ bool IsHorizontalDirection(const _TouchInfo& touchInfo);
private:
virtual void OnEditCopyPasteStatusChanged(CoreCopyPasteStatus status, CoreCopyPasteAction action);
result DrawTextForEntireFontSetting(Tizen::Graphics::Canvas& canvas);
result DrawTitleText(void);
result MoveCursor(const Tizen::Graphics::FloatRectangle& fromRect, const Tizen::Graphics::FloatRectangle& toRect);
- bool IsHorizontalDirection(const _TouchInfo& touchInfo);
result ScrollContentsOnFlick(void);
result ChangePasswordToEchoCharacter(wchar_t* dspStrBuffer, wchar_t echoChar);
// todo : move to PastePasswordEchoCharacter