From fe7880e018efe9b5db271c7b11f3469891d1b2b2 Mon Sep 17 00:00:00 2001 From: Daniel Beauchamp Date: Mon, 17 Sep 2012 13:55:18 -0400 Subject: Updated the animated setter to better work with null values. --- javascripts/dashing.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'javascripts') 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] = -- cgit v1.2.3