| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Auto-repeat delays (in ms) for the corresponding slider values, from | 8 * Auto-repeat delays (in ms) for the corresponding slider values, from |
| 9 * long to short. The values were chosen to provide a large range while giving | 9 * long to short. The values were chosen to provide a large range while giving |
| 10 * several options near the defaults. | 10 * several options near the defaults. |
| 11 * @type {!Array.<number>} | 11 * @type {!Array<number>} |
| 12 * @const | 12 * @const |
| 13 */ | 13 */ |
| 14 var AUTO_REPEAT_DELAYS = | 14 var AUTO_REPEAT_DELAYS = |
| 15 [2000, 1500, 1000, 500, 300, 200, 150]; | 15 [2000, 1500, 1000, 500, 300, 200, 150]; |
| 16 | 16 |
| 17 /** | 17 /** |
| 18 * Auto-repeat intervals (in ms) for the corresponding slider values, from | 18 * Auto-repeat intervals (in ms) for the corresponding slider values, from |
| 19 * long to short. The slider itself is labeled "rate", the inverse of | 19 * long to short. The slider itself is labeled "rate", the inverse of |
| 20 * interval, and goes from slow (long interval) to fast (short interval). | 20 * interval, and goes from slow (long interval) to fast (short interval). |
| 21 * @type {!Array.<number>} | 21 * @type {!Array<number>} |
| 22 * @const | 22 * @const |
| 23 */ | 23 */ |
| 24 var AUTO_REPEAT_INTERVALS = | 24 var AUTO_REPEAT_INTERVALS = |
| 25 [2000, 1000, 500, 300, 200, 100, 50, 30, 20]; | 25 [2000, 1000, 500, 300, 200, 100, 50, 30, 20]; |
| 26 | 26 |
| 27 /** | 27 /** |
| 28 * Encapsulated handling of the keyboard overlay. | 28 * Encapsulated handling of the keyboard overlay. |
| 29 * @constructor | 29 * @constructor |
| 30 * @extends {options.SettingsDialog} | 30 * @extends {options.SettingsDialog} |
| 31 */ | 31 */ |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 */ | 131 */ |
| 132 showDiamondKeyOptions_: function(show) { | 132 showDiamondKeyOptions_: function(show) { |
| 133 $('diamond-key-remapping-section').hidden = !show; | 133 $('diamond-key-remapping-section').hidden = !show; |
| 134 }, | 134 }, |
| 135 | 135 |
| 136 /** | 136 /** |
| 137 * Sets the slider's value to the number in |values| that is closest to | 137 * Sets the slider's value to the number in |values| that is closest to |
| 138 * |value|. | 138 * |value|. |
| 139 * @param {string} id The slider's ID. | 139 * @param {string} id The slider's ID. |
| 140 * @param {number} value The value to find. | 140 * @param {number} value The value to find. |
| 141 * @param {!Array.<number>} values The array to search. | 141 * @param {!Array<number>} values The array to search. |
| 142 * @private | 142 * @private |
| 143 */ | 143 */ |
| 144 updateSliderFromValue_: function(id, value, values) { | 144 updateSliderFromValue_: function(id, value, values) { |
| 145 var index = values.indexOf(value); | 145 var index = values.indexOf(value); |
| 146 if (index == -1) { | 146 if (index == -1) { |
| 147 var closestValue = Infinity; | 147 var closestValue = Infinity; |
| 148 for (var i = 0; i < values.length; i++) { | 148 for (var i = 0; i < values.length; i++) { |
| 149 if (Math.abs(values[i] - value) < | 149 if (Math.abs(values[i] - value) < |
| 150 Math.abs(closestValue - value)) { | 150 Math.abs(closestValue - value)) { |
| 151 closestValue = values[i]; | 151 closestValue = values[i]; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 165 cr.makePublic(KeyboardOverlay, [ | 165 cr.makePublic(KeyboardOverlay, [ |
| 166 'showCapsLockOptions', | 166 'showCapsLockOptions', |
| 167 'showDiamondKeyOptions', | 167 'showDiamondKeyOptions', |
| 168 ]); | 168 ]); |
| 169 | 169 |
| 170 // Export | 170 // Export |
| 171 return { | 171 return { |
| 172 KeyboardOverlay: KeyboardOverlay | 172 KeyboardOverlay: KeyboardOverlay |
| 173 }; | 173 }; |
| 174 }); | 174 }); |
| OLD | NEW |