bool needToScroll = false;
float tokenTopMargin = 0.0f;
float tokenBottomMargin = 0.0f;
- float tokenVerticalSpacing = 0.0f;
_ControlOrientation orientation = __pTokenEdit->GetOrientation();
GET_SHAPE_CONFIG(TOKENEDIT::TOP_MARGIN, orientation, tokenTopMargin);
GET_SHAPE_CONFIG(TOKENEDIT::BOTTOM_MARGIN, orientation, tokenBottomMargin);
- GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_VERTICAL_SPACING, orientation, tokenVerticalSpacing);
int tokenCount = GetTokenCount();
if (tokenCount == 0) // There is no token to scroll
if (focusChanged)
{
StopCursorTimer();
+
if (__focusedTokenIndex != -1)
{
SetCursorDisabled(true);
+ ScrollToFocusedToken();
}
else
{
SetCursorDisabled(false);
+ CheckTokenScrolling();
}
+
StartCursorTimer();
- ScrollToFocussedToken();
}
return _EditPresenter::OnKeyPressed(source, keyInfo);
}
result
-_TokenEditPresenter::ScrollToFocussedToken(void)
+_TokenEditPresenter::ScrollToFocusedToken(void)
{
result r = E_SUCCESS;
FloatRectangle focussedTokenRectangle;
float newScrollValue = 0.0f;
float tokenTopMargin = 0.0f;
float tokenBottomMargin = 0.0f;
+ float tokenHeight = 0.0f;
+ float textBoundsAlignValue = 0.0f;
_ControlOrientation orientation = __pTokenEdit->GetOrientation();
GET_SHAPE_CONFIG(TOKENEDIT::TOP_MARGIN, orientation, tokenTopMargin);
GET_SHAPE_CONFIG(TOKENEDIT::BOTTOM_MARGIN, orientation, tokenBottomMargin);
+ GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_HEIGHT, orientation, tokenHeight);
FloatRectangle tokenEditRect = __pTokenEdit->GetBoundsF();
+ float textObjectMaxHeight = GetMaxTextHeight();
+ textBoundsAlignValue = (tokenHeight - textObjectMaxHeight) / 2.0f;
+
if (__focusedTokenIndex == -1)
{
//Focus bitmap to be reset when no token is focused.
else
{
//Focused token is below the lower boundary
- newScrollValue = focussedTokenPosition - tokenEditRect.height + tokenBottomMargin - __scrollValue;
+ newScrollValue = focussedTokenPosition - textBoundsAlignValue - tokenEditRect.height + tokenBottomMargin - __scrollValue;
}
r = RecalculateTokenBounds(newScrollValue);
bool OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element);
bool OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element);
- result ScrollToFocussedToken(void);
+ result ScrollToFocusedToken(void);
result AttachCursorToToken(void);
result DetachCursorFromToken(void);
void ExitTokenEditingMode(void);