This patch solves the problem that text with padding does not work in nui layout.
For text components, the control's padding is used to calculatie size in native,
so it should not be set to zero value.
This avoids setting padding to zero when it comes to text layout.
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
GrabHandleColor = new Color(r, g, b, a);
}
- private class TextEditorLayout : LayoutItem
+ internal class TextEditorLayout : LayoutItem
{
protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
{
GrabHandleColor = new Color(r, g, b, a);
}
- private class TextFieldLayout : LayoutItem
+ internal class TextFieldLayout : LayoutItem
{
protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
{
/// <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)
{
internal override LayoutItem CreateDefaultLayout()
{
- return new TextLayout();
+ return new TextLabelLayout();
}
/// <summary>
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;