| OLD | NEW |
| 1 /** | 1 /** |
| 2 * A custom KeyboardEvent that attempts to eliminate cross-browser | 2 * A custom KeyboardEvent that attempts to eliminate cross-browser |
| 3 * inconsistencies, and also provide both keyCode and charCode information | 3 * inconsistencies, and also provide both keyCode and charCode information |
| 4 * for all key events (when such information can be determined). | 4 * for all key events (when such information can be determined). |
| 5 * | 5 * |
| 6 * KeyEvent tries to provide a higher level, more polished keyboard event | 6 * KeyEvent tries to provide a higher level, more polished keyboard event |
| 7 * information on top of the "raw" [KeyboardEvent]. | 7 * information on top of the "raw" [KeyboardEvent]. |
| 8 * | 8 * |
| 9 * This class is very much a work in progress, and we'd love to get information | 9 * This class is very much a work in progress, and we'd love to get information |
| 10 * on how we can make this class work with as many international keyboards as | 10 * on how we can make this class work with as many international keyboards as |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 /** Programmatically create a new KeyEvent (and KeyboardEvent). */ | 63 /** Programmatically create a new KeyEvent (and KeyboardEvent). */ |
| 64 factory KeyEvent(String type, | 64 factory KeyEvent(String type, |
| 65 {Window view, bool canBubble: true, bool cancelable: true, int keyCode: 0, | 65 {Window view, bool canBubble: true, bool cancelable: true, int keyCode: 0, |
| 66 int charCode: 0, int keyLocation: 1, bool ctrlKey: false, | 66 int charCode: 0, int keyLocation: 1, bool ctrlKey: false, |
| 67 bool altKey: false, bool shiftKey: false, bool metaKey: false, | 67 bool altKey: false, bool shiftKey: false, bool metaKey: false, |
| 68 bool altGraphKey: false, EventTarget currentTarget}) { | 68 bool altGraphKey: false, EventTarget currentTarget}) { |
| 69 var parent = new KeyboardEvent(type, view: view, canBubble: canBubble, | 69 var parent = new KeyboardEvent(type, view: view, canBubble: canBubble, |
| 70 cancelable: cancelable, keyLocation: keyLocation, ctrlKey: ctrlKey, | 70 cancelable: cancelable, keyLocation: keyLocation, ctrlKey: ctrlKey, |
| 71 altKey: altKey, shiftKey: shiftKey, metaKey: metaKey, altGraphKey: | 71 altKey: altKey, shiftKey: shiftKey, metaKey: metaKey, altGraphKey: |
| 72 altGraphKey); | 72 altGraphKey); |
| 73 var keyEvent = KeyEvent.wrap(parent); | 73 var keyEvent = new KeyEvent.wrap(parent); |
| 74 keyEvent._shadowAltKey = altKey; | 74 keyEvent._shadowAltKey = altKey; |
| 75 keyEvent._shadowCharCode = charCode; | 75 keyEvent._shadowCharCode = charCode; |
| 76 keyEvent._shadowKeyCode = keyCode; | 76 keyEvent._shadowKeyCode = keyCode; |
| 77 keyEvent._currentTarget = currentTarget == null ? window : currentTarget; | 77 keyEvent._currentTarget = currentTarget == null ? window : currentTarget; |
| 78 return keyEvent; | 78 return keyEvent; |
| 79 } | 79 } |
| 80 | 80 |
| 81 /** Accessor to provide a stream of KeyEvents on the desired target. */ | 81 /** Accessor to provide a stream of KeyEvents on the desired target. */ |
| 82 static EventStreamProvider<KeyEvent> keyDownEvent = | 82 static EventStreamProvider<KeyEvent> keyDownEvent = |
| 83 new _KeyboardEventHandler('keydown'); | 83 new _KeyboardEventHandler('keydown'); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 throw new UnsupportedError("keyIdentifier is unsupported."); | 123 throw new UnsupportedError("keyIdentifier is unsupported."); |
| 124 } | 124 } |
| 125 void _initKeyboardEvent(String type, bool canBubble, bool cancelable, | 125 void _initKeyboardEvent(String type, bool canBubble, bool cancelable, |
| 126 Window view, String keyIdentifier, int keyLocation, bool ctrlKey, | 126 Window view, String keyIdentifier, int keyLocation, bool ctrlKey, |
| 127 bool altKey, bool shiftKey, bool metaKey, | 127 bool altKey, bool shiftKey, bool metaKey, |
| 128 bool altGraphKey) { | 128 bool altGraphKey) { |
| 129 throw new UnsupportedError( | 129 throw new UnsupportedError( |
| 130 "Cannot initialize a KeyboardEvent from a KeyEvent."); | 130 "Cannot initialize a KeyboardEvent from a KeyEvent."); |
| 131 } | 131 } |
| 132 } | 132 } |
| OLD | NEW |