flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject git commit: [flex-asjs] [refs/heads/feature/mouseenter] - Change rollover and rollout to mouseenter and mouseleave Needs testing before merge
Date Tue, 11 Jul 2017 19:47:33 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/feature/mouseenter [created] 173858c7d


Change rollover and rollout to mouseenter and mouseleave
Needs testing before merge


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

Branch: refs/heads/feature/mouseenter
Commit: 173858c7df421b1c61ea5f6fd656155ccc3d502f
Parents: 46a07ec
Author: Harbs <harbs@in-tools.com>
Authored: Tue Jul 11 22:47:28 2017 +0300
Committer: Harbs <harbs@in-tools.com>
Committed: Tue Jul 11 22:47:28 2017 +0300

----------------------------------------------------------------------
 .../org/apache/flex/events/ElementEvents.as     |   4 +-
 .../flex/org/apache/flex/events/MouseEvent.as   | 125 +++----------------
 .../textLayout/events/FlowElementMouseEvent.as  |   8 ++
 3 files changed, 26 insertions(+), 111 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/173858c7/frameworks/projects/Core/src/main/flex/org/apache/flex/events/ElementEvents.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/ElementEvents.as
b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/ElementEvents.as
index fc1353b..3d6e5f6 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/ElementEvents.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/ElementEvents.as
@@ -64,8 +64,8 @@ package org.apache.flex.events
 				'mouseup': 1,
 				'mousedown': 1,
 				'mousemove': 1,
