Skip to content

Commit d4aa7de

Browse files
author
crisbeto
committed
better handling with non-number values of "current"
1 parent b416fc2 commit d4aa7de

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

build/roundProgress.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,12 +357,8 @@ angular.module('angular-svg-round-progress')
357357
};
358358

359359
var renderState = function(newValue, oldValue){
360-
if(!angular.isDefined(newValue)){
361-
return false;
362-
}
363-
364360
var max = service.toNumber(options.max || 0);
365-
var current = newValue > max ? max : (newValue < 0 ? 0 : newValue);
361+
var current = newValue > max ? max : (newValue < 0 || !newValue ? 0 : newValue);
366362
var start = (oldValue === current || oldValue < 0) ? 0 : (oldValue || 0); // fixes the initial animation
367363
var changeInValue = current - start;
368364

build/roundProgress.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/roundProgress.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,8 @@ angular.module('angular-svg-round-progress')
8585
};
8686

8787
var renderState = function(newValue, oldValue){
88-
if(!angular.isDefined(newValue)){
89-
return false;
90-
}
91-
9288
var max = service.toNumber(options.max || 0);
93-
var current = newValue > max ? max : (newValue < 0 ? 0 : newValue);
89+
var current = newValue > max ? max : (newValue < 0 || !newValue ? 0 : newValue);
9490
var start = (oldValue === current || oldValue < 0) ? 0 : (oldValue || 0); // fixes the initial animation
9591
var changeInValue = current - start;
9692

0 commit comments

Comments
 (0)