Skip to content

Commit cbb3a59

Browse files
author
crisbeto
committed
bump the version and minify the files
1 parent acc0711 commit cbb3a59

File tree

5 files changed

+29
-28
lines changed

5 files changed

+29
-28
lines changed

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module.exports = function(grunt) {
4646
},
4747
'src': {
4848
'files': {
49-
'src': ['src/*.js']
49+
'src': files
5050
}
5151
}
5252
}

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-svg-round-progressbar",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"homepage": "https://github.com/crisbeto/angular-svg-round-progressbar",
55
"authors": [
66
"crisbeto"

build/roundProgress.js

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -278,17 +278,7 @@ angular.module('angular-svg-round-progress')
278278
var base = {
279279
restrict: "EA",
280280
replace: true,
281-
transclude: true
282-
};
283-
284-
if(!service.isSupported){
285-
return angular.extend(base, {
286-
// placeholder element to keep the structure
287-
template: '<div class="round-progress" ng-transclude></div>'
288-
});
289-
}
290-
291-
return angular.extend(base, {
281+
transclude: true,
292282
scope:{
293283
current: "=",
294284
max: "=",
@@ -302,11 +292,21 @@ angular.module('angular-svg-round-progress')
302292
stroke: "@",
303293
duration: "@",
304294
animation: "@"
305-
},
295+
}
296+
};
297+
298+
if(!service.isSupported){
299+
return angular.extend(base, {
300+
// placeholder element to keep the structure
301+
template: '<div class="round-progress" ng-transclude></div>'
302+
});
303+
}
304+
305+
return angular.extend(base, {
306306
link: function(scope, element){
307-
var svg = angular.element(element[0].querySelector('svg'));
308-
var ring = svg.find('path');
309-
var background = svg.find('circle');
307+
var svg = element.find('svg').eq(0);
308+
var ring = svg.find('path').eq(0);
309+
var background = svg.find('circle').eq(0);
310310
var options = angular.copy(roundProgressConfig);
311311
var lastAnimationId;
312312

@@ -366,15 +366,19 @@ angular.module('angular-svg-round-progress')
366366
var easingAnimation = service.animations[options.animation];
367367
var startTime = new Date();
368368
var duration = parseInt(options.duration);
369+
var preventAnimation = (newValue > max && oldValue > max) || (newValue < 0 && oldValue < 0) || duration < 25;
369370

370371
var radius = options.radius;
371372
var circleSize = radius - (options.stroke/2);
372373
var elementSize = radius*2;
374+
var isSemicircle = options.semi;
373375

374-
$window.cancelAnimationFrame(lastAnimationId);
376+
// stops some expensive animating if the value is above the max or under 0
377+
if(preventAnimation){
378+
service.updateState(end, max, circleSize, ring, elementSize, isSemicircle);
379+
}else{
380+
$window.cancelAnimationFrame(lastAnimationId);
375381

376-
// below 25ms stuff starts to break
377-
if(duration > 25){
378382
(function animation(){
379383
var currentTime = new Date() - startTime;
380384

@@ -384,19 +388,16 @@ angular.module('angular-svg-round-progress')
384388
circleSize,
385389
ring,
386390
elementSize,
387-
options.semi);
391+
isSemicircle);
388392

389393
if(currentTime < duration){
390394
lastAnimationId = $window.requestAnimationFrame(animation);
391395
}
392396
})();
393-
}else{
394-
service.updateState(end, max, circleSize, ring, elementSize, options.semi);
395397
}
396398
};
397399

398-
scope.$watchCollection('[current, max, semi, rounded, clockwise, radius, color, bgcolor, stroke, duration, responsive]', function(newValue, oldValue, scope){
399-
400+
scope.$watchCollection('[' + Object.keys(base.scope).join(',') + ']', function(newValue, oldValue, scope){
400401
// pretty much the same as angular.extend,
401402
// but this skips undefined values and internal angular keys
402403
angular.forEach(scope, function(value, key){

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.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-svg-round-progressbar",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"description": "AngularJS module that uses SVG to create a circular progressar",
55
"main": "roundProgress.js",
66
"scripts": {},

0 commit comments

Comments
 (0)