| 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 22 matching lines...) Expand all Loading... |
| 33 goog.require('i18n.input.chrome.inputview.KeyboardContainer'); | 33 goog.require('i18n.input.chrome.inputview.KeyboardContainer'); |
| 34 goog.require('i18n.input.chrome.inputview.M17nModel'); | 34 goog.require('i18n.input.chrome.inputview.M17nModel'); |
| 35 goog.require('i18n.input.chrome.inputview.Model'); | 35 goog.require('i18n.input.chrome.inputview.Model'); |
| 36 goog.require('i18n.input.chrome.inputview.PerfTracker'); | 36 goog.require('i18n.input.chrome.inputview.PerfTracker'); |
| 37 goog.require('i18n.input.chrome.inputview.ReadyState'); | 37 goog.require('i18n.input.chrome.inputview.ReadyState'); |
| 38 goog.require('i18n.input.chrome.inputview.Settings'); | 38 goog.require('i18n.input.chrome.inputview.Settings'); |
| 39 goog.require('i18n.input.chrome.inputview.SizeSpec'); | 39 goog.require('i18n.input.chrome.inputview.SizeSpec'); |
| 40 goog.require('i18n.input.chrome.inputview.SpecNodeName'); | 40 goog.require('i18n.input.chrome.inputview.SpecNodeName'); |
| 41 goog.require('i18n.input.chrome.inputview.StateType'); | 41 goog.require('i18n.input.chrome.inputview.StateType'); |
| 42 goog.require('i18n.input.chrome.inputview.SwipeDirection'); | 42 goog.require('i18n.input.chrome.inputview.SwipeDirection'); |
| 43 goog.require('i18n.input.chrome.inputview.elements.Element'); |
| 43 goog.require('i18n.input.chrome.inputview.elements.ElementType'); | 44 goog.require('i18n.input.chrome.inputview.elements.ElementType'); |
| 44 goog.require('i18n.input.chrome.inputview.elements.content.Candidate'); | 45 goog.require('i18n.input.chrome.inputview.elements.content.Candidate'); |
| 45 goog.require('i18n.input.chrome.inputview.elements.content.CandidateView'); | 46 goog.require('i18n.input.chrome.inputview.elements.content.CandidateView'); |
| 46 goog.require('i18n.input.chrome.inputview.elements.content.ExpandedCandidateView
'); | 47 goog.require('i18n.input.chrome.inputview.elements.content.ExpandedCandidateView
'); |
| 47 goog.require('i18n.input.chrome.inputview.elements.content.MenuView'); | 48 goog.require('i18n.input.chrome.inputview.elements.content.MenuView'); |
| 48 goog.require('i18n.input.chrome.inputview.events.EventType'); | 49 goog.require('i18n.input.chrome.inputview.events.EventType'); |
| 49 goog.require('i18n.input.chrome.inputview.events.KeyCodes'); | 50 goog.require('i18n.input.chrome.inputview.events.KeyCodes'); |
| 50 goog.require('i18n.input.chrome.inputview.handler.PointerHandler'); | 51 goog.require('i18n.input.chrome.inputview.handler.PointerHandler'); |
| 51 goog.require('i18n.input.chrome.inputview.util'); | 52 goog.require('i18n.input.chrome.inputview.util'); |
| 52 goog.require('i18n.input.chrome.message.ContextType'); | 53 goog.require('i18n.input.chrome.message.ContextType'); |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 if (data && data[SpecNodeName.DISABLE_LONGPRESS]) { | 681 if (data && data[SpecNodeName.DISABLE_LONGPRESS]) { |
| 681 return; | 682 return; |
| 682 } | 683 } |
| 683 } | 684 } |
| 684 | 685 |
| 685 // POINTER_UP event may be dispatched without a view. This is the case when | 686 // POINTER_UP event may be dispatched without a view. This is the case when |
| 686 // user selected an accent character which is displayed outside of the | 687 // user selected an accent character which is displayed outside of the |
| 687 // keyboard window bounds. For other cases, we expect a view associated with a | 688 // keyboard window bounds. For other cases, we expect a view associated with a |
| 688 // pointer up event. | 689 // pointer up event. |
| 689 if (e.type == EventType.POINTER_UP && !e.view) { | 690 if (e.type == EventType.POINTER_UP && !e.view) { |
| 690 if (this.container_.altDataView.isVisible()) { | 691 if (this.container_.altDataView.isVisible() && |
| 692 e.identifier == this.container_.altDataView.identifier) { |
| 691 var altDataView = this.container_.altDataView; | 693 var altDataView = this.container_.altDataView; |
| 692 var ch = altDataView.getHighlightedCharacter(); | 694 var ch = altDataView.getHighlightedCharacter(); |
| 693 if (ch) { | 695 if (ch) { |
| 694 this.adapter_.sendKeyDownAndUpEvent(ch, altDataView.triggeredBy.id, | 696 this.adapter_.sendKeyDownAndUpEvent(ch, altDataView.triggeredBy.id, |
| 695 altDataView.triggeredBy.keyCode, | 697 altDataView.triggeredBy.keyCode, |
| 696 {'sources': [ch.toLowerCase()], 'possibilities': [1]}); | 698 {'sources': [ch.toLowerCase()], 'possibilities': [1]}); |
| 697 } | 699 } |
| 698 altDataView.hide(); | 700 altDataView.hide(); |
| 699 this.clearUnstickyState_(); | 701 this.clearUnstickyState_(); |
| 700 } | 702 } |
| 701 return; | 703 return; |
| 702 } | 704 } |
| 703 | 705 |
| 704 if (e.type == EventType.POINTER_UP) { | 706 if (e.type == EventType.POINTER_UP) { |
| 705 this.stopBackspaceAutoRepeat_(); | 707 this.stopBackspaceAutoRepeat_(); |
| 706 } | 708 } |
| 707 | 709 |
| 708 if (e.view) { | 710 if (e.view) { |
| 709 this.handlePointerAction_(e.view, e); | 711 this.handlePointerAction_(e.view, e); |
| 710 } else if (e.type == EventType.POINTER_DOWN) { | |
| 711 var tabbableKeysets = [ | |
| 712 Controller.HANDWRITING_VIEW_CODE_, | |
| 713 Controller.EMOJI_VIEW_CODE_]; | |
| 714 if (goog.array.contains(tabbableKeysets, this.currentKeyset_)) { | |
| 715 this.resetAll_(); | |
| 716 this.switchToKeyset(this.container_.currentKeysetView.fromKeyset); | |
| 717 } | |
| 718 } | 712 } |
| 719 }; | 713 }; |
| 720 | 714 |
| 721 | 715 |
| 722 /** | 716 /** |
| 723 * Handles the drag events. Generally, this will forward the event details to | 717 * Handles the drag events. Generally, this will forward the event details to |
| 724 * the components that handle drawing, decoding, etc. | 718 * the components that handle drawing, decoding, etc. |
| 725 * | 719 * |
| 726 * @param {!i18n.input.chrome.inputview.events.DragEvent} e . | 720 * @param {!i18n.input.chrome.inputview.events.DragEvent} e . |
| 727 * @private | 721 * @private |
| (...skipping 10 matching lines...) Expand all Loading... |
| 738 * Handles the swipe action. | 732 * Handles the swipe action. |
| 739 * | 733 * |
| 740 * @param {!i18n.input.chrome.inputview.elements.Element} view The view, for | 734 * @param {!i18n.input.chrome.inputview.elements.Element} view The view, for |
| 741 * swipe event, the view would be the soft key which starts the swipe. | 735 * swipe event, the view would be the soft key which starts the swipe. |
| 742 * @param {!i18n.input.chrome.inputview.events.SwipeEvent} e The swipe event. | 736 * @param {!i18n.input.chrome.inputview.events.SwipeEvent} e The swipe event. |
| 743 * @private | 737 * @private |
| 744 */ | 738 */ |
| 745 Controller.prototype.handleSwipeAction_ = function(view, e) { | 739 Controller.prototype.handleSwipeAction_ = function(view, e) { |
| 746 var direction = e.direction; | 740 var direction = e.direction; |
| 747 if (this.container_.altDataView.isVisible()) { | 741 if (this.container_.altDataView.isVisible()) { |
| 748 this.container_.altDataView.highlightItem(e.x, e.y); | 742 this.container_.altDataView.highlightItem(e.x, e.y, e.identifier); |
| 749 return; | 743 return; |
| 750 } | 744 } |
| 751 if (view.type == ElementType.BACKSPACE_KEY) { | 745 if (view.type == ElementType.BACKSPACE_KEY) { |
| 752 if (this.container_.swipeView.isVisible() || | 746 if (this.container_.swipeView.isVisible() || |
| 753 this.container_.swipeView.isArmed()) { | 747 this.container_.swipeView.isArmed()) { |
| 754 this.stopBackspaceAutoRepeat_(); | 748 this.stopBackspaceAutoRepeat_(); |
| 755 return; | 749 return; |
| 756 } | 750 } |
| 757 } | 751 } |
| 758 | 752 |
| 759 if (view.type == ElementType.CHARACTER_KEY) { | 753 if (view.type == ElementType.CHARACTER_KEY) { |
| 760 view = /** @type {!i18n.input.chrome.inputview.elements.content. | 754 view = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 761 CharacterKey} */ (view); | 755 CharacterKey} */ (view); |
| 762 if (direction & i18n.input.chrome.inputview.SwipeDirection.UP || | 756 if (direction & i18n.input.chrome.inputview.SwipeDirection.UP || |
| 763 direction & i18n.input.chrome.inputview.SwipeDirection.DOWN) { | 757 direction & i18n.input.chrome.inputview.SwipeDirection.DOWN) { |
| 764 var ch = view.getCharacterByGesture(!!(direction & | 758 var ch = view.getCharacterByGesture(!!(direction & |
| 765 i18n.input.chrome.inputview.SwipeDirection.UP)); | 759 i18n.input.chrome.inputview.SwipeDirection.UP)); |
| 766 if (ch) { | 760 if (ch) { |
| 767 view.flickerredCharacter = ch; | 761 view.flickerredCharacter = ch; |
| 768 } | 762 } |
| 769 } | 763 } |
| 770 } | 764 } |
| 771 | 765 |
| 772 if (view.type == ElementType.COMPACT_KEY) { | 766 if (view.type == ElementType.COMPACT_KEY) { |
| 773 | |
| 774 view = /** @type {!i18n.input.chrome.inputview.elements.content. | 767 view = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 775 CompactKey} */ (view); | 768 CompactKey} */ (view); |
| 776 if ((direction & i18n.input.chrome.inputview.SwipeDirection.UP) && | 769 if ((direction & i18n.input.chrome.inputview.SwipeDirection.UP) && |
| 777 view.hintText) { | 770 view.hintText) { |
| 778 view.flickerredCharacter = view.hintText; | 771 view.flickerredCharacter = view.hintText; |
| 779 } | 772 } |
| 780 } | 773 } |
| 781 }; | 774 }; |
| 782 | 775 |
| 783 | 776 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 * @param {!i18n.input.chrome.inputview.elements.Element} view The view. | 828 * @param {!i18n.input.chrome.inputview.elements.Element} view The view. |
| 836 * @param {!i18n.input.chrome.inputview.events.PointerEvent} e . | 829 * @param {!i18n.input.chrome.inputview.events.PointerEvent} e . |
| 837 * @private | 830 * @private |
| 838 */ | 831 */ |
| 839 Controller.prototype.handlePointerAction_ = function(view, e) { | 832 Controller.prototype.handlePointerAction_ = function(view, e) { |
| 840 if (this.adapter_.isGestureTypingEnabled() && | 833 if (this.adapter_.isGestureTypingEnabled() && |
| 841 e.type == EventType.POINTER_DOWN) { | 834 e.type == EventType.POINTER_DOWN) { |
| 842 this.container_.gestureCanvasView.startStroke(e); | 835 this.container_.gestureCanvasView.startStroke(e); |
| 843 } | 836 } |
| 844 | 837 |
| 838 if (this.adapter_.isGestureTypingEnabled() && |
| 839 e.type == EventType.POINTER_UP) { |
| 840 this.container_.gestureCanvasView.endStroke(e); |
| 841 } |
| 842 |
| 843 // Do not trigger other actives when gesturing. |
| 844 if (this.adapter_.isGestureTypingEnabled() && |
| 845 this.container_.gestureCanvasView.isGesturing) { |
| 846 return; |
| 847 } |
| 848 |
| 845 // Listen for DOUBLE_CLICK as well to capture secondary taps on the spacebar. | 849 // Listen for DOUBLE_CLICK as well to capture secondary taps on the spacebar. |
| 846 if (e.type == EventType.POINTER_UP || e.type == EventType.DOUBLE_CLICK) { | 850 if (e.type == EventType.POINTER_UP || e.type == EventType.DOUBLE_CLICK) { |
| 847 this.recordStatsForClosing_( | 851 this.recordStatsForClosing_( |
| 848 'InputMethod.VirtualKeyboard.TapCount', 1, 4095, 4096); | 852 'InputMethod.VirtualKeyboard.TapCount', 1, 4095, 4096); |
| 849 } | 853 } |
| 850 | 854 |
| 851 if (e.type == EventType.SWIPE) { | 855 if (e.type == EventType.SWIPE) { |
| 852 e = /** @type {!i18n.input.chrome.inputview.events.SwipeEvent} */ (e); | 856 e = /** @type {!i18n.input.chrome.inputview.events.SwipeEvent} */ (e); |
| 853 this.handleSwipeAction_(view, e); | 857 this.handleSwipeAction_(view, e); |
| 854 } | 858 } |
| 855 switch (view.type) { | 859 switch (view.type) { |
| 860 case ElementType.KEYBOARD_CONTAINER_VIEW: |
| 861 if (e.type == EventType.POINTER_DOWN) { |
| 862 var tabbableKeysets = [ |
| 863 Controller.HANDWRITING_VIEW_CODE_, |
| 864 Controller.EMOJI_VIEW_CODE_]; |
| 865 if (goog.array.contains(tabbableKeysets, this.currentKeyset_)) { |
| 866 this.resetAll_(); |
| 867 this.switchToKeyset(this.container_.currentKeysetView.fromKeyset); |
| 868 } |
| 869 } |
| 870 return; |
| 856 case ElementType.BACK_BUTTON: | 871 case ElementType.BACK_BUTTON: |
| 857 case ElementType.BACK_TO_KEYBOARD: | 872 case ElementType.BACK_TO_KEYBOARD: |
| 858 if (e.type == EventType.POINTER_OUT || e.type == EventType.POINTER_UP) { | 873 if (e.type == EventType.POINTER_OUT || e.type == EventType.POINTER_UP) { |
| 859 view.setHighlighted(false); | 874 view.setHighlighted(false); |
| 860 } else if (e.type == EventType.POINTER_DOWN || | 875 } else if (e.type == EventType.POINTER_DOWN || |
| 861 e.type == EventType.POINTER_OVER) { | 876 e.type == EventType.POINTER_OVER) { |
| 862 view.setHighlighted(true); | 877 view.setHighlighted(true); |
| 863 } | 878 } |
| 864 if (e.type == EventType.POINTER_UP) { | 879 if (e.type == EventType.POINTER_UP) { |
| 865 this.switchToKeyset(this.container_.currentKeysetView.fromKeyset); | 880 this.switchToKeyset(this.container_.currentKeysetView.fromKeyset); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 view.setHighlighted(false); | 914 view.setHighlighted(false); |
| 900 } else if (e.type == EventType.POINTER_DOWN || | 915 } else if (e.type == EventType.POINTER_DOWN || |
| 901 e.type == EventType.POINTER_OVER) { | 916 e.type == EventType.POINTER_OVER) { |
| 902 view.setHighlighted(true); | 917 view.setHighlighted(true); |
| 903 } | 918 } |
| 904 return; | 919 return; |
| 905 | 920 |
| 906 case ElementType.ALTDATA_VIEW: | 921 case ElementType.ALTDATA_VIEW: |
| 907 view = /** @type {!i18n.input.chrome.inputview.elements.content. | 922 view = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 908 AltDataView} */ (view); | 923 AltDataView} */ (view); |
| 909 if (e.type == EventType.POINTER_DOWN && | 924 if (e.type == EventType.POINTER_UP && e.identifier == view.identifier) { |
| 910 e.target == view.getCoverElement()) { | |
| 911 view.hide(); | |
| 912 } else if (e.type == EventType.POINTER_UP) { | |
| 913 var ch = view.getHighlightedCharacter(); | 925 var ch = view.getHighlightedCharacter(); |
| 914 if (ch) { | 926 if (ch) { |
| 915 this.adapter_.sendKeyDownAndUpEvent(ch, view.triggeredBy.id, | 927 this.adapter_.sendKeyDownAndUpEvent(ch, view.triggeredBy.id, |
| 916 view.triggeredBy.keyCode, | 928 view.triggeredBy.keyCode, |
| 917 {'sources': [ch.toLowerCase()], 'possibilities': [1]}); | 929 {'sources': [ch.toLowerCase()], 'possibilities': [1]}); |
| 918 } | 930 } |
| 919 view.hide(); | 931 view.hide(); |
| 920 this.clearUnstickyState_(); | 932 this.clearUnstickyState_(); |
| 921 this.soundController_.onKeyUp(view.type); | 933 this.soundController_.onKeyUp(view.type); |
| 922 } | 934 } |
| 923 return; | 935 return; |
| 924 | 936 |
| 925 case ElementType.MENU_ITEM: | 937 case ElementType.MENU_ITEM: |
| 926 view = /** @type {!i18n.input.chrome.inputview.elements.content. | 938 view = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 927 MenuItem} */ (view); | 939 MenuItem} */ (view); |
| 928 if (e.type == EventType.CLICK) { | 940 if (e.type == EventType.POINTER_UP) { |
| 929 this.executeCommand_.apply(this, view.getCommand()); | 941 this.executeCommand_.apply(this, view.getCommand()); |
| 930 this.container_.menuView.hide(); | 942 this.container_.menuView.hide(); |
| 931 this.soundController_.onKeyUp(view.type); | 943 this.soundController_.onKeyUp(view.type); |
| 932 this.resetAll_(); | 944 this.resetAll_(); |
| 933 } | 945 } |
| 934 view.setHighlighted(e.type == EventType.POINTER_DOWN || | 946 view.setHighlighted(e.type == EventType.POINTER_DOWN || |
| 935 e.type == EventType.POINTER_OVER); | 947 e.type == EventType.POINTER_OVER); |
| 936 // TODO: Add chrome vox support. | 948 // TODO: Add chrome vox support. |
| 937 return; | 949 return; |
| 938 | 950 |
| 939 case ElementType.MENU_VIEW: | 951 case ElementType.MENU_VIEW: |
| 940 view = /** @type {!i18n.input.chrome.inputview.elements.content. | 952 view = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 941 MenuView} */ (view); | 953 MenuView} */ (view); |
| 942 | 954 |
| 943 if (e.type == EventType.POINTER_DOWN && | 955 if (e.type == EventType.CLICK && |
| 944 e.target == view.getCoverElement()) { | 956 e.target == view.getCoverElement()) { |
| 945 view.hide(); | 957 view.hide(); |
| 946 } | 958 } |
| 947 return; | 959 return; |
| 948 | 960 |
| 949 case ElementType.EMOJI_KEY: | 961 case ElementType.EMOJI_KEY: |
| 950 if (e.type == EventType.CLICK) { | 962 if (e.type == EventType.CLICK) { |
| 951 if (!this.container_.currentKeysetView.isDragging && view.text != '') { | 963 if (!this.container_.currentKeysetView.isDragging && view.text != '') { |
| 952 this.adapter_.commitText(view.text); | 964 this.adapter_.commitText(view.text); |
| 953 this.soundController_.onKeyUp(view.type); | 965 this.soundController_.onKeyUp(view.type); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 case ElementType.CANDIDATES_PAGE_DOWN: | 1075 case ElementType.CANDIDATES_PAGE_DOWN: |
| 1064 if (e.type == EventType.POINTER_UP) { | 1076 if (e.type == EventType.POINTER_UP) { |
| 1065 this.container_.expandedCandidateView.pageDown(); | 1077 this.container_.expandedCandidateView.pageDown(); |
| 1066 } | 1078 } |
| 1067 break; | 1079 break; |
| 1068 case ElementType.CHARACTER_KEY: | 1080 case ElementType.CHARACTER_KEY: |
| 1069 key = /** @type {!i18n.input.chrome.inputview.elements.content. | 1081 key = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 1070 CharacterKey} */ (softKey); | 1082 CharacterKey} */ (softKey); |
| 1071 if (e.type == EventType.LONG_PRESS) { | 1083 if (e.type == EventType.LONG_PRESS) { |
| 1072 this.container_.altDataView.show( | 1084 this.container_.altDataView.show( |
| 1073 key, goog.i18n.bidi.isRtlLanguage(this.languageCode_)); | 1085 key, goog.i18n.bidi.isRtlLanguage(this.languageCode_), |
| 1086 e.identifier); |
| 1074 } else if (e.type == EventType.POINTER_UP) { | 1087 } else if (e.type == EventType.POINTER_UP) { |
| 1075 this.model_.stateManager.triggerChording(); | 1088 this.model_.stateManager.triggerChording(); |
| 1076 var ch = key.getActiveCharacter(); | 1089 var ch = key.getActiveCharacter(); |
| 1077 this.adapter_.sendKeyDownAndUpEvent(ch, key.id, key.keyCode, | 1090 this.adapter_.sendKeyDownAndUpEvent(ch, key.id, key.keyCode, |
| 1078 this.getSpatialData_(key, e.x, e.y)); | 1091 this.getSpatialData_(key, e.x, e.y)); |
| 1079 this.clearUnstickyState_(); | 1092 this.clearUnstickyState_(); |
| 1080 key.flickerredCharacter = ''; | 1093 key.flickerredCharacter = ''; |
| 1081 } | 1094 } |
| 1082 break; | 1095 break; |
| 1083 | 1096 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 key.toKeyset); | 1231 key.toKeyset); |
| 1219 } | 1232 } |
| 1220 } | 1233 } |
| 1221 break; | 1234 break; |
| 1222 | 1235 |
| 1223 case ElementType.COMPACT_KEY: | 1236 case ElementType.COMPACT_KEY: |
| 1224 key = /** @type {!i18n.input.chrome.inputview.elements.content. | 1237 key = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 1225 CompactKey} */(softKey); | 1238 CompactKey} */(softKey); |
| 1226 if (e.type == EventType.LONG_PRESS) { | 1239 if (e.type == EventType.LONG_PRESS) { |
| 1227 this.container_.altDataView.show( | 1240 this.container_.altDataView.show( |
| 1228 key, goog.i18n.bidi.isRtlLanguage(this.languageCode_)); | 1241 key, goog.i18n.bidi.isRtlLanguage(this.languageCode_), |
| 1242 e.identifier); |
| 1229 } else if (e.type == EventType.POINTER_UP) { | 1243 } else if (e.type == EventType.POINTER_UP) { |
| 1230 this.model_.stateManager.triggerChording(); | 1244 this.model_.stateManager.triggerChording(); |
| 1231 var ch = key.getActiveCharacter(); | 1245 var ch = key.getActiveCharacter(); |
| 1232 if (ch.length == 1) { | 1246 if (ch.length == 1) { |
| 1233 this.adapter_.sendKeyDownAndUpEvent(key.getActiveCharacter(), '', 0, | 1247 this.adapter_.sendKeyDownAndUpEvent(key.getActiveCharacter(), '', 0, |
| 1234 this.getSpatialData_(key, e.x, e.y)); | 1248 this.getSpatialData_(key, e.x, e.y)); |
| 1235 } else if (ch.length > 1) { | 1249 } else if (ch.length > 1) { |
| 1236 // Some compact keys contains more than 1 characters, such as '.com', | 1250 // Some compact keys contains more than 1 characters, such as '.com', |
| 1237 // 'http://', etc. Those keys should trigger a direct commit text | 1251 // 'http://', etc. Those keys should trigger a direct commit text |
| 1238 // instead of key events. | 1252 // instead of key events. |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1625 this.container_.expandedCandidateView.state = ExpandedCandidateView.State. | 1639 this.container_.expandedCandidateView.state = ExpandedCandidateView.State. |
| 1626 NONE; | 1640 NONE; |
| 1627 if (this.container_.currentKeysetView) { | 1641 if (this.container_.currentKeysetView) { |
| 1628 this.container_.currentKeysetView.setVisible(true); | 1642 this.container_.currentKeysetView.setVisible(true); |
| 1629 } | 1643 } |
| 1630 if (!this.adapter_.isQPInputView && | 1644 if (!this.adapter_.isQPInputView && |
| 1631 (this.currentKeyset_ == Controller.HANDWRITING_VIEW_CODE_ || | 1645 (this.currentKeyset_ == Controller.HANDWRITING_VIEW_CODE_ || |
| 1632 this.currentKeyset_ == Controller.EMOJI_VIEW_CODE_)) { | 1646 this.currentKeyset_ == Controller.EMOJI_VIEW_CODE_)) { |
| 1633 this.container_.candidateView.switchToIcon( | 1647 this.container_.candidateView.switchToIcon( |
| 1634 CandidateView.IconType.BACK, true); | 1648 CandidateView.IconType.BACK, true); |
| 1649 } else if (this.currentKeyset_ != Controller.HANDWRITING_VIEW_CODE_ && |
| 1650 this.currentKeyset_ != Controller.EMOJI_VIEW_CODE_) { |
| 1651 this.container_.candidateView.switchToIcon(CandidateView.IconType.VOICE, |
| 1652 this.adapter_.isVoiceInputEnabled); |
| 1635 } else { | 1653 } else { |
| 1636 this.container_.candidateView.switchToIcon(CandidateView.IconType.VOICE, | 1654 this.container_.candidateView.switchToIcon(CandidateView.IconType.VOICE, |
| 1637 this.adapter_.isVoiceInputEnabled); | 1655 false); |
| 1638 } | 1656 } |
| 1639 }; | 1657 }; |
| 1640 | 1658 |
| 1641 | 1659 |
| 1642 /** | 1660 /** |
| 1643 * Callback when the layout is loaded. | 1661 * Callback when the layout is loaded. |
| 1644 * | 1662 * |
| 1645 * @param {!i18n.input.chrome.inputview.events.LayoutLoadedEvent} e The event. | 1663 * @param {!i18n.input.chrome.inputview.events.LayoutLoadedEvent} e The event. |
| 1646 * @private | 1664 * @private |
| 1647 */ | 1665 */ |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1855 } | 1873 } |
| 1856 | 1874 |
| 1857 if (window.innerHeight != height && !opt_ignoreWindowResize) { | 1875 if (window.innerHeight != height && !opt_ignoreWindowResize) { |
| 1858 if (this.lastResizeHeight_ != height) { | 1876 if (this.lastResizeHeight_ != height) { |
| 1859 this.lastResizeHeight_ = height; | 1877 this.lastResizeHeight_ = height; |
| 1860 window.resizeTo(screen.width, height); | 1878 window.resizeTo(screen.width, height); |
| 1861 } | 1879 } |
| 1862 return; | 1880 return; |
| 1863 } | 1881 } |
| 1864 | 1882 |
| 1865 this.container_.resize(screen.width, height, widthPercent, | 1883 this.container_.setContainerSize(screen.width, height, widthPercent, |
| 1866 candidateViewHeight); | 1884 candidateViewHeight); |
| 1867 this.container_.candidateView.setToolbarVisible(this.shouldShowToolBar_()); | 1885 this.container_.candidateView.setToolbarVisible(this.shouldShowToolBar_()); |
| 1868 if (this.container_.currentKeysetView) { | 1886 if (this.container_.currentKeysetView) { |
| 1869 this.isKeyboardReady = true; | 1887 this.isKeyboardReady = true; |
| 1870 } | 1888 } |
| 1871 }; | 1889 }; |
| 1872 | 1890 |
| 1873 | 1891 |
| 1874 /** | 1892 /** |
| 1875 * Loads the resources, for currentKeyset, passwdKeyset, handwriting, | 1893 * Loads the resources, for currentKeyset, passwdKeyset, handwriting, |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2116 toKeyset = this.currentKeyset_.replace('compact', 'en.compact'); | 2134 toKeyset = this.currentKeyset_.replace('compact', 'en.compact'); |
| 2117 } | 2135 } |
| 2118 } | 2136 } |
| 2119 if (toKeyset) { | 2137 if (toKeyset) { |
| 2120 this.resetAll_(); | 2138 this.resetAll_(); |
| 2121 this.switchToKeyset(toKeyset); | 2139 this.switchToKeyset(toKeyset); |
| 2122 } | 2140 } |
| 2123 } | 2141 } |
| 2124 }; | 2142 }; |
| 2125 }); // goog.scope | 2143 }); // goog.scope |
| OLD | NEW |