From: huiyueun <35286162+huiyueun@users.noreply.github.com> Date: Thu, 8 Apr 2021 01:10:34 +0000 (+0900) Subject: Revert "[NUI] Button text ellipsis enabled and etc. (#2772)" (#2858) X-Git-Tag: citest_t1~164 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=596bb2041b230e595b9564f84676a200e605ccb1;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Revert "[NUI] Button text ellipsis enabled and etc. (#2772)" (#2858) This reverts commit 86409caf7bffd2b7b3e0aa7a827a51b449938b1e. Signed-off-by: huiyu.eun --- diff --git a/src/Tizen.NUI.Components/Controls/Button.Internal.cs b/src/Tizen.NUI.Components/Controls/Button.Internal.cs index 6109be4..c6ef247 100755 --- a/src/Tizen.NUI.Components/Controls/Button.Internal.cs +++ b/src/Tizen.NUI.Components/Controls/Button.Internal.cs @@ -69,7 +69,7 @@ namespace Tizen.NUI.Components { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, - AccessibilityHighlightable = false, + AccessibilityHighlightable = false }; } @@ -274,8 +274,6 @@ namespace Tizen.NUI.Components buttonText = CreateText(); buttonIcon = CreateIcon(); - buttonText.Relayout += OnTextRelayout; - buttonIcon.Relayout += OnIconRelayout; LayoutItems(); #if PROFILE_MOBILE @@ -371,64 +369,6 @@ namespace Tizen.NUI.Components } } - private void OnTextOrIconUpdated() - { - if (buttonIcon == null || buttonText == null) - { - return; - } - - float lengthWithoutText = 0; - - if (iconPadding == null || buttonIcon.Size.Width == 0 || buttonIcon.Size.Height == 0) - { - buttonIcon.Margin = new Extents(0); - lengthWithoutText = buttonIcon.Size.Width; - } - else if (iconRelativeOrientation == IconOrientation.Left || iconRelativeOrientation == IconOrientation.Right) - { - buttonIcon.Margin = new Extents(iconPadding.Start, iconPadding.End, 0, 0); - lengthWithoutText = iconPadding.Start + iconPadding.End + buttonIcon.Size.Width; - } - else - { - buttonIcon.Margin = new Extents(0, 0, iconPadding.Top, iconPadding.Bottom); - } - - if (textPadding == null || buttonText.Size.Width == 0 || buttonText.Size.Height == 0) - { - buttonText.Margin = new Extents(0); - } - else - { - if (iconRelativeOrientation == IconOrientation.Left || iconRelativeOrientation == IconOrientation.Right) - { - buttonText.Margin = new Extents(textPadding.Start, textPadding.End, 0, 0); - lengthWithoutText += textPadding.Start + textPadding.End; - } - else - { - buttonText.Margin = new Extents(0, 0, textPadding.Top, textPadding.Bottom); - } - } - - // If the button has fixed width and the text is not empty, the text should not exceed button boundary. - if (WidthSpecification >= 0 && !String.IsNullOrEmpty(buttonText.Text)) - { - buttonText.MaximumSize = new Size2D(Math.Max(WidthSpecification - (int)lengthWithoutText, Math.Max((int)buttonText.MinimumSize.Width, 1)), HeightSpecification); - } - } - - private void OnIconRelayout(object sender, EventArgs args) - { - OnTextOrIconUpdated(); - } - - private void OnTextRelayout(object sender, EventArgs args) - { - OnTextOrIconUpdated(); - } - private void OnClickedInternal(ClickedEventArgs eventArgs) { Command?.Execute(CommandParameter); diff --git a/src/Tizen.NUI.Components/Controls/Button.cs b/src/Tizen.NUI.Components/Controls/Button.cs index a10fd20..2e466df 100755 --- a/src/Tizen.NUI.Components/Controls/Button.cs +++ b/src/Tizen.NUI.Components/Controls/Button.cs @@ -128,7 +128,10 @@ namespace Tizen.NUI.Components { var instance = (Button)bindable; instance.iconPadding = (Extents)((Extents)newValue).Clone(); - instance.OnTextOrIconUpdated(); + if (instance.buttonIcon != null) + { + instance.buttonIcon.Margin = instance.iconPadding; + } }, defaultValueCreator: (bindable) => ((Button)bindable).iconPadding); @@ -138,7 +141,10 @@ namespace Tizen.NUI.Components { var instance = (Button)bindable; instance.textPadding = (Extents)((Extents)newValue).Clone(); - instance.OnTextOrIconUpdated(); + if (instance.buttonText != null) + { + instance.buttonText.Margin = instance.textPadding; + } }, defaultValueCreator: (bindable) => ((Button)bindable).textPadding); @@ -731,15 +737,9 @@ namespace Tizen.NUI.Components if (Extension != null) { buttonIcon.Unparent(); - buttonIcon.Relayout -= OnIconRelayout; - buttonIcon = Extension.OnCreateIcon(this, buttonIcon); - buttonIcon.Relayout += OnIconRelayout; - buttonText.Unparent(); - buttonText.Relayout -= OnTextRelayout; + buttonIcon = Extension.OnCreateIcon(this, buttonIcon); buttonText = Extension.OnCreateText(this, buttonText); - buttonText.Relayout += OnTextRelayout; - LayoutItems(); } diff --git a/src/Tizen.NUI.Components/Controls/Switch.cs b/src/Tizen.NUI.Components/Controls/Switch.cs index 80d8ca7..b0efa7b 100755 --- a/src/Tizen.NUI.Components/Controls/Switch.cs +++ b/src/Tizen.NUI.Components/Controls/Switch.cs @@ -65,10 +65,7 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] public override void OnInitialize() { - track = new ImageView() - { - EnableControlStatePropagation = true - }; + track = new ImageView(); thumb = new ImageView(); track.Add(thumb);