| OLD | NEW |
| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 observers: [ | 53 observers: [ |
| 54 'valueChanged_(pref.*, tickValues.*)', | 54 'valueChanged_(pref.*, tickValues.*)', |
| 55 ], | 55 ], |
| 56 | 56 |
| 57 /** | 57 /** |
| 58 * Sets the |pref.value| property to the value corresponding to the knob | 58 * Sets the |pref.value| property to the value corresponding to the knob |
| 59 * position after a user action. | 59 * position after a user action. |
| 60 * @private | 60 * @private |
| 61 */ | 61 */ |
| 62 onSliderChanged_: function() { | 62 onSliderChanged_: function() { |
| 63 var sliderValue = isNaN(this.$.slider.immediateValue) | 63 var sliderValue = isNaN(this.$.slider.immediateValue) ? |
| 64 ? this.$.slider.value | 64 this.$.slider.value : |
| 65 : this.$.slider.immediateValue; | 65 this.$.slider.immediateValue; |
| 66 | 66 |
| 67 var newValue; | 67 var newValue; |
| 68 if (this.tickValues && this.tickValues.length > 0) | 68 if (this.tickValues && this.tickValues.length > 0) |
| 69 newValue = this.tickValues[sliderValue]; | 69 newValue = this.tickValues[sliderValue]; |
| 70 else | 70 else |
| 71 newValue = sliderValue / this.scale; | 71 newValue = sliderValue / this.scale; |
| 72 | 72 |
| 73 this.set('pref.value', newValue); | 73 this.set('pref.value', newValue); |
| 74 }, | 74 }, |
| 75 | 75 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 /** | 152 /** |
| 153 * TODO(scottchen): temporary fix until polymer gesture bug resolved. See: | 153 * TODO(scottchen): temporary fix until polymer gesture bug resolved. See: |
| 154 * https://github.com/PolymerElements/paper-slider/issues/186 | 154 * https://github.com/PolymerElements/paper-slider/issues/186 |
| 155 * @private | 155 * @private |
| 156 */ | 156 */ |
| 157 resetTrackLock_: function() { | 157 resetTrackLock_: function() { |
| 158 Polymer.Gestures.gestures.tap.reset(); | 158 Polymer.Gestures.gestures.tap.reset(); |
| 159 }, | 159 }, |
| 160 }); | 160 }); |
| OLD | NEW |