diff options
author | Daniel Beauchamp <daniel.beauchamp@shopify.com> | 2012-09-17 13:55:18 -0400 |
---|---|---|
committer | Daniel Beauchamp <daniel.beauchamp@shopify.com> | 2012-09-17 13:55:18 -0400 |
commit | fe7880e018efe9b5db271c7b11f3469891d1b2b2 (patch) | |
tree | edf631f5492e6c7aecbfbb7c12e33d456e76038c | |
parent | a3d84c8c0a30f5b761c37f6f2c805346d0009acd (diff) |
Updated the animated setter to better work with null values.
-rw-r--r-- | javascripts/dashing.coffee | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/javascripts/dashing.coffee b/javascripts/dashing.coffee index 528ae2c..8852c1e 100644 --- a/javascripts/dashing.coffee +++ b/javascripts/dashing.coffee @@ -59,12 +59,14 @@ class Dashing.Widget extends Batman.View Dashing.AnimatedValue = get: Batman.Property.defaultAccessor.get set: (k, to) -> - if isNaN(to) + if !to? || isNaN(to) @[k] = to else timer = "interval_#{k}" - num = if !isNaN(@[k]) then @[k] else 0 + num = if (!isNaN(@[k]) && @[k]?) then @[k] else 0 unless @[timer] || num == to + to = parseFloat(to) + num = parseFloat(num) up = to > num num_interval = Math.abs(num - to) / 90 @[timer] = |