flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Piotr Zarzycki <piotrzarzyck...@gmail.com>
Subject Re: git commit: [flex-asjs] [refs/heads/feature/browser-event] - Cleaned up typing of native events
Date Fri, 21 Jul 2017 06:43:40 GMT
Thank you! :) <3

2017-07-21 8:41 GMT+02:00 <harbs@apache.org>:

> Repository: flex-asjs
> Updated Branches:
>   refs/heads/feature/browser-event 273526e94 -> 294c3d6ab
>
>
> Cleaned up typing of native events
>
>
> Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
> Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/294c3d6a
> Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/294c3d6a
> Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/294c3d6a
>
> Branch: refs/heads/feature/browser-event
> Commit: 294c3d6ab3d1636ea3435e6c8ef548b0e845c08e
> Parents: 273526e
> Author: Harbs <harbs@in-tools.com>
> Authored: Fri Jul 21 09:41:35 2017 +0300
> Committer: Harbs <harbs@in-tools.com>
> Committed: Fri Jul 21 09:41:35 2017 +0300
>
> ----------------------------------------------------------------------
>  .../org/apache/flex/core/HTMLElementWrapper.as  |  7 ++++---
>  .../flex/events/utils/KeyboardEventConverter.as | 22 ++++++++++----------
>  .../flex/events/utils/MouseEventConverter.as    |  9 ++++----
>  3 files changed, 19 insertions(+), 19 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 294c3d6a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/
> HTMLElementWrapper.as
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/HTMLElementWrapper.as
> b/frameworks/projects/Basic/src/main/flex/org/apache/flex/
> core/HTMLElementWrapper.as
> index 0324700..1260bef 100644
> --- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/
> core/HTMLElementWrapper.as
> +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/
> core/HTMLElementWrapper.as
> @@ -68,13 +68,14 @@ package org.apache.flex.core
>                 static public function fireListenerOverride(listener:Object,
> eventObject:goog.events.BrowserEvent):Boolean
>                 {
>              var e:IBrowserEvent;
> -            switch(eventObject["event_"]["constructor"]["name"])
> +            var nativeEvent:Object = eventObject["event_"];
> +            switch(nativeEvent.constructor.name)
>              {
>                  case "KeyboardEvent":
> -                    e = KeyboardEventConverter.
> convert(eventObject["event_"]);
> +                    e = KeyboardEventConverter.convert(nativeEvent);
>                      break;
>                  case "MouseEvent":
> -                    e = MouseEventConverter.convert(
> eventObject["event_"]);
> +                    e = MouseEventConverter.convert(nativeEvent);
>                      break;
>                  default:
>                      e = new org.apache.flex.events.BrowserEvent();
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 294c3d6a/frameworks/projects/Core/src/main/flex/org/apache/
> flex/events/utils/KeyboardEventConverter.as
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/
> events/utils/KeyboardEventConverter.as b/frameworks/projects/Core/
> src/main/flex/org/apache/flex/events/utils/KeyboardEventConverter.as
> index 1ee74b6..a5e8b6c 100644
> --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/
> KeyboardEventConverter.as
> +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/
> KeyboardEventConverter.as
> @@ -68,20 +68,20 @@ package org.apache.flex.events.utils
>                  *  @productversion FlexJS 0.8
>                  */
>                 COMPILE::JS
> -               public static function convert(oldEvent:
> KeyboardEvent):org.apache.flex.events.KeyboardEvent
> +               public static function convert(nativeEvent:Object):
> KeyboardEvent
>                 {
> -                       var type:String = oldEvent.type;
> -                       var key:String = oldEvent.key;
> +                       var type:String = nativeEvent["type"];
> +                       var key:String = nativeEvent["key"];
>                         if (key == null)
> -                               key = KeyConverter.convertCharCode(
> oldEvent['charCode']);
> -                       var code:String = oldEvent.code;
> +                               key = KeyConverter.convertCharCode(
> nativeEvent['charCode']);
> +                       var code:String = nativeEvent["code"];
>                         if (code == null)
> -                               code = KeyConverter.convertKeyCode(
> oldEvent['keyCode']);
> -                       var newEvent:org.apache.flex.events.KeyboardEvent
> = new org.apache.flex.events.KeyboardEvent(type, key, code,
> oldEvent.shiftKey);
> -                       newEvent.altKey = oldEvent.altKey;
> -                       newEvent.ctrlKey = oldEvent.ctrlKey;
> -                       newEvent.metaKey = oldEvent.metaKey;
> -                       newEvent.specialKey = OSUtils.getOS() ==
> OSUtils.MAC_OS ? oldEvent.metaKey : oldEvent.ctrlKey;
> +                               code = KeyConverter.convertKeyCode(
> nativeEvent['keyCode']);
> +                       var newEvent:KeyboardEvent = new
> KeyboardEvent(type, key, code, nativeEvent["shiftKey"]);
> +                       newEvent.altKey = nativeEvent["altKey"];
> +                       newEvent.ctrlKey = nativeEvent["ctrlKey"];
> +                       newEvent.metaKey = nativeEvent["metaKey"];
> +                       newEvent.specialKey = OSUtils.getOS() ==
> OSUtils.MAC_OS ? nativeEvent["metaKey"] : nativeEvent["ctrlKey"];
>                         return newEvent;
>                 }
>         }
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 294c3d6a/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 de3fecd..b98177d 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
> @@ -177,12 +177,11 @@ package org.apache.flex.events.utils
>      COMPILE::JS
>         public class MouseEventConverter
>         {
> -        public static function convert(oldEv:MouseEvent):org.
> apache.flex.events.MouseEvent
> +        public static function convert(nativeEvent:Object):MouseEvent
>          {
> -            return new org.apache.flex.events.MouseEvent(oldEv.type,
> true, false,
> -
> oldEv.clientX, oldEv.clientY,
> -                                                                  null,
> -
> oldEv.ctrlKey, oldEv.altKey, oldEv.shiftKey);
> +            return new MouseEvent(nativeEvent["type"], true, false,
> +                nativeEvent["clientX"], nativeEvent["clientY"], null,
> +                nativeEvent["ctrlKey"], nativeEvent["altKey"],
> nativeEvent["shiftKey"]);
>          }
>      }
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message