Repository: flex-asjs Updated Branches: refs/heads/develop 81712dc21 -> b937f2671
AnimationUtil Beginning of KeyboardEvent and associated classes Expanded IRect Added constant to MouseEvent Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/b937f267 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/b937f267 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/b937f267 Branch: refs/heads/develop Commit: b937f26718b8a3d3662f70bcba21709f37c54040 Parents: 81712dc Author: Harbs <[email protected]> Authored: Sun Mar 5 11:33:48 2017 +0200 Committer: Harbs <[email protected]> Committed: Sun Mar 5 11:33:48 2017 +0200 ---------------------------------------------------------------------- .../projects/Core/src/main/flex/CoreClasses.as | 12 +- .../org/apache/flex/events/KeyboardEvent.as | 107 ++++++++++ .../flex/org/apache/flex/events/MouseEvent.as | 2 + .../org/apache/flex/events/utils/EditingKeys.as | 95 +++++++++ .../apache/flex/events/utils/KeyConverter.as | 205 +++++++++++++++++++ .../apache/flex/events/utils/ModifierKeys.as | 97 +++++++++ .../apache/flex/events/utils/NavigationKeys.as | 66 ++++++ .../org/apache/flex/events/utils/SpecialKeys.as | 40 ++++ .../flex/org/apache/flex/events/utils/UIKeys.as | 115 +++++++++++ .../apache/flex/events/utils/WhitespaceKeys.as | 49 +++++ .../flex/org/apache/flex/utils/AnimationUtil.as | 105 ++++++++++ .../main/flex/org/apache/flex/graphics/IRect.as | 6 +- 12 files changed, 897 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b937f267/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 744242a..43a4e2b 100644 --- a/frameworks/projects/Core/src/main/flex/CoreClasses.as +++ b/frameworks/projects/Core/src/main/flex/CoreClasses.as @@ -31,6 +31,7 @@ internal class CoreClasses import org.apache.flex.core.BrowserWindow; BrowserWindow; COMPILE::SWF { + import Promise; Promise; import org.apache.flex.core.ApplicationFactory; ApplicationFactory; import org.apache.flex.core.CSSShape; CSSShape; import org.apache.flex.core.CSSSprite; CSSSprite; @@ -116,17 +117,26 @@ internal class CoreClasses import org.apache.flex.events.EventDispatcher; EventDispatcher; import org.apache.flex.events.IEventDispatcher; IEventDispatcher; import org.apache.flex.events.MouseEvent; MouseEvent; + import org.apache.flex.events.KeyboardEvent; KeyboardEvent; COMPILE::SWF { import org.apache.flex.core.StageProxy; StageProxy; import org.apache.flex.events.utils.MouseEventConverter; MouseEventConverter; } + import org.apache.flex.events.utils.KeyConverter; KeyConverter; import org.apache.flex.events.DetailEvent; DetailEvent; import org.apache.flex.events.ValueEvent; ValueEvent; import org.apache.flex.events.utils.MouseUtils; MouseUtils; + import org.apache.flex.events.utils.EditingKeys; EditingKeys; + import org.apache.flex.events.utils.ModifierKeys; ModifierKeys; + import org.apache.flex.events.utils.NavigationKeys; NavigationKeys; + import org.apache.flex.events.utils.SpecialKeys; SpecialKeys; + import org.apache.flex.events.utils.WhitespaceKeys; WhitespaceKeys; + import org.apache.flex.events.utils.UIKeys; UIKeys; import org.apache.flex.geom.Matrix; Matrix; import org.apache.flex.geom.Point; Point; import org.apache.flex.geom.Rectangle; Rectangle; + import org.apache.flex.utils.AnimationUtil; AnimationUtil; import org.apache.flex.utils.BinaryData; BinaryData; COMPILE::SWF { @@ -156,7 +166,7 @@ internal class CoreClasses import org.apache.flex.utils.StringPadder; StringPadder; import org.apache.flex.utils.StringTrimmer; StringTrimmer; import org.apache.flex.utils.StringUtil; StringUtil; - // import org.apache.flex.utils.ObjectMap;ObjectMap; + // import org.apache.flex.utils.ObjectMap; ObjectMap; import org.apache.flex.utils.ObjectUtil; ObjectUtil; import org.apache.flex.utils.Timer; Timer; import org.apache.flex.utils.UIDUtil; UIDUtil; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b937f267/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 new file mode 100644 index 0000000..c92a0b3 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/KeyboardEvent.as @@ -0,0 +1,107 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.events +{ + public class KeyboardEvent extends Event + { + + public static const KEY_DOWN:String = "keyDown"; + public static const KEY_UP:String = "keyUp"; + + public function KeyboardEvent( + type:String, + key:String, + code:String, + shiftKey:Boolean=false, + altKey:Boolean=false, + ctrlKey:Boolean=false, + metaKey:Boolean=false, + bubbles:Boolean = false, cancelable:Boolean = false) + { + super(type, bubbles = false, cancelable); + _key = key; + _code = code; + _shiftKey = shiftKey; + _altKey = altKey; + _ctrlKey = ctrlKey; + _metaKey = metaKey; + } + + private var _key:String; + public function get key():String + { + return _key; + } + public function set key(value:String):void + { + _key = value; + } + + private var _code:String; + public function get code():String + { + return _code; + } + public function set code(value:String):void + { + _code = value; + } + + private var _shiftKey:Boolean; + public function get shiftKey():Boolean + { + return _shiftKey; + } + + private var _altKey:Boolean; + public function get altKey():Boolean + { + return _altKey; + } + public function set altKey(value:Boolean):void + { + _altKey = value; + } + + private var _ctrlKey:Boolean; + public function get ctrlKey():Boolean + { + return _ctrlKey; + } + public function set ctrlKey(value:Boolean):void + { + _ctrlKey = value; + } + + private var _metaKey:Boolean; + public function get metaKey():Boolean + { + return _metaKey; + } + public function set metaKey(value:Boolean):void + { + _metaKey = value; + } + + public function get modifierKey():Boolean + { + return false; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b937f267/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 62462f1..3e5a617 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 @@ -60,6 +60,7 @@ package org.apache.flex.events public static const ROLL_OUT:String = platformConstant("rollOut"); public static const CLICK:String = "click"; public static const DOUBLE_CLICK:String = "doubleClick"; + public static const WHEEL : String = "mouseWheel"; /** * Constructor. @@ -203,6 +204,7 @@ package org.apache.flex.events public static const ROLL_OUT:String = platformConstant("rollOut"); public static const CLICK:String = "click"; public static const DOUBLE_CLICK:String = "dblclick"; + public static const WHEEL : String = "wheel"; /** * Constructor. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b937f267/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/EditingKeys.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/EditingKeys.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/EditingKeys.as new file mode 100644 index 0000000..a6d7a26 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/EditingKeys.as @@ -0,0 +1,95 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.events.utils +{ + /** + * This class holds constants for editing keys + * See: https://w3c.github.io/uievents-key/#keys-editing + * See: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values#Editing_keys + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class EditingKeys + { + + /** + * The Backspace key. This key is labeled Delete on Mac keyboards. + */ + public static const BACKSPACE:String = "Backspace"; + + /** + * The Clear key. Removes the currently selected input. + */ + public static const CLEAR:String = "Clear"; + + /** + * The Copy key (on certain extended keyboards). + */ + public static const COPY:String = "Copy"; + + /** + * The Cursor Select key, CrSel. + */ + public static const CURSOR_SELECT:String = "CrSel"; + + /** + * The Cut key (on certain extended keyboards). + */ + public static const CUT:String = "Cut"; + + /** + * The Delete key, Del. + */ + public static const DELETE:String = "Delete"; + + /** + * Erase to End of Field. Deletes all characters from the current cursor position to the end of the current field. + */ + public static const ERASE_EOF:String = "EraseEof"; + + /** + * The ExSel (Extend Selection) key. + */ + public static const EXTEND_SELECTION:String = "ExSel"; + + /** + * The Insert key, Ins. Toggles between inserting and overwriting text. + */ + public static const INSERT:String = "Insert"; + + /** + * Paste from the clipboard. + */ + public static const PASTE:String = "Paste"; + + /** + * Redo the last action. + */ + public static const REDO:String = "Redo"; + + /** + * Undo the last action. + */ + public static const UNDO:String = "Undo"; + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b937f267/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/KeyConverter.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/KeyConverter.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/KeyConverter.as new file mode 100644 index 0000000..6ddfac8 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/KeyConverter.as @@ -0,0 +1,205 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.events.utils +{ + + /** + * Converts Keyboard Codes and key values into rational string equivalents. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class KeyConverter + { + + COMPILE::JS + private static const lookup:Object = { + "Unidentified" : "", + "Enter" : "\r", + "Tab" : "\t", + "Spacebar": " " + }; + + /** + * Converts HTML key values into rational string equivalents. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + COMPILE::JS + public static function convertKey(value:String):String + { + if(value.length < 2) + return value; + + value = lookup[value]; + return value || ""; + } + + /** + * Converts SWF key values into rational string equivalents. (is anything needed?) + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + COMPILE::SWF + public static function convertKey(value:String):String + { + return value; + } + + /** + * Converts Flash keyCodes into rational string equivalents. These represent the physical (or virtual) key locations. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + COMPILE::SWF + public static function convertKeyCode(code:uint):String + { + // A to Z + if(code > 64 && code < 91) + { + return "Key" + String.fromCharCode(code); + } + // 0 to 9 + if(code > 47 && code < 58) + { + return "Digit" + String.fromCharCode(code); + } + // Numpad 0 to 9 + if(code > 95 && code < 106) + { + return "Numpad" + String.fromCharCode(code); + } + // Fn keys + if(code > 111 && code < 106) + { + return "F" + (code - 111); + } + // The rest + switch(code){ + case 8: + return "Backspace"; + case 9: + return "Tab"; + case 13: + return "Enter"; + case 16: + return "ShiftLeft"; + case 17: + return "ControlLeft"; + case 20: + return "CapsLock"; + case 27: + return "Escape"; + case 32: + return "Space"; + case 33: + return "PageUp"; + case 34: + return "PageDown"; + case 35: + return "End"; + case 36: + return "Home"; + case 37: + return "ArrowLeft"; + case 38: + return "ArrowUp"; + case 39: + return "ArrowRight"; + case 40: + return "ArrowDown"; + case 45: + return "Insert"; + case 46: + return "Delete"; + case 144: + return "NumLock"; + case 145: + return "ScrollLock"; + case 19: + return "Pause"; + case 186: + return "Semicolon"; + case 187: + return "Equal"; + case 189: + return "Minus"; + case 191: + return "Slash"; + case 192: + return "Backquote"; + case 219: + return "BracketLeft"; + case 220: + return "Backslash"; + case 221: + return "BracketRight"; + case 222: + return "Quote"; + case 188: + return "Comma"; + case 190 : + return "Period"; + case 106: + return "NumpadMultiply"; + case 107: + return "NumpadAdd"; + case 13: + return "NumpadEnter"; + case 109: + return "NumpadSubtract"; + case 110: + return "NumpadDecimal"; + case 111: + return "NumpadDivide"; + default: + throw new Error("Unknown Key Code: " + code); + } + } + + /** + * Converts Flash charCodes into rational string equivalents. These represent the actual input. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static function convertCharCode(code:uint):String + { + //By default we use String.fromCharCode. This should work for the vast majority of characters. + //Special characters need to be dealt with individually. + switch(code){ + default: + return String.fromCharCode(code); + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b937f267/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/ModifierKeys.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/ModifierKeys.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/ModifierKeys.as new file mode 100644 index 0000000..b318aac --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/ModifierKeys.as @@ -0,0 +1,97 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.events.utils +{ + /** + * This class holds constants for special keys + * See: https://w3c.github.io/uievents-key/#keys-special + * See: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values#Special_values + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ModifierKeys + { + + /** + * The Alt (Alternative) key. + */ + public static const ALT:String = "Alt"; + + /** + * The AltGr or AltGraph (Alternate Graphics) key. Enables the ISO Level 3 shift modifier (where Shift is the level 2 modifier). + */ + public static const ALT_GRAPH:String = "AltGraph"; + + /** + * The Caps Lock key. Toggles the capital character lock on and off for subsequent input. + */ + public static const CAPS_LOCK:String = "CapsLock"; + + /** + * The Control, Ctrl, or Ctl key. Alows typing control characters. + */ + public static const CONTROL:String = "Control"; + + /** + * The Fn (Function modifier) key. Used to allow generating function key (F1-F15, for instance) + * characters on keyboards without a dedicated function key area. Often handled in hardware so that events aren't generated for this key. + */ + public static const FN:String = "Fn"; + + /** + * The Meta key. Allows issuing special command inputs. This is the Windows logo key, or the Command or â key on Mac keyboards. + */ + public static const META:String = "Meta"; + + /** + * The NumLock (Number Lock) key. Toggles the numeric keypad between number entry some other mode (often directional arrows). + */ + public static const NUM_LOCK:String = "NumLock"; + + /** + * The Scroll Lock key. Toggles beteen scrolling and cursor movement modes. + */ + public static const SCROLL_LOCK:String = "ScrollLock"; + + /** + * The Shift key. Modifies keystrokes to allow typing upper (or other) case letters, + * and to support typing punctuation and other special characters. + */ + public static const SHIFT:String = "Shift"; + + /** + * The Super key. + */ + public static const SUPER:String = "Super"; + + /** + * The Symbol modifier key (found on certain virtual keyboards). + */ + public static const SYMBOL:String = "Symbol"; + + /** + * The Symbol Lock key. + */ + public static const SYMBOL_LOCK:String = "SymbolLock"; + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b937f267/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/NavigationKeys.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/NavigationKeys.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/NavigationKeys.as new file mode 100644 index 0000000..b645d21 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/NavigationKeys.as @@ -0,0 +1,66 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.events.utils +{ + /** + * This class holds constants for keyboard navigation + * See: https://w3c.github.io/uievents-key/#keys-navigation + * See: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values#Navigation_keys + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class NavigationKeys + { + /** + * The down arrow key. + */ + public static const DOWN:String = "ArrowDown"; + /** + * The left arrow key. + */ + public static const LEFT:String = "ArrowLeft"; + /** + * The right arrow key. + */ + public static const RIGHT:String = "ArrowRight"; + /** + * The up arrow key. + */ + public static const UP:String = "ArrowUp"; + /** + * The End key. Moves to the end of content. + */ + public static const END:String = "End"; + /** + * The Home key. Moves to the start of content. + */ + public static const HOME:String = "Home"; + /** + * The Page Down (or PgDn) key. Scrolls down or displays the next page of content. + */ + public static const PAGE_DOWN:String = "PageDown"; + /** + * The Page Up (or PgUp) key. Scrolls up or displays the previous page of content. + */ + public static const PAGE_UP:String = "PageUp"; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b937f267/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/SpecialKeys.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/SpecialKeys.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/SpecialKeys.as new file mode 100644 index 0000000..b82efb8 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/SpecialKeys.as @@ -0,0 +1,40 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.events.utils +{ + /** + * This class holds constants for special keys + * See: https://w3c.github.io/uievents-key/#keys-special + * See: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values#Special_values + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class SpecialKeys + { + /** + * The user agent wasn't able to map the event's virtual keycode to a specific key value. + * This can happen due to hardware or software constraints, or because of constraints + * around the platform on which the user agent is running. + */ + public static const UNIDENTIFIED:String = "Unidentified"; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b937f267/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/UIKeys.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/UIKeys.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/UIKeys.as new file mode 100644 index 0000000..2d1cdec --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/UIKeys.as @@ -0,0 +1,115 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.events.utils +{ + /** + * This class holds constants for special keys + * See: https://w3c.github.io/uievents-key/#keys-special + * See: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values#Special_values + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class UIKeys + { + + /** + * The Accept, Commit, or OK key or button. Accepts the currently selected option or input method sequence conversion. + */ + public static const ACCEPT:String = "Accept"; + + /** + * The Again key. Redoes or repeats a previous action. + */ + public static const AGAIN:String = "Again"; + + /** + * The Attn (Attention) key. + */ + public static const ATTN:String = "Attn"; + + /** + * The Cancel key. + */ + public static const CANCEL:String = "Cancel"; + + /** + * Shows the context menu. Typically found between the Windows (or OS) key and the Control key on the right side of the keyboard. + */ + public static const CONTEXT_MENU:String = "ContextMenu"; + + /** + * The Esc (Escape) key. Typically used as an exit, cancel, or "escape this operation" button. Historically, the Escape character was used to signal the start of a special control sequence of characters called an "escape sequence." + */ + public static const ESCAPE:String = "Escape"; + + /** + * The Execute key. + */ + public static const EXECUTE:String = "Execute"; + + /** + * The Find key. Opens an interface (typically a dialog box) for performing a find/search operation. + */ + public static const FIND:String = "Find"; + + /** + * The Finish key. + */ + public static const FINISH:String = "Finish"; + + /** + * The Help key. Opens or toggles the display of help information. + */ + public static const HELP:String = "Help"; + + /** + * The Pause key. Pauses the current application or state, if applicable. + */ + public static const PAUSE:String = "Pause"; + + /** + * The Play key. Resumes a previously paused application, if applicable. + */ + public static const PLAY:String = "Play"; + + /** + * The Props (Properties) key. + */ + public static const PROPS:String = "Props"; + + /** + * The Select key. + */ + public static const SELECT:String = "Select"; + + /** + * The ZoomIn key. + */ + public static const ZOOM_IN:String = "ZoomIn"; + + /** + * The ZoomOut key. + */ + public static const ZOOM_OUT:String = "ZoomOut"; + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b937f267/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/WhitespaceKeys.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/WhitespaceKeys.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/WhitespaceKeys.as new file mode 100644 index 0000000..d987ac0 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/utils/WhitespaceKeys.as @@ -0,0 +1,49 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.events.utils +{ + /** + * This class holds constants for special keys + * See: https://w3c.github.io/uievents-key/#keys-whitespace + * See: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values#Whitespace_keys + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class WhitespaceKeys + { + + /** + * The Enter or âµ key (sometimes labeled Return). + */ + public static const ENTER:String = "Enter"; + + /** + * The Horizontal Tab key, Tab. + */ + public static const TAB:String = "Tab"; + + /** + * The space key, Space Bar. + */ + public static const SPACE:String = " "; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b937f267/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/AnimationUtil.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/AnimationUtil.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/AnimationUtil.as new file mode 100644 index 0000000..ec89e77 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/AnimationUtil.as @@ -0,0 +1,105 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.utils +{ + COMPILE::SWF { + import flash.display.DisplayObject; + import flash.events.Event; + import flash.events.IEventDispatcher; + } + import org.apache.flex.core.IUIBase; + + /** + * The AnimationUtil class wraps callbacks to be called when the platform is ready for the next draw. + * (requestAnimationFrame in HTML and ENTER_FRAME in Flash) + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class AnimationUtil + { + + COMPILE::SWF + private static var requests:Object = {}; + /** + * The callback is called with a high-rez timestamp as per the HTML spec + * + * @param callback. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static function requestFrame(callback:Function, element:IUIBase ):String + { + COMPILE::SWF + { + var listener:IEventDispatcher; + if(element is DisplayObject) + listener = element; + else if (Object(element).hasOwnProperty("$displayObject")) + listener = element["$displayObject"]; + else + throw new Error("Unknown element type"); + + var uid:String = UIDUtil.createUID(); + var wrappedCallback:Function = function(event:Event):void{ + callback.call(element,new Date().getTime()); + requests[uid] = null; + }; + requests[uid] = {callback:wrappedCallback,listener:listener}; + listener.addEventListener(Event.ENTER_FRAME,wrappedCallback); + return uid; + } + + COMPILE::JS + { + return "" + window["requestAnimationFrame"](callback); + } + + //TODO do we need a Node.js implementation? + + } + + public static function cancelFrame(id:String):void + { + COMPILE::SWF + { + var request:Object = requests[id]; + if(request) + { + request.listener.removeEventListener(Event.ENTER_FRAME,request.callback); + requests[id] = null; + } + } + + COMPILE::JS + { + window["cancelAnimationFrame"](Number(id)); + } + + //TODO do we need a Node.js implementation? + + } + + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b937f267/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/IRect.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/IRect.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/IRect.as index 6ee819c..2af539c 100644 --- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/IRect.as +++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/IRect.as @@ -15,6 +15,10 @@ package org.apache.flex.graphics { public interface IRect extends IGraphicShape { - + function get rx():Number; + function set rx(value:Number):void; + function get ry():Number; + function set ry(value:Number):void; + function drawRect(xp:Number, yp:Number, width:Number, height:Number):void; } } \ No newline at end of file
