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 |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 * @param {string=} opt_compactKeyboardId The compact keyboard id. | 490 * @param {string=} opt_compactKeyboardId The compact keyboard id. |
491 * @return {!Object} The key data. | 491 * @return {!Object} The key data. |
492 */ | 492 */ |
493 i18n.input.chrome.inputview.content.util.createData = function(keyCharacters, | 493 i18n.input.chrome.inputview.content.util.createData = function(keyCharacters, |
494 viewIdPrefix, is102, hasAltGrKey, opt_keyCodes, opt_compactKeyboardId) { | 494 viewIdPrefix, is102, hasAltGrKey, opt_keyCodes, opt_compactKeyboardId) { |
495 var keyList = []; | 495 var keyList = []; |
496 var mapping = {}; | 496 var mapping = {}; |
497 var keyCodes = opt_keyCodes || []; | 497 var keyCodes = opt_keyCodes || []; |
498 var keyIds = is102 ? i18n.input.chrome.inputview.content.util.KEY_CODES_102 : | 498 var keyIds = is102 ? i18n.input.chrome.inputview.content.util.KEY_CODES_102 : |
499 i18n.input.chrome.inputview.content.util.KEY_CODES_101; | 499 i18n.input.chrome.inputview.content.util.KEY_CODES_101; |
| 500 // The keys shows the shift character in Default state. In material design, |
| 501 // Only the first 11 keys will show shift character. |
| 502 var keysShowShift = 11; |
500 for (var i = 0; i < keyCharacters.length - 1; i++) { | 503 for (var i = 0; i < keyCharacters.length - 1; i++) { |
501 var spec = {}; | 504 var spec = {}; |
502 spec[SpecNodeName.ID] = keyIds[i]; | 505 spec[SpecNodeName.ID] = keyIds[i]; |
503 spec[SpecNodeName.TYPE] = ElementType.CHARACTER_KEY; | 506 spec[SpecNodeName.TYPE] = ElementType.CHARACTER_KEY; |
504 spec[SpecNodeName.CHARACTERS] = keyCharacters[i]; | 507 spec[SpecNodeName.CHARACTERS] = keyCharacters[i]; |
505 spec[SpecNodeName.KEY_CODE] = keyCodes[i]; | 508 spec[SpecNodeName.KEY_CODE] = keyCodes[i]; |
| 509 if (i < keysShowShift) { |
| 510 spec[SpecNodeName.ENABLE_SHIFT_RENDERING] = true; |
| 511 } |
506 var key = i18n.input.chrome.inputview.content.util.createKey(spec); | 512 var key = i18n.input.chrome.inputview.content.util.createKey(spec); |
507 keyList.push(key); | 513 keyList.push(key); |
508 } | 514 } |
509 | 515 |
510 i18n.input.chrome.inputview.content.util.insertModifierKeys_(keyList, | 516 i18n.input.chrome.inputview.content.util.insertModifierKeys_(keyList, |
511 is102, opt_compactKeyboardId); | 517 is102, opt_compactKeyboardId); |
512 for (var i = 0; i < keyList.length; i++) { | 518 for (var i = 0; i < keyList.length; i++) { |
513 var key = keyList[i]; | 519 var key = keyList[i]; |
514 mapping[key['spec'][SpecNodeName.ID]] = viewIdPrefix + i; | 520 mapping[key['spec'][SpecNodeName.ID]] = viewIdPrefix + i; |
515 } | 521 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 keyList.push(i18n.input.chrome.inputview.content.util.createEnSwitcherKey()); | 601 keyList.push(i18n.input.chrome.inputview.content.util.createEnSwitcherKey()); |
596 keyList.push(i18n.input.chrome.inputview.content.util.createAltgrKey()); | 602 keyList.push(i18n.input.chrome.inputview.content.util.createAltgrKey()); |
597 keyList.push(i18n.input.chrome.inputview.content.util.createArrowKey( | 603 keyList.push(i18n.input.chrome.inputview.content.util.createArrowKey( |
598 i18n.input.chrome.inputview.Direction.LEFT)); | 604 i18n.input.chrome.inputview.Direction.LEFT)); |
599 keyList.push(i18n.input.chrome.inputview.content.util.createArrowKey( | 605 keyList.push(i18n.input.chrome.inputview.content.util.createArrowKey( |
600 i18n.input.chrome.inputview.Direction.RIGHT)); | 606 i18n.input.chrome.inputview.Direction.RIGHT)); |
601 keyList.push(i18n.input.chrome.inputview.content.util. | 607 keyList.push(i18n.input.chrome.inputview.content.util. |
602 createHideKeyboardKey()); | 608 createHideKeyboardKey()); |
603 }; | 609 }; |
604 }); // goog.scope | 610 }); // goog.scope |
OLD | NEW |