flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pio...@apache.org
Subject [11/50] [abbrv] flex-asjs git commit: A bit messy and there’s no way to currently set coordinates on MouseEvents in HTML (is that needed?), but this fixes mouse event coordinates from going bonkers.
Date Mon, 31 Jul 2017 22:31:32 GMT
A bit messy and there’s no way to currently set coordinates on MouseEvents in HTML (is that
needed?), but this fixes mouse event coordinates from going bonkers.


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

Branch: refs/heads/feature/amf
Commit: 5224af3ffb85c475ec9d2f5e586efc51175061f5
Parents: 76dd35c
Author: Harbs <harbs@in-tools.com>
Authored: Sun Jul 23 14:30:41 2017 +0300
Committer: Harbs <harbs@in-tools.com>
Committed: Sun Jul 23 14:30:41 2017 +0300

----------------------------------------------------------------------
 .../projects/Core/src/main/flex/CoreClasses.as  |   1 +
 .../flex/org/apache/flex/events/BrowserEvent.as |  11 +-
 .../org/apache/flex/events/KeyboardEvent.as     |   5 +-
 .../flex/org/apache/flex/events/MouseEvent.as   | 105 ++++++++++---------
 .../flex/events/utils/MouseEventConverter.as    |   4 +-
 5 files changed, 59 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5224af3f/frameworks/projects/Core/src/main/flex/CoreClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/CoreClasses.as b/frameworks/projects/Core/src/main/flex/CoreClasses.as
index fd6c8a2..25a2c13 100644
--- a/frameworks/projects/Core/src/main/flex/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/flex/CoreClasses.as
@@ -179,6 +179,7 @@ internal class CoreClasses
 	import org.apache.flex.utils.JXON; JXON;
 	import org.apache.flex.utils.MD5; MD5;
 	import org.apache.flex.utils.OSUtils; OSUtils;
+	import org.apache.flex.utils.PointUtils; PointUtils;
     import org.apache.flex.utils.StringPadder; StringPadder;
 	import org.apache.flex.utils.StringTrimmer; StringTrimmer;
 	import org.apache.flex.utils.StringUtil; StringUtil;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5224af3f/frameworks/projects/Core/src/main/flex/org/apache/flex/events/BrowserEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/BrowserEvent.as
b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/BrowserEvent.as
index b0ec5b8..9bcad2e 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/BrowserEvent.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/BrowserEvent.as
@@ -353,16 +353,7 @@ package org.apache.flex.events
 		 */
 		public function get relatedTarget():Object
 		{
-			var o:Object = wrappedEvent.relatedTarget;
-
-			if (o)
-			{
-				if (o.flexjs_wrapper)
-					return o.flexjs_wrapper;
-				if (o.parentNode && o.parentNode.flexjs_wrapper)
-				    return o.parentNode.flexjs_wrapper;
-			}
-			return o;
+			return getTargetWrapper(wrappedEvent.relatedTarget);
 		}
 
 		/**

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5224af3f/frameworks/projects/Core/src/main/flex/org/apache/flex/events/KeyboardEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/KeyboardEvent.as
b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/KeyboardEvent.as
index f60110f..cf9109a 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/KeyboardEvent.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/KeyboardEvent.as
@@ -21,6 +21,7 @@ package org.apache.flex.events
     COMPILE::JS
     {
         import goog.events.BrowserEvent;
+		import org.apache.flex.events.Event;
     }
     import org.apache.flex.events.IBrowserEvent;
 
@@ -78,7 +79,7 @@ package org.apache.flex.events
         COMPILE::JS
 		public function get target():Object
 		{
-			return wrappedEvent ? getTargetWrapper(wrappedEvent.target) : super.target;
+			return wrappedEvent ? getTargetWrapper(wrappedEvent.target) : null;
 		}
 
 		/**
@@ -92,7 +93,7 @@ package org.apache.flex.events
         COMPILE::JS
 		public function get currentTarget():Object
 		{
-			return wrappedEvent ? getTargetWrapper(wrappedEvent.currentTarget) : super.currentTarget;
+			return wrappedEvent ? getTargetWrapper(wrappedEvent.currentTarget) : null;
 		}
 
         private var _key:String;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5224af3f/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 1296065..37ec839 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
@@ -27,8 +27,9 @@ package org.apache.flex.events
     COMPILE::JS
     {
         import window.MouseEvent;
-		import org.apache.flex.events.utils.EventUtils;
 		import goog.events.BrowserEvent;
+		import org.apache.flex.events.Event;
+		import org.apache.flex.events.utils.EventUtils;
     }
     
     import org.apache.flex.core.IFlexJSElement;
@@ -243,8 +244,8 @@ package org.apache.flex.events
 		{
 			super(type, bubbles, cancelable);
 
-			this.localX = localX;
-			this.localY = localY;
+			// this.localX = localX;
+			// this.localY = localY;
 			this.relatedObject = relatedObject;
 			this.ctrlKey = ctrlKey;
 			this.altKey = altKey;
@@ -259,37 +260,13 @@ package org.apache.flex.events
 		/**
 		 * @type {?goog.events.BrowserEvent}
 		 */
