flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject [07/50] git commit: [flex-asjs] [refs/heads/feature/strand-work] - Added delta, deltaX and deltaY for mouse wheel events Needs tests
Date Tue, 08 Aug 2017 21:15:43 GMT
Added delta, deltaX and deltaY for mouse wheel events
Needs tests


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

Branch: refs/heads/feature/strand-work
Commit: 0d9fe0ccf79f14212d14f7ac59aa958894c45520
Parents: c166120
Author: Harbs <harbs@in-tools.com>
Authored: Wed Jul 26 19:24:03 2017 +0300
Committer: Harbs <harbs@in-tools.com>
Committed: Wed Jul 26 19:24:03 2017 +0300

----------------------------------------------------------------------
 .../org/apache/flex/events/KeyboardEvent.as     |   9 +-
 .../flex/org/apache/flex/events/MouseEvent.as   | 110 +++++++++++++++++--
 2 files changed, 111 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0d9fe0cc/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 71b4dd1..b3992d4 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
@@ -43,10 +43,17 @@ package org.apache.flex.events
         COMPILE::JS
 		private var wrappedEvent:Object;
 
+		/**
+		 * @type {KeyboardEvent}
+		 */
+        COMPILE::JS
+		private var nativeEvent:Object;
+
         COMPILE::JS
 		public function wrapEvent(event:goog.events.BrowserEvent):void
         {
             wrappedEvent = event;
+            nativeEvent = event.getBrowserEvent();
         }
 
         public function KeyboardEvent(
@@ -194,7 +201,7 @@ package org.apache.flex.events
             if(wrappedEvent)
             {
 			    wrappedEvent.stopPropagation();
-			    wrappedEvent.getBrowserEvent().stopImmediatePropagation();
+			    nativeEvent.stopImmediatePropagation();
             }
 		}
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0d9fe0cc/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 14a3af7..d35ade7 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
@@ -151,7 +151,44 @@ package org.apache.flex.events
         {
             return cloneEvent() as flash.events.Event;
         }
-        
+		/**
+         *  The horizontal scroll delta for wheel events
+		 *  In Flash this always returns 0.
+         *
+         * @langversion 3.0
+         * @playerversion Flash 10.2
+         * @playerversion AIR 2.6
+         * @productversion FlexJS 0.9
+		 */
+		public function get deltaX():int
+		{
+			return 0;
+		}
+		/**
+		 * Horizontal wheel events are not supported in Flash
+		 */
+		public function set deltaX(value:int):void
+		{
+			
+		}
+
+		/**
+         *  The vertical scroll delta for wheel events
+		 *  In Flash this just proxies to the delta
+         *
+         * @langversion 3.0
+         * @playerversion Flash 10.2
+         * @playerversion AIR 2.6
+         * @productversion FlexJS 0.9
+		 */
+		public function get deltaY():int
+		{
+			return delta
+		}
+		public function set deltaY(value:int):void
+		{
+			delta = value;
+		}        
         /**
          * Create a copy/clone of the Event object.
          *
@@ -261,10 +298,16 @@ package org.apache.flex.events
 		 * @type {?goog.events.BrowserEvent}
 		 */
 		private var wrappedEvent:Object;
+		
+		/**
+		 * @type {MouseEvent}
+		 */
+		private var nativeEvent:Object;
 
 		public function wrapEvent(event:goog.events.BrowserEvent):void
         {
             wrappedEvent = event;
+			nativeEvent = event.getBrowserEvent();
         }
 
 		public var relatedObject:Object;
@@ -278,12 +321,11 @@ package org.apache.flex.events
 				return _buttons == 1;
 			if(!wrappedEvent)
 				return false;
-			var ev:* = wrappedEvent.getBrowserEvent();
 			//Safari does not yet support buttons
-			if ('buttons' in ev)
-				_buttons = ev["buttons"];
+			if ('buttons' in nativeEvent)
+				_buttons = nativeEvent["buttons"];
 			else
-				_buttons = ev["which"];
+				_buttons = nativeEvent["which"];
 			return _buttons == 1;
 		}
 		public function set buttonDown(value:Boolean):void
@@ -299,7 +341,61 @@ package org.apache.flex.events
 		{
 			_buttons = value;
 		}
-		public var delta:int;
+
+		private var _delta:int;
+		/**
+         *  The vertical scroll delta for wheel events
+         *
+         * @langversion 3.0
+         * @playerversion Flash 10.2
+         * @playerversion AIR 2.6
+         * @productversion FlexJS 0.9
+		 */
+		public function get delta():int
+		{
+			return nativeEvent ? nativeEvent.deltaY : _delta;
+		}
+		public function set delta(value:int):void
+		{
+			_delta = value;
+		}
+
+		private var _deltaX:int;
+		/**
+         *  The horizontal scroll delta for wheel events
+         *
+         * @langversion 3.0
+         * @playerversion Flash 10.2
+         * @playerversion AIR 2.6
+         * @productversion FlexJS 0.9
+		 */
+		public function get deltaX():int
+		{
+			return nativeEvent ? nativeEvent.deltaX : _deltaX;
+		}
+		public function set deltaX(value:int):void
+		{
+			_deltaX = value;
+		}
+
+		private var _deltaY:int;
+		/**
+         *  The vertical scroll delta for wheel events
+         *
+         * @langversion 3.0
+         * @playerversion Flash 10.2
+         * @playerversion AIR 2.6
+         * @productversion FlexJS 0.9
+		 */
+		public function get deltaY():int
+		{
+			return nativeEvent ? nativeEvent.deltaY : _deltaY;
+		}
+		public function set deltaY(value:int):void
+		{
+			_deltaY = value;
+		}
+		
 		public var commandKey:Boolean;
 		public var controlKey:Boolean;
 		public var clickCount:int;
@@ -606,7 +702,7 @@ package org.apache.flex.events
             if(wrappedEvent)
             {
 			    wrappedEvent.stopPropagation();
-			    wrappedEvent.getBrowserEvent().stopImmediatePropagation();
+			    nativeEvent.stopImmediatePropagation();
             }
 		}
 


Mime
View raw message