Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: chrome/browser/resources/settings/controls/settings_slider.js

Issue 2829663004: Fix MD display settings when the display supports a single resolution (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * settings-slider wraps a paper-slider. It maps the slider's values from a 7 * settings-slider wraps a paper-slider. It maps the slider's values from a
8 * linear UI range to a range of real values. When |value| does not map exactly 8 * linear UI range to a range of real values. When |value| does not map exactly
9 * to a tick mark, it interpolates to the nearest tick. 9 * to a tick mark, it interpolates to the nearest tick.
10 * 10 *
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 observers: [ 43 observers: [
44 'valueChanged_(pref.*, tickValues.*)', 44 'valueChanged_(pref.*, tickValues.*)',
45 ], 45 ],
46 46
47 /** 47 /**
48 * Sets the |pref.value| property to the value corresponding to the knob 48 * Sets the |pref.value| property to the value corresponding to the knob
49 * position after a user action. 49 * position after a user action.
50 * @private 50 * @private
51 */ 51 */
52 onSliderChanged_: function() { 52 onSliderChanged_: function() {
53 var sliderValue =
54 (this.$.slider.immediateValue && this.$.slider.immediateValue != NaN)
stevenjb 2017/04/19 19:24:16 immediateValue == 0 should be valid, check explici
afakhry 2017/04/19 20:08:23 Done. Also, I asked xiyuan, and he told me that t
55 ? this.$.slider.immediateValue
56 : this.$.slider.value;
57
53 var newValue; 58 var newValue;
54 if (this.tickValues && this.tickValues.length > 0) 59 if (this.tickValues && this.tickValues.length > 0)
55 newValue = this.tickValues[this.$.slider.immediateValue]; 60 newValue = this.tickValues[sliderValue];
56 else 61 else
57 newValue = this.$.slider.immediateValue; 62 newValue = sliderValue;
58 63
59 this.set('pref.value', newValue); 64 this.set('pref.value', newValue);
60 }, 65 },
61 66
62 /** @private */ 67 /** @private */
63 computeDisableSlider_: function() { 68 computeDisableSlider_: function() {
64 return this.disabled || this.isPrefEnforced(); 69 return this.disabled || this.isPrefEnforced();
65 }, 70 },
66 71
67 /** 72 /**
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 if (difference < minDifference) { 131 if (difference < minDifference) {
127 closestIndex = i; 132 closestIndex = i;
128 minDifference = difference; 133 minDifference = difference;
129 } 134 }
130 } 135 }
131 136
132 assert(typeof closestIndex != 'undefined'); 137 assert(typeof closestIndex != 'undefined');
133 return closestIndex; 138 return closestIndex;
134 }, 139 },
135 }); 140 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698