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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 | 594 |
595 this.isSettingReady = true; | 595 this.isSettingReady = true; |
596 var keysetMap = this.contextTypeToKeysetMap_[this.currentInputMethod_]; | 596 var keysetMap = this.contextTypeToKeysetMap_[this.currentInputMethod_]; |
597 var newKeyset = ''; | 597 var newKeyset = ''; |
598 if (this.adapter_.isA11yMode) { | 598 if (this.adapter_.isA11yMode) { |
599 newKeyset = util.getConfigName(keysetMap[ContextType.DEFAULT]); | 599 newKeyset = util.getConfigName(keysetMap[ContextType.DEFAULT]); |
600 } else { | 600 } else { |
601 newKeyset = /** @type {string} */ (this.model_.settings. | 601 newKeyset = /** @type {string} */ (this.model_.settings. |
602 getPreference(util.getConfigName(keysetMap[ContextType.DEFAULT]))); | 602 getPreference(util.getConfigName(keysetMap[ContextType.DEFAULT]))); |
603 } | 603 } |
604 if (!this.adapter_.isExperimental && keysetMap[ContextType.DEFAULT] == | 604 if (!this.adapter_.features.isEnabled(FeatureName.EXPERIMENTAL) && |
| 605 keysetMap[ContextType.DEFAULT] == |
605 'zhuyin.compact.qwerty') { | 606 'zhuyin.compact.qwerty') { |
606 newKeyset = 'zhuyin'; | 607 newKeyset = 'zhuyin'; |
607 } | 608 } |
608 if (newKeyset) { | 609 if (newKeyset) { |
609 this.setDefaultKeyset_(newKeyset); | 610 this.setDefaultKeyset_(newKeyset); |
610 } | 611 } |
611 this.container_.selectView.setVisible( | 612 this.container_.selectView.setVisible( |
612 this.adapter_.features.isEnabled(FeatureName.GESTURE_EDITTING)); | 613 this.adapter_.features.isEnabled(FeatureName.GESTURE_EDITTING)); |
613 // Loads resources in case the default keyset is changed. | 614 // Loads resources in case the default keyset is changed. |
614 this.loadAllResources_(); | 615 this.loadAllResources_(); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 | 733 |
733 /** | 734 /** |
734 * Handles the drag events. Generally, this will forward the event details to | 735 * Handles the drag events. Generally, this will forward the event details to |
735 * the components that handle drawing, decoding, etc. | 736 * the components that handle drawing, decoding, etc. |
736 * | 737 * |
737 * @param {!i18n.input.chrome.inputview.events.DragEvent} e . | 738 * @param {!i18n.input.chrome.inputview.events.DragEvent} e . |
738 * @private | 739 * @private |
739 */ | 740 */ |
740 Controller.prototype.onDragEvent_ = function(e) { | 741 Controller.prototype.onDragEvent_ = function(e) { |
741 if (this.adapter_.isGestureTypingEnabled() && e.type == EventType.DRAG) { | 742 if (this.adapter_.isGestureTypingEnabled() && e.type == EventType.DRAG) { |
742 this.container_.gestureCanvasView.addPointAndDraw(e); | 743 this.container_.gestureCanvasView.addPoint(e); |
743 return; | 744 return; |
744 } | 745 } |
745 }; | 746 }; |
746 | 747 |
747 | 748 |
748 /** | 749 /** |
749 * Handles the swipe action. | 750 * Handles the swipe action. |
750 * | 751 * |
751 * @param {!i18n.input.chrome.inputview.elements.Element} view The view, for | 752 * @param {!i18n.input.chrome.inputview.elements.Element} view The view, for |
752 * swipe event, the view would be the soft key which starts the swipe. | 753 * swipe event, the view would be the soft key which starts the swipe. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 | 840 |
840 /** | 841 /** |
841 * Handles the pointer action. | 842 * Handles the pointer action. |
842 * | 843 * |
843 * @param {!i18n.input.chrome.inputview.elements.Element} view The view. | 844 * @param {!i18n.input.chrome.inputview.elements.Element} view The view. |
844 * @param {!i18n.input.chrome.inputview.events.PointerEvent} e . | 845 * @param {!i18n.input.chrome.inputview.events.PointerEvent} e . |
845 * @private | 846 * @private |
846 */ | 847 */ |
847 Controller.prototype.handlePointerAction_ = function(view, e) { | 848 Controller.prototype.handlePointerAction_ = function(view, e) { |
848 if (this.adapter_.isGestureTypingEnabled() && | 849 if (this.adapter_.isGestureTypingEnabled() && |
849 e.type == EventType.POINTER_UP) { | 850 e.type == EventType.POINTER_DOWN) { |
850 this.container_.gestureCanvasView.clear(); | 851 this.container_.gestureCanvasView.startStroke(e); |
851 } | 852 } |
852 | 853 |
853 // Listen for DOUBLE_CLICK as well to capture secondary taps on the spacebar. | 854 // Listen for DOUBLE_CLICK as well to capture secondary taps on the spacebar. |
854 if (e.type == EventType.POINTER_UP || e.type == EventType.DOUBLE_CLICK) { | 855 if (e.type == EventType.POINTER_UP || e.type == EventType.DOUBLE_CLICK) { |
855 this.recordStatsForClosing_( | 856 this.recordStatsForClosing_( |
856 'InputMethod.VirtualKeyboard.TapCount', 1, 4095, 4096); | 857 'InputMethod.VirtualKeyboard.TapCount', 1, 4095, 4096); |
857 } | 858 } |
858 | 859 |
859 if (e.type == EventType.SWIPE) { | 860 if (e.type == EventType.SWIPE) { |
860 e = /** @type {!i18n.input.chrome.inputview.events.SwipeEvent} */ (e); | 861 e = /** @type {!i18n.input.chrome.inputview.events.SwipeEvent} */ (e); |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 case ElementType.MENU_KEY: | 1251 case ElementType.MENU_KEY: |
1251 key = /** @type {!content.MenuKey} */ (softKey); | 1252 key = /** @type {!content.MenuKey} */ (softKey); |
1252 if (e.type == EventType.POINTER_DOWN) { | 1253 if (e.type == EventType.POINTER_DOWN) { |
1253 var isCompact = this.currentKeyset_.indexOf('compact') != -1; | 1254 var isCompact = this.currentKeyset_.indexOf('compact') != -1; |
1254 // Gets the default full keyboard instead of default keyset because | 1255 // Gets the default full keyboard instead of default keyset because |
1255 // the default keyset can be a compact keyset which would cause problem | 1256 // the default keyset can be a compact keyset which would cause problem |
1256 // in MenuView.show(). | 1257 // in MenuView.show(). |
1257 var defaultFullKeyset = this.initialKeyset_.split(/\./)[0]; | 1258 var defaultFullKeyset = this.initialKeyset_.split(/\./)[0]; |
1258 var enableCompact = !this.adapter_.isA11yMode && goog.array.contains( | 1259 var enableCompact = !this.adapter_.isA11yMode && goog.array.contains( |
1259 util.KEYSETS_HAVE_COMPACT, defaultFullKeyset); | 1260 util.KEYSETS_HAVE_COMPACT, defaultFullKeyset); |
1260 if (defaultFullKeyset == 'zhuyin' && !this.adapter_.isExperimental || | 1261 if (defaultFullKeyset == 'zhuyin' && |
| 1262 !this.adapter_.features.isEnabled(FeatureName.EXPERIMENTAL) || |
1261 this.languageCode_ == 'ko') { | 1263 this.languageCode_ == 'ko') { |
1262 // Hides 'switch to compact' for zhuyin when not in experimental env. | 1264 // Hides 'switch to compact' for zhuyin when not in experimental env. |
1263 enableCompact = false; | 1265 enableCompact = false; |
1264 } | 1266 } |
1265 var self = this; | 1267 var self = this; |
1266 var hasHwt = !this.adapter_.isPasswordBox() && | 1268 var hasHwt = !this.adapter_.isPasswordBox() && |
1267 !Controller.DISABLE_HWT && goog.object.contains( | 1269 !Controller.DISABLE_HWT && goog.object.contains( |
1268 InputToolCode, this.getHwtInputToolCode_()); | 1270 InputToolCode, this.getHwtInputToolCode_()); |
1269 var hasEmoji = !this.adapter_.isPasswordBox(); | 1271 var hasEmoji = !this.adapter_.isPasswordBox(); |
1270 var enableSettings = this.shouldEnableSettings() && | 1272 var enableSettings = this.shouldEnableSettings() && |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2111 toKeyset = this.currentKeyset_.replace('compact', 'en.compact'); | 2113 toKeyset = this.currentKeyset_.replace('compact', 'en.compact'); |
2112 } | 2114 } |
2113 } | 2115 } |
2114 if (toKeyset) { | 2116 if (toKeyset) { |
2115 this.resetAll_(); | 2117 this.resetAll_(); |
2116 this.switchToKeyset(toKeyset); | 2118 this.switchToKeyset(toKeyset); |
2117 } | 2119 } |
2118 } | 2120 } |
2119 }; | 2121 }; |
2120 }); // goog.scope | 2122 }); // goog.scope |
OLD | NEW |