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

Unified Diff: third_party/polymer/components/iron-range-behavior/iron-range-behavior.html

Issue 2113853002: Run bower update (Closed) Base URL: https://github.com/catapult-project/catapult@polymer10-migration
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/components/iron-range-behavior/iron-range-behavior.html
diff --git a/third_party/polymer/components/iron-range-behavior/iron-range-behavior.html b/third_party/polymer/components/iron-range-behavior/iron-range-behavior.html
index 28469e9eaeb15a06e3e363d8c27e415b14de9648..96f3c15b02a7520897a7ab212830d9cd6dcc5b1c 100644
--- a/third_party/polymer/components/iron-range-behavior/iron-range-behavior.html
+++ b/third_party/polymer/components/iron-range-behavior/iron-range-behavior.html
@@ -83,18 +83,27 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
},
_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() {

Powered by Google App Engine
This is Rietveld 408576698