Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NUI] Fix text padding issue #5857

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2827,7 +2827,7 @@ private void OnGrabHandleColorChanged(float r, float g, float b, float a)
GrabHandleColor = new Color(r, g, b, a);
}

private class TextEditorLayout : LayoutItem
internal class TextEditorLayout : LayoutItem
{
protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Tizen.NUI/src/public/BaseComponents/TextField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2832,7 +2832,7 @@ private void OnGrabHandleColorChanged(float r, float g, float b, float a)
GrabHandleColor = new Color(r, g, b, a);
}

private class TextFieldLayout : LayoutItem
internal class TextFieldLayout : LayoutItem
{
protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace Tizen.NUI.BaseComponents
/// <since_tizen> 3 </since_tizen>
public partial class TextLabel : View
{
private class TextLayout : LayoutItem
internal class TextLabelLayout : LayoutItem
{
protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
{
Expand Down Expand Up @@ -1765,7 +1765,7 @@ protected override ViewStyle CreateViewStyle()

internal override LayoutItem CreateDefaultLayout()
{
return new TextLayout();
return new TextLabelLayout();
}

/// <summary>
Expand Down
8 changes: 7 additions & 1 deletion src/Tizen.NUI/src/public/BaseComponents/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3008,7 +3008,13 @@ private LayoutItem InternalLayout
setMargin = true;
}

if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
// The calculation of the native size of the text component requires padding.
// Don't overwrite the zero padding.
bool isTextLayout = (value is Tizen.NUI.BaseComponents.TextLabel.TextLabelLayout) ||
(value is Tizen.NUI.BaseComponents.TextField.TextFieldLayout) ||
(value is Tizen.NUI.BaseComponents.TextEditor.TextEditorLayout);

if (!isTextLayout && (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0))
{
// If View already has a padding set then store it in Layout instead.
value.Padding = padding;
Expand Down
Loading