OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 A simple English virtual keyboard implementation. | 6 * @fileoverview A simple English virtual keyboard implementation. |
7 */ | 7 */ |
8 | 8 |
9 /** | 9 /** |
10 * All keys for the rows of the keyboard. | 10 * All keys for the rows of the keyboard. |
11 * NOTE: every row below should have an aspect of 12.6. | 11 * NOTE: every row below should have an aspect of 12.6. |
12 * @type {Array.<Array.<BaseKey>>} | 12 * @type {Array.<Array.<BaseKey>>} |
13 */ | 13 */ |
14 var KEYS_US = [ | 14 var KEYS_US = [ |
15 [ | 15 [ |
16 new SvgKey('tab', 'Tab'), | 16 new SvgKey('tab', 'Tab'), |
17 new Key(C('q'), C('Q'), C('1'), C('`')), | 17 new Key(CP('q'), CP('Q'), CP('1'), CP('`')), |
18 new Key(C('w'), C('W'), C('2'), C('~')), | 18 new Key(CP('w'), CP('W'), CP('2'), CP('~')), |
19 new Key(C('e'), C('E'), C('3'), new Character('<', 'LessThan')), | 19 new Key(CP('e'), CP('E'), CP('3'), CP('<', 'LessThan')), |
20 new Key(C('r'), C('R'), C('4'), new Character('>', 'GreaterThan')), | 20 new Key(CP('r'), CP('R'), CP('4'), CP('>', 'GreaterThan')), |
21 new Key(C('t'), C('T'), C('5'), C('[')), | 21 new Key(CP('t'), CP('T'), CP('5'), CP('[')), |
22 new Key(C('y'), C('Y'), C('6'), C(']')), | 22 new Key(CP('y'), CP('Y'), CP('6'), CP(']')), |
23 new Key(C('u'), C('U'), C('7'), C('{')), | 23 new Key(CP('u'), CP('U'), CP('7'), CP('{')), |
24 new Key(C('i'), C('I'), C('8'), C('}')), | 24 new Key(CP('i'), CP('I'), CP('8'), CP('}')), |
25 new Key(C('o'), C('O'), C('9'), C('\'')), | 25 new Key(CP('o'), CP('O'), CP('9'), CP('\'')), |
26 new Key(C('p'), C('P'), C('0'), C('|')), | 26 new Key(CP('p'), CP('P'), CP('0'), CP('|')), |
27 new SvgKey('backspace', 'Backspace', true /* repeat */) | 27 new SvgKey('backspace', 'Backspace', true /* repeat */) |
28 ], | 28 ], |
29 [ | 29 [ |
30 new SymbolKey(), | 30 new SymbolKey(), |
31 new Key(C('a'), C('A'), C('!'), C('+')), | 31 new Key(CP('a'), CP('A'), CP('!'), CP('+')), |
32 new Key(C('s'), C('S'), C('@'), C('=')), | 32 new Key(CP('s'), CP('S'), CP('@'), CP('=')), |
33 new Key(C('d'), C('D'), C('#'), C(' ')), | 33 new Key(CP('d'), CP('D'), CP('#'), CP(' ')), |
34 new Key(C('f'), C('F'), C('$'), C(' ')), | 34 new Key(CP('f'), CP('F'), CP('$'), CP(' ')), |
35 new Key(C('g'), C('G'), C('%'), C(' ')), | 35 new Key(CP('g'), CP('G'), CP('%'), CP(' ')), |
36 new Key(C('h'), C('H'), C('^'), C(' ')), | 36 new Key(CP('h'), CP('H'), CP('^'), CP(' ')), |
37 new Key(C('j'), C('J'), new Character('&', 'Ampersand'), C(' ')), | 37 new Key(CP('j'), CP('J'), CP('&', 'Ampersand'), CP(' ')), |
38 new Key(C('k'), C('K'), C('*'), C('#')), | 38 new Key(CP('k'), CP('K'), CP('*'), CP('#')), |
39 new Key(C('l'), C('L'), C('('), C(' ')), | 39 new Key(CP('l'), CP('L'), CP('('), CP(' ')), |
40 new Key(C('\''), C('\''), C(')'), C(' ')), | 40 new Key(CP('\''), CP('\''), CP(')'), CP(' ')), |
41 new SvgKey('return', 'Enter') | 41 new SvgKey('return', 'Enter') |
42 ], | 42 ], |
43 [ | 43 [ |
44 new ShiftKey('left_shift'), | 44 new ShiftKey('left_shift'), |
45 new Key(C('z'), C('Z'), C('/'), C(' ')), | 45 new Key(CP('z'), CP('Z'), CP('/'), CP(' ')), |
46 new Key(C('x'), C('X'), C('-'), C(' ')), | 46 new Key(CP('x'), CP('X'), CP('-'), CP(' ')), |
47 new Key(C('c'), C('C'), C('\''), C(' ')), | 47 new Key(CP('c'), CP('C'), CP('\''), CP(' ')), |
48 new Key(C('v'), C('V'), C('"'), C(' ')), | 48 new Key(CP('v'), CP('V'), CP('"'), CP(' ')), |
49 new Key(C('b'), C('B'), C(':'), C('.')), | 49 new Key(CP('b'), CP('B'), CP(':'), CP('.')), |
50 new Key(C('n'), C('N'), C(';'), C(' ')), | 50 new Key(CP('n'), CP('N'), CP(';'), CP(' ')), |
51 new Key(C('m'), C('M'), C('_'), C(' ')), | 51 new Key(CP('m'), CP('M'), CP('_'), CP(' ')), |
52 new Key(C('!'), C('!'), C('{'), C(' ')), | 52 new Key(CP('!'), CP('!'), CP('{'), CP(' ')), |
53 new Key(C('?'), C('?'), C('}'), C(' ')), | 53 new Key(CP('?'), CP('?'), CP('}'), CP(' ')), |
54 new Key(C('/'), C('/'), C('\\'), C(' ')), | 54 new Key(CP('/'), CP('/'), CP('\\'), CP(' ')), |
55 new ShiftKey() | 55 new ShiftKey() |
56 ], | 56 ], |
57 [ | 57 [ |
58 new SvgKey('mic', ''), | 58 new SvgKey('mic', ''), |
59 new DotComKey(), | 59 new DotComKey(), |
60 new SpecialKey('at', '@', '@'), | 60 new SpecialKey('at', '@', '@'), |
61 // TODO(bryeung): the spacebar needs to be a little bit more stretchy, | 61 // TODO(bryeung): the spacebar needs to be a little bit more stretchy, |
62 // since this row has only 7 keys (as opposed to 12), the truncation | 62 // since this row has only 7 keys (as opposed to 12), the truncation |
63 // can cause it to not be wide enough. | 63 // can cause it to not be wide enough. |
64 new SpecialKey('space', ' ', 'Spacebar'), | 64 new SpecialKey('space', ' ', 'Spacebar'), |
65 new SpecialKey('comma', ',', ','), | 65 new SpecialKey('comma', ',', ','), |
66 new SpecialKey('period', '.', '.'), | 66 new SpecialKey('period', '.', '.'), |
67 new HideKeyboardKey() | 67 new HideKeyboardKey() |
68 ] | 68 ] |
69 ]; | 69 ]; |
70 | 70 |
71 // Add layout to KEYBOARDS, which is defined in common.js | 71 // Add layout to KEYBOARDS, which is defined in common.js |
72 KEYBOARDS['us'] = { | 72 KEYBOARDS['us'] = { |
73 "definition": KEYS_US, | 73 "definition": KEYS_US, |
74 "aspect": 3.15, | 74 "aspect": 3.15, |
75 } | 75 } |
OLD | NEW |