OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * The long-press delay in milliseconds before long-press handler is | 6 * The long-press delay in milliseconds before long-press handler is |
7 * invoked. | 7 * invoked. |
8 * @const | 8 * @const |
9 * @type {number} | 9 * @type {number} |
10 */ | 10 */ |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 * Hint text value associated with the key. Typically, the value is a | 165 * Hint text value associated with the key. Typically, the value is a |
166 * single character. | 166 * single character. |
167 * @return {string} | 167 * @return {string} |
168 */ | 168 */ |
169 get hintTextValue() { | 169 get hintTextValue() { |
170 return this.invert ? (this.char || this.textContent) : this.hintText; | 170 return this.invert ? (this.char || this.textContent) : this.hintText; |
171 }, | 171 }, |
172 | 172 |
173 /** | 173 /** |
174 * Handles a swipe flick that originated from this key. | 174 * Handles a swipe flick that originated from this key. |
175 * @param {detail} The details of the swipe. | 175 * @param {detail} detail The details of the swipe. |
176 */ | 176 */ |
177 onFlick: function(detail) { | 177 onFlick: function(detail) { |
178 if (!(detail.direction & SwipeDirection.UP) || !this.hintTextValue) | 178 if (!(detail.direction & SwipeDirection.UP) || !this.hintTextValue) |
179 return; | 179 return; |
180 var typeDetails = {char: this.hintTextValue}; | 180 var typeDetails = {char: this.hintTextValue}; |
181 this.fire('type-key', typeDetails); | 181 this.fire('type-key', typeDetails); |
182 }, | 182 }, |
183 | 183 |
184 /** | 184 /** |
185 * Returns a subset of the key attributes. | 185 * Returns a subset of the key attributes. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 hintText: this.hintTextValue | 219 hintText: this.hintTextValue |
220 }; | 220 }; |
221 if (this.keysetRules && this.keysetRules.long != undefined) { | 221 if (this.keysetRules && this.keysetRules.long != undefined) { |
222 detail.toKeyset = this.keysetRules.long[TO_KEYSET - OFFSET]; | 222 detail.toKeyset = this.keysetRules.long[TO_KEYSET - OFFSET]; |
223 detail.nextKeyset = this.keysetRules.long[NEXT_KEYSET - OFFSET]; | 223 detail.nextKeyset = this.keysetRules.long[NEXT_KEYSET - OFFSET]; |
224 } | 224 } |
225 this.fire('key-longpress', detail); | 225 this.fire('key-longpress', detail); |
226 }, null, LONGPRESS_DELAY_MSEC); | 226 }, null, LONGPRESS_DELAY_MSEC); |
227 }, | 227 }, |
228 }); | 228 }); |
OLD | NEW |