-		COMPILE::JS
 		private var wrappedEvent:Object;
 
-        COMPILE::JS
 		public function wrapEvent(event:goog.events.BrowserEvent):void
         {
             wrappedEvent = event;
         }
 
-		private var _localX:Number;
-		public function get localX():Number
-		{
-			return _localX;
-		}
-		public function set localX(value:Number):void
-		{
-			_localX = value;
-			_stagePoint = null;
-		}
-
-		private var _localY:Number;
-		public function get localY():Number
-		{
-			return _localY;
-		}
-		public function set localY(value:Number):void
-		{
-			_localY = value;
-			_stagePoint = null;
-		}
-
 		public var relatedObject:Object;
 		public var ctrlKey:Boolean;
 		public var altKey:Boolean;
@@ -337,7 +314,7 @@ package org.apache.flex.events
 		 */
 		public function get target():Object
 		{
-			return wrappedEvent ? getTargetWrapper(wrappedEvent.target) : super.target;
+			return wrappedEvent ? getTargetWrapper(wrappedEvent.target) : null;
 		}
 
 		/**
@@ -350,7 +327,7 @@ package org.apache.flex.events
 		 */
 		public function get currentTarget():Object
 		{
-			return wrappedEvent ? getTargetWrapper(wrappedEvent.currentTarget) : super.currentTarget;
+			return wrappedEvent ? getTargetWrapper(wrappedEvent.currentTarget) : null;
 		}
 
 		// TODO remove this when figure out how to preserve the real target
@@ -359,46 +336,70 @@ package org.apache.flex.events
 		{
 			return target;
 		}
-		// these map directly to JS MouseEvent fields.
+		/**
+		 * X-coordinate relative to the window.
+		 * @type {number}
+         *
+         * @langversion 3.0
+         * @playerversion Flash 10.2
+         * @playerversion AIR 2.6
+         * @productversion FlexJS 0.0
+		 */
 		public function get clientX():Number
 		{
-			return screenX;
+			return wrappedEvent.clientX;
 		}
-		public function set clientX(value:Number):void
+
+		public function get localX():Number
 		{
-			localX = value;
+			return clientX;
 		}
+
+		/**
+		 * Y-coordinate relative to the window.
+		 * @type {number}
+         *
+         * @langversion 3.0
+         * @playerversion Flash 10.2
+         * @playerversion AIR 2.6
+         * @productversion FlexJS 0.0
+		 */
 		public function get clientY():Number
 		{
-			return screenY;
+			return wrappedEvent.clientY;
 		}
-		public function set clientY(value:Number):void
+
+		public function get localY():Number
 		{
-			localY = value;
+			return clientY;
 		}
 
-		private var _stagePoint:Point;
-	
+		/**
+		 * X-coordinate relative to the monitor.
+		 * @type {number}
+         *
+         * @langversion 3.0
+         * @playerversion Flash 10.2
+         * @playerversion AIR 2.6
+         * @productversion FlexJS 0.0
+		 */
 		public function get screenX():Number
 		{
-			if (!target) return localX;
-			if (!_stagePoint)
-			{
-				var localPoint:Point = new Point(localX, localY);
-				_stagePoint = PointUtils.localToGlobal(localPoint, target);
-			}
-			return _stagePoint.x;
+			return wrappedEvent.screenX;
 		}
 
+		/**
+		 * Y-coordinate relative to the monitor.
+		 * @type {number}
+         *
+         * @langversion 3.0
+         * @playerversion Flash 10.2
+         * @playerversion AIR 2.6
+         * @productversion FlexJS 0.0
+		 */
 		public function get screenY():Number
 		{
-			if (!target) return localY;
-			if (!_stagePoint)
-			{
-				var localPoint:Point = new Point(localX, localY);
-				_stagePoint = PointUtils.localToGlobal(localPoint, target);
-			}
-			return _stagePoint.y;
+			return wrappedEvent.screenY;
 		}
 
 		/**

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5224af3f/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/MouseEventConverter.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/MouseEventConverter.as
b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/MouseEventConverter.as
index b98177d..5cd5c90 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/MouseEventConverter.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/MouseEventConverter.as
@@ -179,9 +179,7 @@ package org.apache.flex.events.utils
 	{
         public static function convert(nativeEvent:Object):MouseEvent
         {
-            return new MouseEvent(nativeEvent["type"], true, false,
-                nativeEvent["clientX"], nativeEvent["clientY"], null,
-                nativeEvent["ctrlKey"], nativeEvent["altKey"], nativeEvent["shiftKey"]);
+            return new MouseEvent(nativeEvent["type"], nativeEvent["bubbles"], nativeEvent["cancelable"]);
         }
     }
 


Mime
View raw message