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

Unified Diff: lib/src/iron-range-behavior/iron-range-behavior.html

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 2 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: lib/src/iron-range-behavior/iron-range-behavior.html
diff --git a/lib/src/iron-range-behavior/iron-range-behavior.html b/lib/src/iron-range-behavior/iron-range-behavior.html
index 4306e6924e51134aca979cc5ecd7bdd04e956b1e..28469e9eaeb15a06e3e363d8c27e415b14de9648 100644
--- a/lib/src/iron-range-behavior/iron-range-behavior.html
+++ b/lib/src/iron-range-behavior/iron-range-behavior.html
@@ -12,11 +12,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script>
- /**
+ /**
* `iron-range-behavior` provides the behavior for something with a minimum to maximum range.
*
* @demo demo/index.html
- * @polymerBehavior
+ * @polymerBehavior
*/
Polymer.IronRangeBehavior = {
@@ -85,13 +85,16 @@ 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
+ * `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 this.step ? (Math.round(value / this.step) / (1 / this.step)) : value;
+ // polymer/issues/2493
+ value = parseFloat(value);
+ return this.step ? (Math.round((value + this.min) / this.step) -
+ (this.min / this.step)) / (1 / this.step) : value;
},
_validateValue: function() {
« no previous file with comments | « lib/src/iron-overlay-behavior/test/iron-overlay-behavior.html ('k') | lib/src/iron-range-behavior/test/basic.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698