You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2017/07/11 05:40:30 UTC

[3/5] git commit: [flex-asjs] [refs/heads/develop] - FLEX-35339 stop tool tip flashing on and off like mad when you mouse over it

FLEX-35339 stop tool tip flashing on and off like mad when you mouse over it


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/c0d218f5
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/c0d218f5
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/c0d218f5

Branch: refs/heads/develop
Commit: c0d218f5bf0e83d2f82fa1979aad0ff09b6317f2
Parents: 549a10d
Author: Justin Mclean <jm...@apache.org>
Authored: Tue Jul 11 15:36:05 2017 +1000
Committer: Justin Mclean <jm...@apache.org>
Committed: Tue Jul 11 15:36:05 2017 +1000

----------------------------------------------------------------------
 .../apache/flex/html/accessories/ToolTipBead.as | 47 +++++++++++---------
 1 file changed, 25 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c0d218f5/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/ToolTipBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/ToolTipBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/ToolTipBead.as
index bdf0b68..b1f0620 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/ToolTipBead.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/ToolTipBead.as
@@ -18,26 +18,23 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html.accessories
 {
-	
+
 	import org.apache.flex.core.IBead;
 	import org.apache.flex.core.IPopUpHost;
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.core.IUIBase;
-	import org.apache.flex.core.UIBase;
-	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
 	import org.apache.flex.events.MouseEvent;
-	import org.apache.flex.events.utils.MouseUtils;
 	import org.apache.flex.geom.Point;
 	import org.apache.flex.html.ToolTip;
 	import org.apache.flex.utils.PointUtils;
 	import org.apache.flex.utils.UIUtils;
-	
+
 	/**
 	 *  The ToolTipBead class is a specialty bead that can be used with
 	 *  any control. The bead floats a string over a control if
      *  the user hovers over the control with a mouse.
-	 *  
+	 *
 	 *  @langversion 3.0
 	 *  @playerversion Flash 10.2
 	 *  @playerversion AIR 2.6
@@ -56,9 +53,9 @@ package org.apache.flex.html.accessories
 		public function ToolTipBead()
 		{
 		}
-		
+
 		private var _toolTip:String;
-		
+
 		/**
 		 *  The string to use as the toolTip.
 		 *
@@ -75,12 +72,12 @@ package org.apache.flex.html.accessories
 		{
             _toolTip = value;
 		}
-		
+
 		private var _strand:IStrand;
-		
+
 		/**
 		 *  @copy org.apache.flex.core.IBead#strand
-		 *  
+		 *
 		 *  @langversion 3.0
 		 *  @playerversion Flash 10.2
 		 *  @playerversion AIR 2.6
@@ -92,32 +89,34 @@ package org.apache.flex.html.accessories
 
             IEventDispatcher(_strand).addEventListener(MouseEvent.MOUSE_OVER, rollOverHandler, false);
 		}
-		
+
         private var tt:ToolTip;
         private var host:IPopUpHost;
-        
+
 		/**
 		 * @private
 		 */
 		protected function rollOverHandler( event:MouseEvent ):void
 		{
-			if (!toolTip)
+			if (!toolTip || tt)
 				return;
 
             IEventDispatcher(_strand).addEventListener(MouseEvent.MOUSE_OUT, rollOutHandler, false);
-            
+
             var comp:IUIBase = _strand as IUIBase
             host = UIUtils.findPopUpHost(comp);
 			if (tt) host.removeElement(tt);
-			
+
             tt = new ToolTip();
             tt.text = toolTip;
             var pt:Point = determinePosition(event, event.target);
             tt.x = pt.x;
             tt.y = pt.y;
             host.addElement(tt, false); // don't trigger a layout
+
+			tt.addEventListener(MouseEvent.MOUSE_OUT, rollOutHandler, false);
 		}
-		
+
 		/**
 		 * @private
 		 * Determines the position of the toolTip.
@@ -129,16 +128,20 @@ package org.apache.flex.html.accessories
 			pt = PointUtils.localToGlobal(pt, comp);
 			return pt;
 		}
-        
+
         /**
          * @private
          */
-        private function rollOutHandler( event:MouseEvent ):void
-        {	
-            if (tt) {
+        private function rollOutHandler(event:MouseEvent):void
+        {
+			var comp:IUIBase = _strand as IUIBase;
+			var outside:Boolean = event.clientX > comp.width || event.clientY > comp.height;
+            // check for outside otherwise tool tip itself with flash when you roll over it
+            if (tt && outside) {
                 host.removeElement(tt);
+				tt = null;
 			}
-            tt = null;
         }
 	}
 }
+