|
1 | 1 | 'use strict'; |
2 | 2 |
|
3 | 3 | angular.module('angular-svg-round-progress') |
4 | | - .directive('roundProgress', ['$timeout', 'roundProgressService', function($timeout, service){ |
| 4 | + .directive('roundProgress', ['roundProgressService', function(service){ |
5 | 5 |
|
6 | 6 | if(!service.isSupported){ |
7 | 7 | return { |
@@ -33,34 +33,31 @@ angular.module('angular-svg-round-progress') |
33 | 33 | resetValue; |
34 | 34 |
|
35 | 35 | var renderCircle = function(){ |
36 | | - $timeout(function(){ |
37 | | - var isSemicircle = scope.semi, |
38 | | - radius = parseInt(scope.radius), |
39 | | - stroke = parseInt(scope.stroke); |
40 | | - |
41 | | - size = radius*2 + stroke*2; |
42 | | - |
43 | | - element.attr({ |
44 | | - "width": size, |
45 | | - "height": isSemicircle ? size/2 : size |
46 | | - }).css({ |
47 | | - "overflow": "hidden" // on some browsers the background overflows, if in semicircle mode |
48 | | - }); |
49 | | - |
50 | | - ring.attr({ |
51 | | - "stroke": scope.color, |
52 | | - "stroke-width": stroke, |
53 | | - "transform": isSemicircle ? ('translate('+ 0 +','+ size +') rotate(-90)') : '' |
54 | | - }); |
55 | | - |
56 | | - background.attr({ |
57 | | - "cx": radius, |
58 | | - "cy": radius, |
59 | | - "transform": "translate("+ stroke +", "+ stroke +")", |
60 | | - "r": radius, |
61 | | - "stroke": scope.bgcolor, |
62 | | - "stroke-width": stroke |
63 | | - }); |
| 36 | + var isSemicircle = scope.semi, |
| 37 | + radius = parseInt(scope.radius), |
| 38 | + stroke = parseInt(scope.stroke); |
| 39 | + |
| 40 | + size = radius*2 + stroke*2; |
| 41 | + |
| 42 | + element.css({ |
| 43 | + "width": size, |
| 44 | + "height": isSemicircle ? size/2 : size, |
| 45 | + "overflow": "hidden" // on some browsers the background overflows, if in semicircle mode |
| 46 | + }); |
| 47 | + |
| 48 | + ring.attr({ |
| 49 | + "stroke": scope.color, |
| 50 | + "stroke-width": stroke, |
| 51 | + "transform": isSemicircle ? ('translate('+ 0 +','+ size +') rotate(-90)') : '' |
| 52 | + }); |
| 53 | + |
| 54 | + background.attr({ |
| 55 | + "cx": radius, |
| 56 | + "cy": radius, |
| 57 | + "transform": "translate("+ stroke +", "+ stroke +")", |
| 58 | + "r": radius, |
| 59 | + "stroke": scope.bgcolor, |
| 60 | + "stroke-width": stroke |
64 | 61 | }); |
65 | 62 | }; |
66 | 63 |
|
@@ -120,7 +117,7 @@ angular.module('angular-svg-round-progress') |
120 | 117 | template:[ |
121 | 118 | '<svg class="round-progress" xmlns="http://www.w3.org/2000/svg">', |
122 | 119 | '<circle fill="none"/>', |
123 | | - '<path fill="none" />', |
| 120 | + '<path fill="none"/>', |
124 | 121 | '</svg>' |
125 | 122 | ].join('\n') |
126 | 123 | }; |
|
0 commit comments