| Index: third_party/polymer/v1_0/components-chromium/iron-range-behavior/iron-range-behavior-extracted.js
|
| diff --git a/third_party/polymer/v1_0/components-chromium/iron-range-behavior/iron-range-behavior-extracted.js b/third_party/polymer/v1_0/components-chromium/iron-range-behavior/iron-range-behavior-extracted.js
|
| index 1db5ff64ffc1e511598e0c068b7d9d39ac9dc041..838693e47f70599972e1d66e2f3ca751b7022666 100644
|
| --- a/third_party/polymer/v1_0/components-chromium/iron-range-behavior/iron-range-behavior-extracted.js
|
| +++ b/third_party/polymer/v1_0/components-chromium/iron-range-behavior/iron-range-behavior-extracted.js
|
| @@ -69,18 +69,27 @@
|
| },
|
|
|
| _calcStep: function(value) {
|
| - /**
|
| - * if we calculate the step using
|
| - * `Math.round(value / step) * step` we may hit a precision point issue
|
| - * eg. 0.1 * 0.2 = 0.020000000000000004
|
| - * http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
|
| - *
|
| - * as a work around we can divide by the reciprocal of `step`
|
| - */
|
| // polymer/issues/2493
|
| value = parseFloat(value);
|
| - return this.step ? (Math.round((value + this.min) / this.step) -
|
| - (this.min / this.step)) / (1 / this.step) : value;
|
| +
|
| + if (!this.step) {
|
| + return value;
|
| + }
|
| +
|
| + var numSteps = Math.round((value - this.min) / this.step);
|
| + if (this.step < 1) {
|
| + /**
|
| + * For small values of this.step, if we calculate the step using
|
| + * `Math.round(value / step) * step` we may hit a precision point issue
|
| + * eg. 0.1 * 0.2 = 0.020000000000000004
|
| + * http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
|
| + *
|
| + * as a work around we can divide by the reciprocal of `step`
|
| + */
|
| + return numSteps / (1 / this.step) + this.min;
|
| + } else {
|
| + return numSteps * this.step + this.min;
|
| + }
|
| },
|
|
|
| _validateValue: function() {
|
|
|