OLD | NEW |
---|---|
1 <!-- | 1 <!-- |
2 -- Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 -- Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 -- Use of this source code is governed by a BSD-style license that can be | 3 -- Use of this source code is governed by a BSD-style license that can be |
4 -- found in the LICENSE file. | 4 -- found in the LICENSE file. |
5 --> | 5 --> |
6 | 6 |
7 <polymer-element name="kb-keyboard" on-key-over="keyOver" on-key-up="keyUp" | 7 <polymer-element name="kb-keyboard" on-key-over="keyOver" on-key-up="keyUp" |
8 on-key-down="keyDown" on-key-longpress="keyLongpress" on-pointerup="up" | 8 on-key-down="keyDown" on-key-longpress="keyLongpress" on-pointerup="up" |
9 on-enable-dbl="enableDbl" attributes="keyset layout rows"> | 9 on-enable-dbl="enableDbl" attributes="keyset layout rows"> |
10 <template> | 10 <template> |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 repeatKey.cancel(); | 137 repeatKey.cancel(); |
138 var toKeyset = detail.toKeyset; | 138 var toKeyset = detail.toKeyset; |
139 if (toKeyset) { | 139 if (toKeyset) { |
140 this.keyset = toKeyset; | 140 this.keyset = toKeyset; |
141 this.querySelector('#' + this.layout + '-' + this.keyset).nextKeyset = | 141 this.querySelector('#' + this.layout + '-' + this.keyset).nextKeyset = |
142 detail.nextKeyset; | 142 detail.nextKeyset; |
143 return; | 143 return; |
144 } | 144 } |
145 | 145 |
146 if (detail.repeat) { | 146 if (detail.repeat) { |
147 insertText(detail.char); | 147 insertText(detail.char); |
bshe
2013/07/25 15:33:05
Here and the insertText below probably also need t
kevers
2013/07/26 00:53:30
Was leaving it for a followup CL, but trivial enou
| |
148 repeatKey.key = this.lastPressedKey; | 148 repeatKey.key = this.lastPressedKey; |
149 repeatKey.timer = setTimeout(function() { | 149 repeatKey.timer = setTimeout(function() { |
150 repeatKey.timer = undefined; | 150 repeatKey.timer = undefined; |
151 repeatKey.interval = setInterval(function() { | 151 repeatKey.interval = setInterval(function() { |
152 insertText(detail.char); | 152 insertText(detail.char); |
153 }, REPEAT_INTERVAL_MSEC); | 153 }, REPEAT_INTERVAL_MSEC); |
154 }, Math.max(0, REPEAT_DELAY_MSEC - REPEAT_INTERVAL_MSEC)); | 154 }, Math.max(0, REPEAT_DELAY_MSEC - REPEAT_INTERVAL_MSEC)); |
155 } | 155 } |
156 }, | 156 }, |
157 | 157 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 case 'Microphone': | 230 case 'Microphone': |
231 this.voiceInput_.onDown(); | 231 this.voiceInput_.onDown(); |
232 return; | 232 return; |
233 case '.': | 233 case '.': |
234 case '?': | 234 case '?': |
235 case '!': | 235 case '!': |
236 enterUpperOnSpace = true; | 236 enterUpperOnSpace = true; |
237 break; | 237 break; |
238 default: | 238 default: |
239 break; | 239 break; |
240 } | 240 } |
bshe
2013/07/25 15:33:05
Does this break multiple character keys like ".com
kevers
2013/07/26 00:53:30
Good catch. Fixed.
| |
241 insertText(char); | 241 // Generate fabricated key events to simulate typing on a physical |
242 // keybaord. | |
243 dispatchKeyEvent('keyPressed', char); | |
244 dispatchKeyEvent('keyReleased', char); | |
242 }, | 245 }, |
243 | 246 |
244 /* | 247 /* |
245 * Handles key-longpress event that is sent by kb-key-base. | 248 * Handles key-longpress event that is sent by kb-key-base. |
246 * @param {CustomEvent} event The key-longpress event dispatched by | 249 * @param {CustomEvent} event The key-longpress event dispatched by |
247 * kb-key-base. | 250 * kb-key-base. |
248 * @param {Object} detail The detail of pressed key. | 251 * @param {Object} detail The detail of pressed key. |
249 */ | 252 */ |
250 keyLongpress: function(event, detail) { | 253 keyLongpress: function(event, detail) { |
251 var toKeyset = detail.toKeyset; | 254 var toKeyset = detail.toKeyset; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 } | 301 } |
299 } | 302 } |
300 if (keysetsLoaded) | 303 if (keysetsLoaded) |
301 console.error('No default keyset found for ' + this.layout); | 304 console.error('No default keyset found for ' + this.layout); |
302 return false; | 305 return false; |
303 } | 306 } |
304 }); | 307 }); |
305 </script> | 308 </script> |
306 </polymer-element> | 309 </polymer-element> |
307 | 310 |
OLD | NEW |