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 (function(exports) { | 4 (function(exports) { |
5 /** | 5 /** |
6 * Alignment options for a keyset. | 6 * Alignment options for a keyset. |
7 * @param {Object=} opt_keyset The keyset to calculate the dimensions for. | 7 * @param {Object=} opt_keyset The keyset to calculate the dimensions for. |
8 * Defaults to the current active keyset. | 8 * Defaults to the current active keyset. |
9 */ | 9 */ |
10 var AlignmentOptions = function(opt_keyset) { | 10 var AlignmentOptions = function(opt_keyset) { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 else | 198 else |
199 return binarySearch_(array, mid + 1, end, testFn); | 199 return binarySearch_(array, mid + 1, end, testFn); |
200 } | 200 } |
201 | 201 |
202 /** | 202 /** |
203 * Calculate width and height of the window. | 203 * Calculate width and height of the window. |
204 * @private | 204 * @private |
205 * @return {Array.<String, number>} The bounds of the keyboard container. | 205 * @return {Array.<String, number>} The bounds of the keyboard container. |
206 */ | 206 */ |
207 function getKeyboardBounds_() { | 207 function getKeyboardBounds_() { |
208 var keyboard = $('keyboard'); | |
209 var ratio = DEFAULT_KEYBOARD_ASPECT_RATIO; | |
210 if (keyboard.config && keyboard.config.a11ymode) { | |
211 ratio = DEFAULT_A11Y_KEYBOARD_ASPECT_RATIO; | |
212 } | |
213 return { | 208 return { |
214 "width": screen.width, | 209 "width": screen.width, |
215 "height": screen.height * ratio | 210 "height": screen.height * DEFAULT_KEYBOARD_ASPECT_RATIO |
216 }; | 211 }; |
217 } | 212 } |
218 | 213 |
219 /** | 214 /** |
220 * Calculates the desired key aspect ratio based on screen size. | 215 * Calculates the desired key aspect ratio based on screen size. |
221 * @return {number} The aspect ratio to use. | 216 * @return {number} The aspect ratio to use. |
222 */ | 217 */ |
223 function getKeyAspectRatio() { | 218 function getKeyAspectRatio() { |
224 return (screen.width > screen.height) ? | 219 return (screen.width > screen.height) ? |
225 KEY_ASPECT_RATIO_LANDSCAPE : KEY_ASPECT_RATIO_PORTRAIT; | 220 KEY_ASPECT_RATIO_LANDSCAPE : KEY_ASPECT_RATIO_PORTRAIT; |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 addEventListener('touchend', function(e) { e.preventDefault() }); | 627 addEventListener('touchend', function(e) { e.preventDefault() }); |
633 addEventListener('touchmove', function(e) { e.preventDefault() }); | 628 addEventListener('touchmove', function(e) { e.preventDefault() }); |
634 addEventListener('polymer-ready', function(e) { | 629 addEventListener('polymer-ready', function(e) { |
635 flattenKeysets(); | 630 flattenKeysets(); |
636 resolveAudio(); | 631 resolveAudio(); |
637 }); | 632 }); |
638 addEventListener('stateChange', function(e) { | 633 addEventListener('stateChange', function(e) { |
639 if (e.detail.value == $('keyboard').activeKeysetId) | 634 if (e.detail.value == $('keyboard').activeKeysetId) |
640 realignAll(); | 635 realignAll(); |
641 }) | 636 }) |
OLD | NEW |