OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Rewrites a braille key event. | 6 * @fileoverview Rewrites a braille key event. |
7 */ | 7 */ |
8 | 8 |
9 goog.provide('BrailleKeyEventRewriter'); | 9 goog.provide('BrailleKeyEventRewriter'); |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 // Check for a chord to standard key mapping. | 52 // Check for a chord to standard key mapping. |
53 standardKeyCode = | 53 standardKeyCode = |
54 cvox.BrailleKeyEvent.brailleChordsToStandardKeyCode[dots]; | 54 cvox.BrailleKeyEvent.brailleChordsToStandardKeyCode[dots]; |
55 } | 55 } |
56 | 56 |
57 // Check for a 'dots' command, which is typed on the keyboard with a | 57 // Check for a 'dots' command, which is typed on the keyboard with a |
58 // previous incremental key press. | 58 // previous incremental key press. |
59 if (evt.command == cvox.BrailleKeyCommand.DOTS && this.incrementalKey_) { | 59 if (evt.command == cvox.BrailleKeyCommand.DOTS && this.incrementalKey_) { |
60 // Check if this braille pattern has a standard key mapping. | 60 // Check if this braille pattern has a standard key mapping. |
61 standardKeyCode = | 61 standardKeyCode = cvox.BrailleKeyEvent.brailleDotsToStandardKeyCode[dots]; |
62 cvox.BrailleKeyEvent.brailleDotsToStandardKeyCode[dots]; | |
63 } | 62 } |
64 | 63 |
65 if (standardKeyCode) { | 64 if (standardKeyCode) { |
66 evt.command = cvox.BrailleKeyCommand.STANDARD_KEY; | 65 evt.command = cvox.BrailleKeyCommand.STANDARD_KEY; |
67 evt.standardKeyCode = standardKeyCode; | 66 evt.standardKeyCode = standardKeyCode; |
68 if (this.incrementalKey_) { | 67 if (this.incrementalKey_) { |
69 // Apply all modifiers seen so far to the outgoing event as a standard | 68 // Apply all modifiers seen so far to the outgoing event as a standard |
70 // keyboard command. | 69 // keyboard command. |
71 evt.altKey = this.incrementalKey_.altKey; | 70 evt.altKey = this.incrementalKey_.altKey; |
72 evt.ctrlKey = this.incrementalKey_.ctrlKey; | 71 evt.ctrlKey = this.incrementalKey_.ctrlKey; |
73 evt.shiftKey = this.incrementalKey_.shiftKey; | 72 evt.shiftKey = this.incrementalKey_.shiftKey; |
74 this.incrementalKey_ = null; | 73 this.incrementalKey_ = null; |
75 } | 74 } |
76 return false; | 75 return false; |
77 } | 76 } |
78 | 77 |
79 this.incrementalKey_ = null; | 78 this.incrementalKey_ = null; |
80 return false; | 79 return false; |
81 } | 80 } |
82 }; | 81 }; |
OLD | NEW |