OLD | NEW |
1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved. | 1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved. |
2 // limitations under the License. | 2 // limitations under the License. |
3 // See the License for the specific language governing permissions and | 3 // See the License for the specific language governing permissions and |
4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
5 // distributed under the License is distributed on an "AS-IS" BASIS, | 5 // distributed under the License is distributed on an "AS-IS" BASIS, |
6 // Unless required by applicable law or agreed to in writing, software | 6 // Unless required by applicable law or agreed to in writing, software |
7 // | 7 // |
8 // http://www.apache.org/licenses/LICENSE-2.0 | 8 // http://www.apache.org/licenses/LICENSE-2.0 |
9 // | 9 // |
10 // You may obtain a copy of the License at | 10 // You may obtain a copy of the License at |
11 // you may not use this file except in compliance with the License. | 11 // you may not use this file except in compliance with the License. |
12 // Licensed under the Apache License, Version 2.0 (the "License"); | 12 // Licensed under the Apache License, Version 2.0 (the "License"); |
13 // | 13 // |
14 goog.provide('i18n.input.chrome.inputview.layouts.RowsOf102'); | 14 goog.provide('i18n.input.chrome.inputview.layouts.RowsOf102'); |
15 | 15 |
16 goog.require('i18n.input.chrome.inputview.layouts.util'); | 16 goog.require('i18n.input.chrome.inputview.layouts.util'); |
17 | 17 |
| 18 goog.scope(function() { |
| 19 var layouts = i18n.input.chrome.inputview.layouts; |
| 20 var util = layouts.util; |
| 21 |
18 | 22 |
19 /** | 23 /** |
20 * Creates the top four rows for 102 keyboard. | 24 * Creates the top four rows for 102 keyboard. |
21 * | 25 * |
22 * @return {!Array.<!Object>} The rows. | 26 * @return {!Array.<!Object>} The rows. |
23 */ | 27 */ |
24 i18n.input.chrome.inputview.layouts.RowsOf102.create = function() { | 28 layouts.RowsOf102.create = function() { |
25 var baseKeySpec = { | 29 var baseKeySpec = { |
26 'widthInWeight': 1, | 30 'widthInWeight': 1, |
27 'heightInWeight': 1 | 31 'heightInWeight': 1 |
28 }; | 32 }; |
29 | 33 |
30 // Row1 | 34 // Row1 |
31 var backquoteKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 35 var keySequenceOf13 = util.createKeySequence(baseKeySpec, 13); |
32 'widthInWeight': 0.94 | 36 var backspaceKey = util.createKey({ |
| 37 'widthInWeight': 1.46 |
33 }); | 38 }); |
34 var keySequenceOf12 = i18n.input.chrome.inputview.layouts.util. | 39 var row1 = util.createLinearLayout({ |
35 createKeySequence(baseKeySpec, 12); | |
36 var backspaceKey = i18n.input.chrome.inputview.layouts.util.createKey({ | |
37 'widthInWeight': 1.42 | |
38 }); | |
39 var row1 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ | |
40 'id': 'row1', | 40 'id': 'row1', |
41 'children': [backquoteKey, keySequenceOf12, backspaceKey] | 41 'children': [keySequenceOf13, backspaceKey] |
42 }); | 42 }); |
43 | 43 |
44 | 44 |
45 // Row2 and row3 | 45 // Row2 and row3 |
46 | 46 |
47 // First linear layout at the left of the enter. | 47 // First linear layout at the left of the enter. |
48 var tabKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 48 var tabKey = util.createKey({ |
49 'widthInWeight': 1.38 | 49 'widthInWeight': 1.46 |
50 }); | 50 }); |
51 keySequenceOf12 = i18n.input.chrome.inputview.layouts.util. | 51 var keySequenceOf12 = util.createKeySequence(baseKeySpec, 12); |
52 createKeySequence(baseKeySpec, 12); | 52 var row2 = util.createLinearLayout({ |
53 var row2 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ | |
54 'id': 'row2', | 53 'id': 'row2', |
55 'children': [tabKey, keySequenceOf12] | 54 'children': [tabKey, keySequenceOf12] |
56 }); | 55 }); |
57 | 56 |
58 // Second linear layout at the right of the enter. | 57 // Second linear layout at the right of the enter. |
59 var capslockKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 58 var capslockKey = util.createKey({ |
60 'widthInWeight': 1.74 | 59 'widthInWeight': 1.66 |
61 }); | 60 }); |
62 keySequenceOf12 = i18n.input.chrome.inputview.layouts.util.createKeySequence({ | 61 keySequenceOf12 = util.createKeySequence({ |
63 'widthInWeight': 0.97 | 62 'widthInWeight': 0.98 |
64 }, 12); | 63 }, 12); |
65 var row3 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ | 64 var row3 = util.createLinearLayout({ |
66 'id': 'row3', | 65 'id': 'row3', |
67 'children': [capslockKey, keySequenceOf12] | 66 'children': [capslockKey, keySequenceOf12] |
68 }); | 67 }); |
69 | 68 |
70 // Vertical layout contains the two rows at the left of the enter. | 69 // Vertical layout contains the two rows at the left of the enter. |
71 var vLayout = i18n.input.chrome.inputview.layouts.util.createVerticalLayout({ | 70 var vLayout = util.createVerticalLayout({ |
72 'id': 'row2-3-left', | 71 'id': 'row2-3-left', |
73 'children': [row2, row3] | 72 'children': [row2, row3] |
74 }); | 73 }); |
75 | 74 |
76 // Vertical layout contains enter key. | 75 // Vertical layout contains enter key. |
77 var enterKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 76 var enterKey = util.createKey({ |
78 'widthInWeight': 0.98, | 77 'widthInWeight': 1.04, |
79 'heightInWeight': 2 | 78 'heightInWeight': 2 |
80 }); | 79 }); |
81 var enterLayout = i18n.input.chrome.inputview.layouts.util. | 80 var enterLayout = util. |
82 createVerticalLayout({ | 81 createVerticalLayout({ |
83 'id': 'row2-3-right', | 82 'id': 'row2-3-right', |
84 'children': [enterKey] | 83 'children': [enterKey] |
85 }); | 84 }); |
86 | 85 |
87 // Linear layout contains the two vertical layout. | 86 // Linear layout contains the two vertical layout. |
88 var row2and3 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ | 87 var row2and3 = util.createLinearLayout({ |
89 'id': 'row2-3', | 88 'id': 'row2-3', |
90 'children': [vLayout, enterLayout] | 89 'children': [vLayout, enterLayout] |
91 }); | 90 }); |
92 | 91 |
93 // Row4 | 92 // Row4 |
94 var shiftLeft = i18n.input.chrome.inputview.layouts.util.createKey({ | 93 var shiftLeft = util.createKey({ |
95 'widthInWeight': 1.2 | 94 'widthInWeight': 1.46 |
96 }); | 95 }); |
97 var keySequenceOf11 = i18n.input.chrome.inputview.layouts.util. | 96 var keySequenceOf11 = util.createKeySequence(baseKeySpec, 11); |
98 createKeySequence(baseKeySpec, 11); | 97 var shiftRight = util.createKey({ |
99 var shiftRight = i18n.input.chrome.inputview.layouts.util.createKey({ | 98 'widthInWeight': 2 |
100 'widthInWeight': 2.16 | |
101 }); | 99 }); |
102 var row4 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({ | 100 var row4 = util.createLinearLayout({ |
103 'id': 'row4', | 101 'id': 'row4', |
104 'children': [shiftLeft, keySequenceOf11, shiftRight] | 102 'children': [shiftLeft, keySequenceOf11, shiftRight] |
105 }); | 103 }); |
106 | 104 |
107 return [row1, row2and3, row4]; | 105 return [row1, row2and3, row4]; |
108 }; | 106 }; |
| 107 |
| 108 }); // goog.scope |
OLD | NEW |