layoutParameters.startLineIndex = 0u;
layoutParameters.estimatedNumberOfLines = logicalModel->mParagraphInfo.Count();
- bool isAutoScroll = false;
+ bool isAutoScroll = false;
+ bool isAutoScrollMaxTextureExceeded = false;
layoutEngine.LayoutText(layoutParameters,
layoutSize,
false,
isAutoScroll,
+ isAutoScrollMaxTextureExceeded,
ellipsisPosition);
if(options.align)
layoutSize = Vector2::ZERO;
- bool isAutoScroll = false;
- const bool updated = engine.LayoutText(layoutParameters,
+ bool isAutoScroll = false;
+ bool isAutoScrollMaxTextureExceeded = false;
+ const bool updated = engine.LayoutText(layoutParameters,
layoutSize,
data.ellipsis,
isAutoScroll,
+ isAutoScrollMaxTextureExceeded,
DevelText::EllipsisPosition::END);
// 4) Compare the results.
layoutSize = Vector2::ZERO;
- bool isAutoScroll = false;
- const bool updated = engine.LayoutText(layoutParameters,
+ bool isAutoScroll = false;
+ bool isAutoScrollMaxTextureExceeded = false;
+ const bool updated = engine.LayoutText(layoutParameters,
layoutSize,
data.ellipsis,
isAutoScroll,
+ isAutoScrollMaxTextureExceeded,
data.ellipsisPosition);
// 4) Compare the results.
// Update the visual model.
Size newLayoutSize;
- bool isAutoScrollEnabled = false;
+ bool isAutoScrollEnabled = false;
+ bool isAutoScrollMaxTextureExceeded = false;
+
layoutEngine.LayoutText(layoutParameters,
newLayoutSize,
textParameters.ellipsisEnabled,
isAutoScrollEnabled,
+ isAutoScrollMaxTextureExceeded,
ellipsisPosition);
return newLayoutSize;
if(textNaturalSize.width > maxTextureSize)
{
mController->SetTextElideEnabled(true);
+ mController->SetAutoScrollMaxTextureExceeded(true);
}
GetHeightForWidth(maxTextureSize);
wrapGap = std::max(maxTextureSize - textNaturalSize.width, 0.0f);
Renderer renderer = static_cast<Internal::Visual::Base&>(GetImplementation(mVisual)).GetRenderer();
mTextScroller->SetParameters(Self(), renderer, textureSet, controlSize, verifiedSize, wrapGap, direction, mController->GetHorizontalAlignment(), mController->GetVerticalAlignment());
mController->SetTextElideEnabled(actualellipsis);
+ mController->SetAutoScrollMaxTextureExceeded(false);
}
void TextLabel::ScrollingFinished()
Length& numberOfLines,
float penY,
bool& isAutoScrollEnabled,
+ bool isAutoScrollMaxTextureExceeded,
DevelText::EllipsisPosition::Type ellipsisPosition,
bool enforceEllipsisInSingleLine)
{
- const bool ellipsis = enforceEllipsisInSingleLine || (isAutoScrollEnabled ? (penY - layout.descender > layoutParameters.boundingBox.height) : ((penY - layout.descender > layoutParameters.boundingBox.height) || ((mLayout == SINGLE_LINE_BOX) && (layout.length > layoutParameters.boundingBox.width))));
+ const bool ellipsis = enforceEllipsisInSingleLine || (isAutoScrollEnabled ? isAutoScrollMaxTextureExceeded : ((penY - layout.descender > layoutParameters.boundingBox.height) || ((mLayout == SINGLE_LINE_BOX) && (layout.length > layoutParameters.boundingBox.width))));
const bool isMultiline = !enforceEllipsisInSingleLine && (mLayout == MULTI_LINE_BOX);
if(ellipsis && (ellipsisPosition == DevelText::EllipsisPosition::END || !isMultiline))
{
- isAutoScrollEnabled = false;
- // Do not layout more lines if ellipsis is enabled.
+ if(penY - layout.descender > layoutParameters.boundingBox.height)
+ {
+ // Even if auto scroll is enabled and text is bigger than max texture size,
+ // if the the height is small, auto scroll should not work.
+ isAutoScrollEnabled = false;
+ }
+ // Do not layout more lines if ellipsis is enabled.
// The last line needs to be completely filled with characters.
// Part of a word may be used.
Size& layoutSize,
bool elideTextEnabled,
bool& isAutoScrollEnabled,
+ bool isAutoScrollMaxTextureExceeded,
DevelText::EllipsisPosition::Type ellipsisPosition)
{
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "-->LayoutText\n");
CharacterIndex lastCharacterInParagraph = currentParagraphRun.characterRun.characterIndex + currentParagraphRun.characterRun.numberOfCharacters - 1;
//check if this is the last line in paragraph, if false we should use the default relative line size (the one set using the property)
- if(lastCharacterInParagraph >= layout.characterIndex && lastCharacterInParagraph < layout.characterIndex+layout.numberOfCharacters)
+ if(lastCharacterInParagraph >= layout.characterIndex && lastCharacterInParagraph < layout.characterIndex + layout.numberOfCharacters)
{
layout.relativeLineSize = mRelativeLineSize;
}
numberOfLines,
penY,
isAutoScrollEnabled,
+ isAutoScrollMaxTextureExceeded,
ellipsisPosition,
false);
}
numberOfLines,
penY,
isAutoScrollEnabled,
+ isAutoScrollMaxTextureExceeded,
ellipsisPosition,
true);
}
Size& layoutSize,
bool elideTextEnabled,
bool& isAutoScrollEnabled,
+ bool isAutoScrollMaxTextureExceeded,
DevelText::EllipsisPosition::Type ellipsisPosition)
{
return mImpl->LayoutText(layoutParameters,
layoutSize,
elideTextEnabled,
isAutoScrollEnabled,
+ isAutoScrollMaxTextureExceeded,
ellipsisPosition);
}
* @param[out] layoutSize The size of the text after it has been laid-out.
* @param[in] elideTextEnabled Whether the text elide is enabled.
* @param[in,out] isAutoScrollEnabled If the isAutoScrollEnabled is true and the height of the text exceeds the boundaries of the control the text is elided and the isAutoScrollEnabled is set to false to disable the autoscroll
+ * @param[in] isAutoScrollMaxTextureExceeded If isAutoScrollMaxTextureExceeded is true, enable ellipsis during auro scroll.
* @param[in] ellipsisPosition The location of the text ellipsis
*
* @return \e true if the text has been re-laid-out. \e false means the given width is too small to layout even a single character.
Size& layoutSize,
bool elideTextEnabled,
bool& isAutoScrollEnabled,
+ bool isAutoScrollMaxTextureExceeded,
DevelText::EllipsisPosition::Type ellipsisPosition);
/**
mMarkupProcessorEnabled(false),
mClipboardHideEnabled(true),
mIsAutoScrollEnabled(false),
+ mIsAutoScrollMaxTextureExceeded(false),
mUpdateTextDirection(true),
mIsTextDirectionRTL(false),
mUnderlineSetByString(false),
std::unique_ptr<InputFilter> mInputFilter; ///< Avoid allocating this when the user does not specify input filter mode.
Vector2 mTextFitContentSize; ///< Size of Text fit content
- bool mRecalculateNaturalSize : 1; ///< Whether the natural size needs to be recalculated.
- bool mMarkupProcessorEnabled : 1; ///< Whether the mark-up procesor is enabled.
- bool mClipboardHideEnabled : 1; ///< Whether the ClipboardHide function work or not
- bool mIsAutoScrollEnabled : 1; ///< Whether auto text scrolling is enabled.
- bool mUpdateTextDirection : 1; ///< Whether the text direction needs to be updated.
- CharacterDirection mIsTextDirectionRTL : 1; ///< Whether the text direction is right to left or not
+ bool mRecalculateNaturalSize : 1; ///< Whether the natural size needs to be recalculated.
+ bool mMarkupProcessorEnabled : 1; ///< Whether the mark-up procesor is enabled.
+ bool mClipboardHideEnabled : 1; ///< Whether the ClipboardHide function work or not
+ bool mIsAutoScrollEnabled : 1; ///< Whether auto text scrolling is enabled.
+ bool mIsAutoScrollMaxTextureExceeded : 1; ///< Whether auto text scrolling is exceed max texture size.
+ bool mUpdateTextDirection : 1; ///< Whether the text direction needs to be updated.
+ CharacterDirection mIsTextDirectionRTL : 1; ///< Whether the text direction is right to left or not
bool mUnderlineSetByString : 1; ///< Set when underline is set by string (legacy) instead of map
bool mShadowSetByString : 1; ///< Set when shadow is set by string (legacy) instead of map
SHAPE_TEXT |
GET_GLYPH_METRICS);
- const OperationsMask sizeOperations = static_cast<OperationsMask>(LAYOUT | ALIGN | REORDER);
+ const OperationsMask sizeOperations = static_cast<OperationsMask>(LAYOUT | ALIGN | REORDER);
// Set the update info to relayout the whole text.
TextUpdateInfo& textUpdateInfo = impl.mTextUpdateInfo;
{
impl.UpdateModel(onlyOnceOperations);
+ if(impl.mIsAutoScrollEnabled)
+ {
+ // Layout the text for the new width.
+ operationsPending = static_cast<OperationsMask>(operationsPending | requestedOperationsMask);
+ }
+
DoRelayout(impl,
requestedControllerSize,
static_cast<OperationsMask>(onlyOnceOperations | requestedOperationsMask),
}
// Update the visual model.
- bool isAutoScrollEnabled = impl.mIsAutoScrollEnabled;
+ bool isAutoScrollEnabled = impl.mIsAutoScrollEnabled;
+ bool isAutoScrollMaxTextureExceeded = impl.mIsAutoScrollMaxTextureExceeded;
+
Size newLayoutSize;
viewUpdated = impl.mLayoutEngine.LayoutText(layoutParameters,
newLayoutSize,
elideTextEnabled,
isAutoScrollEnabled,
+ isAutoScrollMaxTextureExceeded,
ellipsisPosition);
impl.mIsAutoScrollEnabled = isAutoScrollEnabled;
void Controller::Relayouter::CalculateVerticalOffset(Controller::Impl& impl, const Size& controlSize)
{
- ModelPtr& model = impl.mModel;
- VisualModelPtr& visualModel = model->mVisualModel;
- Size layoutSize = model->mVisualModel->GetLayoutSize();
- Size oldLayoutSize = layoutSize;
- float offsetY = 0.f;
- bool needRecalc = false;
- float defaultFontLineHeight = impl.GetDefaultFontLineHeight();
+ ModelPtr& model = impl.mModel;
+ VisualModelPtr& visualModel = model->mVisualModel;
+ Size layoutSize = model->mVisualModel->GetLayoutSize();
+ Size oldLayoutSize = layoutSize;
+ float offsetY = 0.f;
+ bool needRecalc = false;
+ float defaultFontLineHeight = impl.GetDefaultFontLineHeight();
if(fabsf(layoutSize.height) < Math::MACHINE_EPSILON_1000)
{
mImpl->SetAutoScrollEnabled(enable);
}
+void Controller::SetAutoScrollMaxTextureExceeded(bool exceed)
+{
+ mImpl->mIsAutoScrollMaxTextureExceeded = exceed;
+}
+
bool Controller::IsAutoScrollEnabled() const
{
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Controller::IsAutoScrollEnabled[%s]\n", mImpl->mIsAutoScrollEnabled ? "true" : "false");
void SetAutoScrollEnabled(bool enable);
/**
+ * @brief Whether the auto scrolling texture exceed max texture.
+ *
+ * By default is false.
+ *
+ * @param[in] exceed Whether the auto scrolling texture exceed max texture.
+ */
+ void SetAutoScrollMaxTextureExceeded(bool exceed);
+
+ /**
* @brief Retrieves whether auto text scrolling is enabled.
*
* By default is disabled.