-				'rollover': 1,
-				'rollout': 1
+				'mouseenter': 1,
+				'mouseleave': 1
 			};
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/173858c7/frameworks/projects/Core/src/main/flex/org/apache/flex/events/MouseEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/MouseEvent.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/MouseEvent.as
index 3392d55..d4f28e5 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/MouseEvent.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/MouseEvent.as
@@ -46,18 +46,14 @@ package org.apache.flex.events
 	COMPILE::SWF
 	public class MouseEvent extends flash.events.MouseEvent implements IFlexJSEvent
 	{
-        private static function platformConstant(s:String):String
-        {
-            return s;
-        }
-
-		public static const MOUSE_DOWN:String = platformConstant("mouseDown");
-        public static const MOUSE_MOVE:String = platformConstant("mouseMove");
-		public static const MOUSE_UP:String = platformConstant("mouseUp");
-		public static const MOUSE_OUT:String = platformConstant("mouseOut");
-		public static const MOUSE_OVER:String = platformConstant("mouseOver");
-		public static const ROLL_OVER:String = platformConstant("rollOver");
-		public static const ROLL_OUT:String = platformConstant("rollOut");
+		//SWF constants are different than the JS ones
+		public static const MOUSE_DOWN:String = "mouseDown";
+        public static const MOUSE_MOVE:String = "mouseMove";
+		public static const MOUSE_UP:String = "mouseUp";
+		public static const MOUSE_OUT:String = "mouseOut";
+		public static const MOUSE_OVER:String = "mouseOver";
+		public static const ROLL_OVER:String = "rollOver";
+		public static const ROLL_OUT:String = "rollOut";
         public static const CLICK:String = "click";
 		public static const DOUBLE_CLICK:String = "doubleClick";
 		public static const WHEEL : String = "mouseWheel";
@@ -203,18 +199,14 @@ package org.apache.flex.events
 	COMPILE::JS
 	public class MouseEvent extends Event implements IFlexJSEvent
 	{
-		private static function platformConstant(s:String):String
-		{
-			return s.toLowerCase();
-		}
-
-		public static const MOUSE_DOWN:String = platformConstant("mouseDown");
-		public static const MOUSE_MOVE:String = platformConstant("mouseMove");
-		public static const MOUSE_UP:String = platformConstant("mouseUp");
-		public static const MOUSE_OUT:String = platformConstant("mouseOut");
-		public static const MOUSE_OVER:String = platformConstant("mouseOver");
-		public static const ROLL_OVER:String = platformConstant("rollOver");
-		public static const ROLL_OUT:String = platformConstant("rollOut");
+		//JS constants are different than the SWF ones
+		public static const MOUSE_DOWN:String = "mousedown";
+		public static const MOUSE_MOVE:String = "mousemove";
+		public static const MOUSE_UP:String = "mouseup";
+		public static const MOUSE_OUT:String = "mouseout";
+		public static const MOUSE_OVER:String = "mouseover";
+		public static const ROLL_OVER:String = "mouseenter";
+		public static const ROLL_OUT:String = "mouseleave";
 		public static const CLICK:String = "click";
 		public static const DOUBLE_CLICK:String = "dblclick";
 		public static const WHEEL : String = "wheel";
@@ -335,91 +327,6 @@ package org.apache.flex.events
 		}
 
 		/**
-		 * @private
-		 */
-		private static function installRollOverMixin():Boolean
-		{
-			window.addEventListener(MOUSE_OVER,
-				mouseOverHandler, false);
-			return true;
-		}
-
-
-		/**
-		 * @param e The event.
-		 * RollOver/RollOut is entirely implemented in mouseOver because
-		 * when a parent and child share an edge, you only get a mouseout
-		 * for the child and not the parent and you need to send rollout
-		 * to both.  A similar issue exists for rollover.
-		 */
-		private static function mouseOverHandler(e:MouseEvent):void
-		{
-			var j:int;
-			var m:int;
-			var outs:Array;
-			var me:window.MouseEvent;
-			var parent:Object;
-			var target:Object = e.target.flexjs_wrapper;
-			if (target == null)
-				return; // probably over the html tag
-			var targets:Array = MouseEvent.targets;
-			var index:int = targets.indexOf(target);
-			if (index != -1) {
-				// get all children
-				outs = targets.slice(index + 1);
-				m = outs.length;
-				for (j = 0; j < m; j++)
-				{
-					me = makeMouseEvent(
-						ROLL_OUT, e);
-					outs[j].element.dispatchEvent(me);
-				}
-				MouseEvent.targets = targets.slice(0, index + 1);
-			}
-			else {
-				var newTargets:Array = [target];
-				if (!('parent' in target))
-					parent = null;
-				else
-					parent = target.parent;
-				while (parent) {
-					index = targets.indexOf(parent);
-					if (index == -1) {
-						newTargets.unshift(parent);
-						if (!('parent' in parent))
-							break;
-						parent = parent.parent;
-					}
-					else {
-						outs = targets.slice(index + 1);
-						m = outs.length;
-						for (j = 0; j < m; j++) {
-							me = makeMouseEvent(
-								ROLL_OUT, e);
-							outs[j].element.dispatchEvent(me);
-						}
-						targets = targets.slice(0, index + 1);
-						break;
-					}
-				}
-				var n:int = newTargets.length;
-				for (var i:int = 0; i < n; i++) {
-					me = makeMouseEvent(
-						ROLL_OVER, e);
-					newTargets[i].element.dispatchEvent(me);
-				}
-				MouseEvent.targets = targets.concat(newTargets);
-			}
-		}
-
-
-		/**
-		 */
-		private static var rollOverMixin:Boolean =
-			installRollOverMixin();
-
-
-		/**
 		 */
 		private static var targets:Array = [];
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/173858c7/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEvent.as
b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEvent.as
index c3083dc..7f0f1cc 100644
--- a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEvent.as
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/events/FlowElementMouseEvent.as
@@ -103,7 +103,11 @@ package org.apache.flex.textLayout.events
 		 * @playerversion AIR 1.5
 		 * @langversion 3.0 
 		 */
+		COMPILE::SWF
 		public static const ROLL_OVER:String = "rollOver";
+
+		COMPILE::JS
+		public static const ROLL_OVER:String = "mouseenter";
 		/**
 		 * Defines the value of the <code>type</code> property of a <code>rollOut</code>
event object. 
 		 * 
@@ -113,7 +117,11 @@ package org.apache.flex.textLayout.events
 		 * @playerversion AIR 1.5
 		 * @langversion 3.0 
 		 */
+		COMPILE::SWF
 		public static const ROLL_OUT:String = "rollOut";	
+
+		COMPILE::JS
+		public static const ROLL_OUT:String = "mouseleave";	
 		/**
 		 * Defines the value of the <code>type</code> property of a <code>click</code>
event object. 
 		 * 


Mime
View raw message