Skip to content

Commit 19090cf

Browse files
author
crisbeto
committed
update the readme and push to origin
1 parent ce89df2 commit 19090cf

File tree

4 files changed

+31
-23
lines changed

4 files changed

+31
-23
lines changed

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ module.exports = function(grunt) {
8787
tagName: '%VERSION%',
8888
tagMessage: '%VERSION%',
8989
push: true,
90-
pushTo: 'upstream'
90+
pushTo: 'origin'
9191
}
9292
}
9393
});

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ angular.module('someModule', ['angular-svg-round-progress'])
7676
* `grunt` to run a development server. Not mandatory(you can run the build/index.html directly), but more convenient.
7777
* `grunt build` to build minified demo in build/
7878
* `grunt deploy` to build minified demo and push it to gh-pages branch
79+
* `grunt release` to bump the version and release
7980

8081

8182
## Credits

build/roundProgress.js

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,17 @@ angular.module('angular-svg-round-progress').service('roundProgressService', [fu
7777

7878
if(!size) return ring;
7979

80-
var value = val >= total ? total - 0.00001 : val,
81-
type = isSemicircle ? 180 : 359.9999,
82-
perc = total === 0 ? 0 : (value / total) * type,
83-
x = size/2,
84-
start = polarToCartesian(x, x, R, perc), // in this case x and y are the same
85-
end = polarToCartesian(x, x, R, 0),
86-
arcSweep = (perc <= 180 ? "0" : "1"),
87-
d = [
88-
"M", start.x, start.y,
89-
"A", R, R, 0, arcSweep, 0, end.x, end.y
90-
].join(" ");
80+
var value = val >= total ? total - 0.00001 : val;
81+
var type = isSemicircle ? 180 : 359.9999;
82+
var perc = total === 0 ? 0 : (value / total) * type;
83+
var x = size/2;
84+
var start = polarToCartesian(x, x, R, perc); // in this case x and y are the same
85+
var end = polarToCartesian(x, x, R, 0);
86+
var arcSweep = (perc <= 180 ? "0" : "1");
87+
var d = [
88+
"M", start.x, start.y,
89+
"A", R, R, 0, arcSweep, 0, end.x, end.y
90+
].join(" ");
9191

9292
return ring.attr('d', d);
9393
};
@@ -382,7 +382,7 @@ angular.module('angular-svg-round-progress')
382382
$window.cancelAnimationFrame(lastAnimationId);
383383

384384
(function animation(){
385-
var currentTime = new Date() - startTime;
385+
var currentTime = $window.Math.min(new Date() - startTime, duration);
386386

387387
service.updateState(
388388
easingAnimation(currentTime, start, changeInValue, duration),
@@ -399,17 +399,24 @@ angular.module('angular-svg-round-progress')
399399
}
400400
};
401401

402-
scope.$watchCollection('[' + Object.keys(base.scope).join(',') + ']', function(newValue, oldValue, scope){
403-
// pretty much the same as angular.extend,
404-
// but this skips undefined values and internal angular keys
405-
angular.forEach(scope, function(value, key){
406-
// note the scope !== value is because `this` is part of the scope
407-
if(key.indexOf('$') && scope !== value && angular.isDefined(value)){
408-
options[key] = value;
402+
var keys = Object.keys(base.scope).filter(function(key){
403+
return key !== 'current';
404+
});
405+
406+
// properties that are used only for presentation
407+
scope.$watchGroup(keys, function(newValue){
408+
for(var i = 0; i < newValue.length ; i++){
409+
if(typeof newValue[i] !== 'undefined'){
410+
options[keys[i]] = newValue[i];
409411
}
410-
});
412+
}
411413

412414
renderCircle();
415+
});
416+
417+
// properties that are used during animation. some of these overlap with
418+
// the ones that are used for presentation
419+
scope.$watchGroup(['current', 'max', 'animation', 'duration', 'radius', 'stroke', 'semi'], function(newValue, oldValue){
413420
renderState(service.toNumber(newValue[0]), service.toNumber(oldValue[0]));
414421
});
415422
},

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.

0 commit comments

Comments
 (0)