OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 input.step = field.step || 'any'; |
63 | 65 |
64 if (field.units) | 66 if (field.units) |
65 units.innerHTML = field.units; | 67 units.innerHTML = field.units; |
66 | 68 |
67 section.querySelector('.section-properties').appendChild(row); | 69 section.querySelector('.section-properties').appendChild(row); |
68 } | 70 } |
69 $('gesture-form').appendChild(section); | 71 $('gesture-form').appendChild(section); |
70 }, | 72 }, |
71 | 73 |
72 /** | 74 /** |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 units: '%' | 249 units: '%' |
248 }, | 250 }, |
249 { | 251 { |
250 key: 'rail_start_proportion', | 252 key: 'rail_start_proportion', |
251 label: 'Rail-Start Proportion', | 253 label: 'Rail-Start Proportion', |
252 units: '%' | 254 units: '%' |
253 }, | 255 }, |
254 { | 256 { |
255 key: 'fling_acceleration_curve_coefficient_0', | 257 key: 'fling_acceleration_curve_coefficient_0', |
256 label: 'Touchscreen Fling Acceleration', | 258 label: 'Touchscreen Fling Acceleration', |
257 units: 'x<sup>3</sup>' | 259 units: 'x<sup>3</sup>', |
| 260 min: '-1' |
258 }, | 261 }, |
259 { | 262 { |
260 key: 'fling_acceleration_curve_coefficient_1', | 263 key: 'fling_acceleration_curve_coefficient_1', |
261 label: '+', | 264 label: '+', |
262 units: 'x<sup>2</sup>' | 265 units: 'x<sup>2</sup>', |
| 266 min: '-1' |
263 }, | 267 }, |
264 { | 268 { |
265 key: 'fling_acceleration_curve_coefficient_2', | 269 key: 'fling_acceleration_curve_coefficient_2', |
266 label: '+', | 270 label: '+', |
267 units: 'x<sup>1</sup>' | 271 units: 'x<sup>1</sup>', |
| 272 min: '-1' |
268 }, | 273 }, |
269 { | 274 { |
270 key: 'fling_acceleration_curve_coefficient_3', | 275 key: 'fling_acceleration_curve_coefficient_3', |
271 label: '+', | 276 label: '+', |
272 units: 'x<sup>0</sup>' | 277 units: 'x<sup>0</sup>', |
| 278 min: '-1' |
273 }, | 279 }, |
274 { | 280 { |
275 key: 'fling_velocity_cap', | 281 key: 'fling_velocity_cap', |
276 label: 'Touchscreen Fling Velocity Cap', | 282 label: 'Touchscreen Fling Velocity Cap', |
277 units: 'pixels / second' | 283 units: 'pixels / second' |
278 }, | 284 }, |
279 { | 285 { |
280 key: 'tab_scrub_activation_delay_in_ms', | 286 key: 'tab_scrub_activation_delay_in_ms', |
281 label: 'Tab scrub auto activation delay, (-1 for never)', | 287 label: 'Tab scrub auto activation delay, (-1 for never)', |
282 units: 'milliseconds' | 288 units: 'milliseconds' |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 units: '%' | 355 units: '%' |
350 }, | 356 }, |
351 { | 357 { |
352 key: 'max_scale', | 358 key: 'max_scale', |
353 label: 'Maximimum workspace scale (scale of shallowest workspace)', | 359 label: 'Maximimum workspace scale (scale of shallowest workspace)', |
354 units: '%' | 360 units: '%' |
355 }, | 361 }, |
356 { | 362 { |
357 key: 'min_brightness', | 363 key: 'min_brightness', |
358 label: 'Minimum workspace brightness (deepest & shallowest workspace)', | 364 label: 'Minimum workspace brightness (deepest & shallowest workspace)', |
359 units: '%' | 365 units: '%', |
| 366 min: '-1' |
360 }, | 367 }, |
361 { | 368 { |
362 key: 'background_opacity', | 369 key: 'background_opacity', |
363 label: 'Desktop background opacity when cycling through workspaces', | 370 label: 'Desktop background opacity when cycling through workspaces', |
364 units: '%' | 371 units: '%' |
365 }, | 372 }, |
366 { | 373 { |
367 key: 'desktop_workspace_brightness', | 374 key: 'desktop_workspace_brightness', |
368 label: 'Desktop workspace brightness when cycling through workspaces', | 375 label: 'Desktop workspace brightness when cycling through workspaces', |
369 units: '%' | 376 units: '%', |
| 377 min: '-1' |
370 }, | 378 }, |
371 { | 379 { |
372 key: 'distance_to_initiate_cycling', | 380 key: 'distance_to_initiate_cycling', |
373 label: 'Vertical distance to scroll to initiate cycling', | 381 label: 'Vertical distance to scroll to initiate cycling', |
374 units: 'pixels' | 382 units: 'pixels' |
375 }, | 383 }, |
376 { | 384 { |
377 key: 'scroll_distance_to_cycle_to_next_workspace', | 385 key: 'scroll_distance_to_cycle_to_next_workspace', |
378 label: 'Vertical distance to scroll to cycle to the next workspace', | 386 label: 'Vertical distance to scroll to cycle to the next workspace', |
379 units: 'pixels' | 387 units: 'pixels' |
(...skipping 23 matching lines...) Expand all Loading... |
403 */ | 411 */ |
404 function FlingConfig() { | 412 function FlingConfig() { |
405 /** @const */ var FLING_TITLE = 'Fling Configuration'; | 413 /** @const */ var FLING_TITLE = 'Fling Configuration'; |
406 | 414 |
407 /** @const */ var FLING_PREFIX = 'flingcurve.'; | 415 /** @const */ var FLING_PREFIX = 'flingcurve.'; |
408 | 416 |
409 var FLING_FIELDS = [ | 417 var FLING_FIELDS = [ |
410 { | 418 { |
411 key: 'touchscreen_alpha', | 419 key: 'touchscreen_alpha', |
412 label: 'Touchscreen fling deacceleration coefficients', | 420 label: 'Touchscreen fling deacceleration coefficients', |
413 units: 'alpha' | 421 units: 'alpha', |
| 422 min: '-inf' |
414 }, | 423 }, |
415 { | 424 { |
416 key: 'touchscreen_beta', | 425 key: 'touchscreen_beta', |
417 label: '', | 426 label: '', |
418 units: 'beta' | 427 units: 'beta', |
| 428 min: '-inf' |
419 }, | 429 }, |
420 { | 430 { |
421 key: 'touchscreen_gamma', | 431 key: 'touchscreen_gamma', |
422 label: '', | 432 label: '', |
423 units: 'gamma' | 433 units: 'gamma', |
| 434 min: '-inf' |
424 }, | 435 }, |
425 { | 436 { |
426 key: 'touchpad_alpha', | 437 key: 'touchpad_alpha', |
427 label: 'Touchpad fling deacceleration coefficients', | 438 label: 'Touchpad fling deacceleration coefficients', |
428 units: 'alpha' | 439 units: 'alpha', |
| 440 min: '-inf' |
429 }, | 441 }, |
430 { | 442 { |
431 key: 'touchpad_beta', | 443 key: 'touchpad_beta', |
432 label: '', | 444 label: '', |
433 units: 'beta' | 445 units: 'beta', |
| 446 min: '-inf' |
434 }, | 447 }, |
435 { | 448 { |
436 key: 'touchpad_gamma', | 449 key: 'touchpad_gamma', |
437 label: '', | 450 label: '', |
438 units: 'gamma' | 451 units: 'gamma', |
| 452 min: '-inf' |
439 }, | 453 }, |
440 ]; | 454 ]; |
441 | 455 |
442 return new GeneralConfig(FLING_TITLE, FLING_PREFIX, FLING_FIELDS); | 456 return new GeneralConfig(FLING_TITLE, FLING_PREFIX, FLING_FIELDS); |
443 } | 457 } |
444 | 458 |
445 | 459 |
446 /** | 460 /** |
447 * WebUI instance for configuring gesture.* and overscroll.* preference values | 461 * WebUI instance for configuring gesture.* and overscroll.* preference values |
448 * used by Chrome's gesture recognition system. | 462 * used by Chrome's gesture recognition system. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 $(prefName).value = value; | 497 $(prefName).value = value; |
484 } | 498 } |
485 | 499 |
486 return { | 500 return { |
487 initialize: initialize, | 501 initialize: initialize, |
488 getPreferenceValueResult: getPreferenceValueResult | 502 getPreferenceValueResult: getPreferenceValueResult |
489 }; | 503 }; |
490 })(); | 504 })(); |
491 | 505 |
492 document.addEventListener('DOMContentLoaded', gesture_config.initialize); | 506 document.addEventListener('DOMContentLoaded', gesture_config.initialize); |
OLD | NEW |