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

Side by Side Diff: ui/webui/resources/cr_elements/cr_slider/cr_slider.js

Issue 2649663002: WebUI: Undo some usages of ES6 features that break uglify. (Closed)
Patch Set: Fix i->j Created 3 years, 11 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 | « ui/webui/resources/cr_elements/cr_scrollable_behavior.js ('k') | 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 * cr-slider wraps a paper-slider. It maps the slider's values from a linear UI 7 * cr-slider wraps a paper-slider. It maps the slider's values from a linear UI
8 * range to a range of real values. When |value| does not map exactly to a 8 * range to a range of real values. When |value| does not map exactly to a
9 * tick mark, it interpolates to the nearest tick. 9 * tick mark, it interpolates to the nearest tick.
10 * 10 *
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 this.value = this.tickValues[this.$.slider.immediateValue]; 49 this.value = this.tickValues[this.$.slider.immediateValue];
50 }, 50 },
51 51
52 /** 52 /**
53 * Updates the knob position when |value| changes. If the knob is still being 53 * Updates the knob position when |value| changes. If the knob is still being
54 * dragged, this instead forces |value| back to the current position. 54 * dragged, this instead forces |value| back to the current position.
55 * @private 55 * @private
56 */ 56 */
57 valueChanged_: function() { 57 valueChanged_: function() {
58 // First update the slider settings if |tickValues| was set. 58 // First update the slider settings if |tickValues| was set.
59 let numTicks = Math.max(1, this.tickValues.length); 59 var numTicks = Math.max(1, this.tickValues.length);
60 this.$.slider.max = numTicks - 1; 60 this.$.slider.max = numTicks - 1;
61 // Limit the number of ticks to 10 to keep the slider from looking too busy. 61 // Limit the number of ticks to 10 to keep the slider from looking too busy.
62 /** @const */ var MAX_TICKS = 10; 62 /** @const */ var MAX_TICKS = 10;
63 this.$.slider.snaps = numTicks < MAX_TICKS; 63 this.$.slider.snaps = numTicks < MAX_TICKS;
64 this.$.slider.maxMarkers = numTicks < MAX_TICKS ? numTicks : 0; 64 this.$.slider.maxMarkers = numTicks < MAX_TICKS ? numTicks : 0;
65 65
66 if (this.$.slider.dragging && this.tickValues.length > 0 && 66 if (this.$.slider.dragging && this.tickValues.length > 0 &&
67 this.value != this.tickValues[this.$.slider.immediateValue]) { 67 this.value != this.tickValues[this.$.slider.immediateValue]) {
68 // The value changed outside cr-slider but we're still holding the knob, 68 // The value changed outside cr-slider but we're still holding the knob,
69 // so set the value back to where the knob was. 69 // so set the value back to where the knob was.
(...skipping 30 matching lines...) Expand all
100 if (difference < minDifference) { 100 if (difference < minDifference) {
101 closestIndex = i; 101 closestIndex = i;
102 minDifference = difference; 102 minDifference = difference;
103 } 103 }
104 } 104 }
105 105
106 assert(typeof closestIndex != 'undefined'); 106 assert(typeof closestIndex != 'undefined');
107 return closestIndex; 107 return closestIndex;
108 }, 108 },
109 }); 109 });
OLDNEW
« no previous file with comments | « ui/webui/resources/cr_elements/cr_scrollable_behavior.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698