You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by yi...@apache.org on 2022/07/12 12:56:27 UTC

[royale-asjs] branch develop updated: Make sure trunction tooltip does not wipe out explicit tooltip

This is an automated email from the ASF dual-hosted git repository.

yishayw pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 881fc31c9b Make sure trunction tooltip does not wipe out explicit tooltip
     new 35eb71dc2b Merge branch 'develop' of https://github.com/apache/royale-asjs into develop
881fc31c9b is described below

commit 881fc31c9b5eba383110ec192f32d1938bc81de9
Author: Yishay Weiss <yi...@hotmail.com>
AuthorDate: Tue Jul 12 15:56:05 2022 +0300

    Make sure trunction tooltip does not wipe out explicit tooltip
---
 .../MXRoyale/src/main/royale/mx/controls/Label.as   | 21 ++++++++++++++++-----
 .../MXRoyale/src/main/royale/mx/core/UIComponent.as |  2 +-
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Label.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Label.as
index 40217b8eb1..bf3de6f7c4 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Label.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Label.as
@@ -58,6 +58,7 @@ import org.apache.royale.core.ITextModel;
 import org.apache.royale.events.Event;
 import org.apache.royale.binding.ItemRendererDataBinding;
 import org.apache.royale.events.ValueEvent;
+import mx.controls.beads.ToolTipBead;
 
 //--------------------------------------
 //  Events
@@ -929,7 +930,7 @@ public class Label extends UIComponent
                 {
                     addBead(new OverflowTooltipNeeded());
                 }
-                addEventListener(OverflowTooltipNeeded.TOOL_TIP_NEEDED, tooltipNeededListener);
+                addEventListener(OverflowTooltipNeeded.TOOL_TIP_NEEDED, truncationToolTipNeededListener);
             }
         } else if (_truncationBead && _truncateToFit && !value)
         {
@@ -942,13 +943,23 @@ public class Label extends UIComponent
     }
     
     COMPILE::JS
-    private function tooltipNeededListener(event:ValueEvent):void
+    private function truncationToolTipNeededListener(event:ValueEvent):void
     {
-        toolTip = event.value ? text : "";
+        if (toolTip)
+        {
+            return;
+        }
+        if (!_toolTipBead)
+        {
+            _toolTipBead = new ToolTipBead();
+            addBead(_toolTipBead);
+        }
+        if (event.value)
+        {
+            _toolTipBead.toolTip = text;
+        }
     }
 
-
-
     //--------------------------------------------------------------------------
     //
     //  Methods
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
index ab8060f655..ee1884f5e8 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
@@ -3825,7 +3825,7 @@ COMPILE::JS
      */
     private var _toolTip:String;
 	
-	private var _toolTipBead: ToolTipBead;
+	protected var _toolTipBead: ToolTipBead;
 	private var _disableBead: DisableBead;
 
     [Bindable("toolTipChanged")]