From de292c8e8655312fb155316dfde6f02255116c94 Mon Sep 17 00:00:00 2001 From: Bowon Ryu Date: Thu, 20 Jun 2024 13:18:20 +0900 Subject: [PATCH] Fix async auto scroll issue Fixed the problem of text being drawn outside the text control area during auto-scroll due to incorrect transform size and natural size calculation. Change-Id: I866d25326a41b998c136f3a6ec1ed25358c77345 Signed-off-by: Bowon Ryu --- dali-toolkit/internal/text/async-text/async-text-loader-impl.cpp | 4 +++- dali-toolkit/internal/visuals/text/text-visual.cpp | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dali-toolkit/internal/text/async-text/async-text-loader-impl.cpp b/dali-toolkit/internal/text/async-text/async-text-loader-impl.cpp index bc5b702..8fa3e71 100644 --- a/dali-toolkit/internal/text/async-text/async-text-loader-impl.cpp +++ b/dali-toolkit/internal/text/async-text/async-text-loader-impl.cpp @@ -1102,7 +1102,9 @@ AsyncTextRenderInfo AsyncTextLoader::RenderAutoScroll(AsyncTextParameters& param const Size controlSize(static_cast(parameters.textWidth), static_cast(parameters.textHeight)); // As relayout of text may not be done at this point natural size is used to get size. Single line scrolling only. - const Size textNaturalSize = CalculateNaturalSize(parameters); + Size textNaturalSize = CalculateNaturalSize(parameters); + textNaturalSize.width += (parameters.padding.start + parameters.padding.end); + textNaturalSize.height += (parameters.padding.top + parameters.padding.bottom); DALI_LOG_RELEASE_INFO("-->AsyncTextLoader::RenderAutoScroll natural size : %f, %f, control size : %f, %f \n", textNaturalSize.x, textNaturalSize.y, controlSize.x, controlSize.y); diff --git a/dali-toolkit/internal/visuals/text/text-visual.cpp b/dali-toolkit/internal/visuals/text/text-visual.cpp index eefa52c..2182dc8 100644 --- a/dali-toolkit/internal/visuals/text/text-visual.cpp +++ b/dali-toolkit/internal/visuals/text/text-visual.cpp @@ -741,6 +741,13 @@ void TextVisual::LoadComplete(bool loadingSuccess, TextInformation textInformati // Size of the text control including padding. Vector2 textControlSize(static_cast(parameters.textWidth) + (parameters.padding.start + parameters.padding.end), static_cast(parameters.textHeight) + (parameters.padding.top + parameters.padding.bottom)); + if(parameters.isAutoScrollEnabled) + { + // In case of auto scroll, the layout width (renderInfo's width) is the natural size of the text. + // Since the layout size is the size of the visual transform, it should be reset to the text area excluding padding. + layoutSize.width = parameters.textWidth; + } + Vector2 visualTransformOffset; if(renderInfo.isCutout) { -- 2.7.4