@@ -3,13 +3,13 @@ class Spinner {
3
3
console . log ( error , errorInfo ) ;
4
4
}
5
5
6
- reset ( prevProps , parentStyle , ape ) {
7
- const { ctx } = ape ;
8
- // parentStyle.backgroundColor // white
9
- if ( ctx ) {
10
- ctx . clearRect ( 0 , 0 , 18 , 18 ) ;
11
- }
12
- }
6
+ // You can also use your own clear function although isn't recommended
7
+ // unsafeClear(prevProps, parentStyle, ape) {
8
+ // const {ctx} = ape;
9
+ // const parentBackgroundColor = parentStyle.style.backgroundColor;
10
+ // const newProps = {...prevProps, style: { color: parentBackgroundColor } } ;
11
+ // this.render(newProps, ape);
12
+ // }
13
13
14
14
render ( props , ape ) {
15
15
const { ctx} = ape ;
@@ -18,24 +18,13 @@ class Spinner {
18
18
19
19
const offset = 8 ;
20
20
ctx . save ( ) ;
21
- // ctx.translate(offset, offset);
22
21
ctx . translate ( style . left , style . top ) ;
23
22
ctx . rotate ( degrees ) ;
24
-
25
- // Draw half open circle
26
23
ctx . beginPath ( ) ;
27
- ctx . lineWidth = 3 ;
24
+ ctx . lineWidth = 50 ;
28
25
ctx . arc ( 8 - offset , 8 - offset , 6 , 0 , 1.75 * Math . PI ) ;
29
26
ctx . strokeStyle = color ;
30
27
ctx . stroke ( ) ;
31
-
32
- // Draw arrowhead
33
- ctx . lineWidth = 3 ;
34
- ctx . moveTo ( 13 - offset , 1 - offset ) ;
35
- ctx . lineTo ( 9 - offset , 5 - offset ) ;
36
- ctx . lineTo ( 13 - offset , 5 - offset ) ;
37
- ctx . lineTo ( 13 - offset , 1 - offset ) ;
38
- ctx . stroke ( ) ;
39
28
ctx . restore ( ) ;
40
29
}
41
30
}
0 commit comments