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 // Redefine '$' here rather than including 'cr.js', since this is | 5 // Redefine '$' here rather than including 'cr.js', since this is |
6 // the only function needed. This allows this file to be loaded | 6 // the only function needed. This allows this file to be loaded |
7 // in a browser directly for layout and some testing purposes. | 7 // in a browser directly for layout and some testing purposes. |
8 var $ = function(id) { return document.getElementById(id); }; | 8 var $ = function(id) { return document.getElementById(id); }; |
9 | 9 |
10 /** | 10 /** |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 | 51 |
52 var label = row.querySelector('.row-label'); | 52 var label = row.querySelector('.row-label'); |
53 var input = row.querySelector('.input'); | 53 var input = row.querySelector('.input'); |
54 var units = row.querySelector('.row-units'); | 54 var units = row.querySelector('.row-units'); |
55 | 55 |
56 label.setAttribute('for', field.key); | 56 label.setAttribute('for', field.key); |
57 label.textContent = field.label; | 57 label.textContent = field.label; |
58 input.id = field.key; | 58 input.id = field.key; |
59 input.min = field.min || 0; | 59 input.min = field.min || 0; |
60 | 60 |
61 if (field.max) input.max = field.max; | 61 if (field.max) |
62 if (field.step) input.step = field.step; | 62 input.max = field.max; |
63 | |
64 if (field.step) | |
65 input.step = field.step; | |
arv (Not doing code reviews)
2013/03/05 19:04:46
or
input.step = field.step || 'any';
sadrul
2013/03/05 20:48:52
Done.
| |
66 else | |
67 input.step = 'any'; | |
63 | 68 |
64 if (field.units) | 69 if (field.units) |
65 units.innerHTML = field.units; | 70 units.innerHTML = field.units; |
66 | 71 |
67 section.querySelector('.section-properties').appendChild(row); | 72 section.querySelector('.section-properties').appendChild(row); |
68 } | 73 } |
69 $('gesture-form').appendChild(section); | 74 $('gesture-form').appendChild(section); |
70 }, | 75 }, |
71 | 76 |
72 /** | 77 /** |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 units: '%' | 252 units: '%' |
248 }, | 253 }, |
249 { | 254 { |
250 key: 'rail_start_proportion', | 255 key: 'rail_start_proportion', |
251 label: 'Rail-Start Proportion', | 256 label: 'Rail-Start Proportion', |
252 units: '%' | 257 units: '%' |
253 }, | 258 }, |
254 { | 259 { |
255 key: 'fling_acceleration_curve_coefficient_0', | 260 key: 'fling_acceleration_curve_coefficient_0', |
256 label: 'Touchscreen Fling Acceleration', | 261 label: 'Touchscreen Fling Acceleration', |
257 units: 'x<sup>3</sup>' | 262 units: 'x<sup>3</sup>', |
263 min: '-1' | |
258 }, | 264 }, |
259 { | 265 { |
260 key: 'fling_acceleration_curve_coefficient_1', | 266 key: 'fling_acceleration_curve_coefficient_1', |
261 label: '+', | 267 label: '+', |
262 units: 'x<sup>2</sup>' | 268 units: 'x<sup>2</sup>', |
269 min: '-1' | |
263 }, | 270 }, |
264 { | 271 { |
265 key: 'fling_acceleration_curve_coefficient_2', | 272 key: 'fling_acceleration_curve_coefficient_2', |
266 label: '+', | 273 label: '+', |
267 units: 'x<sup>1</sup>' | 274 units: 'x<sup>1</sup>', |
275 min: '-1' | |
268 }, | 276 }, |
269 { | 277 { |
270 key: 'fling_acceleration_curve_coefficient_3', | 278 key: 'fling_acceleration_curve_coefficient_3', |
271 label: '+', | 279 label: '+', |
272 units: 'x<sup>0</sup>' | 280 units: 'x<sup>0</sup>', |
281 min: '-1' | |
273 }, | 282 }, |
274 { | 283 { |
275 key: 'fling_velocity_cap', | 284 key: 'fling_velocity_cap', |
276 label: 'Touchscreen Fling Velocity Cap', | 285 label: 'Touchscreen Fling Velocity Cap', |
277 units: 'pixels / second' | 286 units: 'pixels / second' |
278 } | 287 } |
279 ]; | 288 ]; |
280 | 289 |
281 return new GeneralConfig(GESTURE_TITLE, GESTURE_PREFIX, GESTURE_FIELDS); | 290 return new GeneralConfig(GESTURE_TITLE, GESTURE_PREFIX, GESTURE_FIELDS); |
282 } | 291 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
344 units: '%' | 353 units: '%' |
345 }, | 354 }, |
346 { | 355 { |
347 key: 'max_scale', | 356 key: 'max_scale', |
348 label: 'Maximimum workspace scale (scale of shallowest workspace)', | 357 label: 'Maximimum workspace scale (scale of shallowest workspace)', |
349 units: '%' | 358 units: '%' |
350 }, | 359 }, |
351 { | 360 { |
352 key: 'min_brightness', | 361 key: 'min_brightness', |
353 label: 'Minimum workspace brightness (deepest & shallowest workspace)', | 362 label: 'Minimum workspace brightness (deepest & shallowest workspace)', |
354 units: '%' | 363 units: '%', |
364 min: '-1' | |
355 }, | 365 }, |
356 { | 366 { |
357 key: 'background_opacity', | 367 key: 'background_opacity', |
358 label: 'Desktop background opacity when cycling through workspaces', | 368 label: 'Desktop background opacity when cycling through workspaces', |
359 units: '%' | 369 units: '%' |
360 }, | 370 }, |
361 { | 371 { |
362 key: 'distance_to_initiate_cycling', | 372 key: 'distance_to_initiate_cycling', |
363 label: 'Vertical distance to scroll to initiate cycling', | 373 label: 'Vertical distance to scroll to initiate cycling', |
364 units: 'pixels' | 374 units: 'pixels' |
(...skipping 28 matching lines...) Expand all Loading... | |
393 */ | 403 */ |
394 function FlingConfig() { | 404 function FlingConfig() { |
395 /** @const */ var FLING_TITLE = 'Fling Configuration'; | 405 /** @const */ var FLING_TITLE = 'Fling Configuration'; |
396 | 406 |
397 /** @const */ var FLING_PREFIX = 'flingcurve.'; | 407 /** @const */ var FLING_PREFIX = 'flingcurve.'; |
398 | 408 |
399 var FLING_FIELDS = [ | 409 var FLING_FIELDS = [ |
400 { | 410 { |
401 key: 'touchscreen_alpha', | 411 key: 'touchscreen_alpha', |
402 label: 'Touchscreen fling deacceleration coefficients', | 412 label: 'Touchscreen fling deacceleration coefficients', |
403 units: 'alpha' | 413 units: 'alpha', |
414 min: '-inf' | |
404 }, | 415 }, |
405 { | 416 { |
406 key: 'touchscreen_beta', | 417 key: 'touchscreen_beta', |
407 label: '', | 418 label: '', |
408 units: 'beta' | 419 units: 'beta', |
420 min: '-inf' | |
409 }, | 421 }, |
410 { | 422 { |
411 key: 'touchscreen_gamma', | 423 key: 'touchscreen_gamma', |
412 label: '', | 424 label: '', |
413 units: 'gamma' | 425 units: 'gamma', |
426 min: '-inf' | |
414 }, | 427 }, |
415 { | 428 { |
416 key: 'touchpad_alpha', | 429 key: 'touchpad_alpha', |
417 label: 'Touchpad fling deacceleration coefficients', | 430 label: 'Touchpad fling deacceleration coefficients', |
418 units: 'alpha' | 431 units: 'alpha', |
432 min: '-inf' | |
419 }, | 433 }, |
420 { | 434 { |
421 key: 'touchpad_beta', | 435 key: 'touchpad_beta', |
422 label: '', | 436 label: '', |
423 units: 'beta' | 437 units: 'beta', |
438 min: '-inf' | |
424 }, | 439 }, |
425 { | 440 { |
426 key: 'touchpad_gamma', | 441 key: 'touchpad_gamma', |
427 label: '', | 442 label: '', |
428 units: 'gamma' | 443 units: 'gamma', |
444 min: '-inf' | |
429 }, | 445 }, |
430 ]; | 446 ]; |
431 | 447 |
432 return new GeneralConfig(FLING_TITLE, FLING_PREFIX, FLING_FIELDS); | 448 return new GeneralConfig(FLING_TITLE, FLING_PREFIX, FLING_FIELDS); |
433 } | 449 } |
434 | 450 |
435 | 451 |
436 /** | 452 /** |
437 * WebUI instance for configuring gesture.* and overscroll.* preference values | 453 * WebUI instance for configuring gesture.* and overscroll.* preference values |
438 * used by Chrome's gesture recognition system. | 454 * used by Chrome's gesture recognition system. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
473 $(prefName).value = value; | 489 $(prefName).value = value; |
474 } | 490 } |
475 | 491 |
476 return { | 492 return { |
477 initialize: initialize, | 493 initialize: initialize, |
478 getPreferenceValueResult: getPreferenceValueResult | 494 getPreferenceValueResult: getPreferenceValueResult |
479 }; | 495 }; |
480 })(); | 496 })(); |
481 | 497 |
482 document.addEventListener('DOMContentLoaded', gesture_config.initialize); | 498 document.addEventListener('DOMContentLoaded', gesture_config.initialize); |
OLD | NEW |