Skip to content

Commit d57571c

Browse files
author
crisbeto
committed
bump the version and minify the files
1 parent 89736a7 commit d57571c

File tree

5 files changed

+39
-33
lines changed

5 files changed

+39
-33
lines changed

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.2.6",
3+
"version": "0.2.7",
44
"homepage": "https://github.com/crisbeto/angular-svg-round-progressbar",
55
"authors": [
66
"crisbeto"

build/index.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
<a class="back" href="https://github.com/crisbeto/angular-svg-round-progressbar">Back to project repo</a>
9696

9797
<h2>Sample progressbar</h2>
98-
<div class="progress-wrapper" ng-style="{'font-size': ((radius + stroke)/(isSemi ? 3.5 : 3))+'px'}">
98+
<div class="progress-wrapper" ng-style="{'font-size': getFontSize()}">
9999
<div class="progress">{{ current }}/{{ max }}</div>
100100
<div
101101
round-progress
@@ -182,7 +182,7 @@ <h3>Customize!</h3>
182182
<div class="container">
183183
<h2>Upload progress example</h2>
184184
<div class="progress-wrapper">
185-
<div class="progress" ng-style="{'font-size': ((radius + stroke)/(isSemi ? 3.5 : 3))+'px'}">{{ ((uploadCurrent/100)*100) | number:0 }}%</div>
185+
<div class="progress" ng-style="{'font-size': getFontSize()}">{{ ((uploadCurrent/100)*100) | number:0 }}%</div>
186186
<div
187187
round-progress
188188
max="100"
@@ -206,6 +206,8 @@ <h2>Upload progress example</h2>
206206
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.js"></script>
207207
<script src="roundProgress.min.js"></script>
208208
<script>
209+
'use strict';
210+
209211
angular.module('demo', ['angular-svg-round-progress'])
210212
.controller('demoCtrl', ['$scope', '$timeout', 'roundProgressService', function($scope, $timeout, roundProgressService){
211213

@@ -260,6 +262,10 @@ <h2>Upload progress example</h2>
260262
angular.forEach(roundProgressService.animations, function(value, key){
261263
$scope.animations.push(key);
262264
});
265+
266+
$scope.getFontSize = function(){
267+
return $scope.radius/($scope.isSemi ? 3.5 : 3) + 'px';
268+
};
263269
}]);
264270
</script>
265271
</body>

build/roundProgress.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -298,38 +298,37 @@ angular.module('angular-svg-round-progress')
298298
var ring = element.find('path'),
299299
background = element.find('circle'),
300300
options = angular.copy(roundProgressConfig),
301-
size,
302301
resetValue;
303302

304303
var renderCircle = function(){
305-
var isSemicircle = options.semi,
306-
radius = parseInt(options.radius),
307-
stroke = parseInt(options.stroke);
308-
309-
size = radius*2 + stroke*2;
304+
var isSemicircle = options.semi;
305+
var radius = parseInt(options.radius) || 0;
306+
var stroke = parseInt(options.stroke);
307+
var diameter = radius*2;
308+
var backgroundSize = radius - (stroke/2);
310309

311310
element.css({
312-
"width": size + "px",
313-
"height": (isSemicircle ? size/2 : size) + "px",
311+
"width": diameter + "px",
312+
"height": (isSemicircle ? radius : diameter) + "px",
314313
"overflow": "hidden" // on some browsers the background overflows, if in semicircle mode
315314
});
316315

317316
ring.css({
318-
"stroke": options.color,
319-
"stroke-width": stroke,
320-
"stroke-linecap": options.rounded ? "round": "butt"
317+
"stroke": options.color,
318+
"stroke-width": stroke,
319+
"stroke-linecap": options.rounded ? "round": "butt"
321320
});
322321

323322
if(isSemicircle){
324-
ring.attr("transform", options.clockwise ? "translate("+ 0 +","+ size +") rotate(-90)" : "translate("+ size +", "+ size +") rotate(90) scale(-1, 1)");
323+
ring.attr("transform", options.clockwise ? "translate("+ 0 +","+ diameter +") rotate(-90)" : "translate("+ diameter +", "+ diameter +") rotate(90) scale(-1, 1)");
325324
}else{
326-
ring.attr("transform", options.clockwise ? "" : "scale(-1, 1) translate("+ (-size) +" 0)");
325+
ring.attr("transform", options.clockwise ? "" : "scale(-1, 1) translate("+ (-diameter) +" 0)");
327326
}
328327

329328
background.attr({
330-
"cx": radius + stroke,
331-
"cy": radius + stroke,
332-
"r": radius
329+
"cx": radius,
330+
"cy": radius,
331+
"r": backgroundSize >= 0 ? backgroundSize : 0
333332
}).css({
334333
"stroke": options.bgcolor,
335334
"stroke-width": stroke
@@ -351,14 +350,15 @@ angular.module('angular-svg-round-progress')
351350
return scope.current = options.max;
352351
}
353352

354-
var max = options.max,
355-
radius = options.radius,
356-
isSemicircle = options.semi,
357-
easingAnimation = service.animations[options.animation],
358-
start = oldValue === newValue ? 0 : (oldValue || 0), // fixes the initial animation
359-
val = newValue - start,
360-
currentIteration = 0,
361-
totalIterations = parseInt(options.iterations);
353+
var max = options.max || 0;
354+
var easingAnimation = service.animations[options.animation];
355+
var start = oldValue === newValue ? 0 : (oldValue || 0); // fixes the initial animation
356+
var val = newValue - start;
357+
var currentIteration = 0;
358+
var totalIterations = parseInt(options.iterations);
359+
var radius = options.radius;
360+
var circleSize = radius - (options.stroke/2);
361+
var elementSize = radius*2;
362362

363363
if(angular.isNumber(resetValue)){
364364
// the reset value fixes problems with animation, caused when limiting the scope.current
@@ -371,10 +371,10 @@ angular.module('angular-svg-round-progress')
371371
service.updateState(
372372
easingAnimation(currentIteration, start, val, totalIterations),
373373
max,
374-
radius,
374+
circleSize,
375375
ring,
376-
size,
377-
isSemicircle);
376+
elementSize,
377+
options.semi);
378378

379379
if(currentIteration < totalIterations){
380380
$window.requestAnimationFrame(animation);

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.2.6",
3+
"version": "0.2.7",
44
"description": "AngularJS module that uses SVG to create a circular progressar",
55
"main": "roundProgress.js",
66
"scripts": {},

0 commit comments

Comments
 (0)