File tree Expand file tree Collapse file tree 3 files changed +30
-9
lines changed Expand file tree Collapse file tree 3 files changed +30
-9
lines changed Original file line number Diff line number Diff line change @@ -74,11 +74,16 @@ class Circle extends Component {
74
74
strokeWidth = { ptg === 0 ? 0 : strokeWidth }
75
75
fillOpacity = "0"
76
76
style = { pathStyle }
77
+ ref = { ( path ) => {
78
+ this . paths [ index ] = path ;
79
+ } }
77
80
/>
78
81
) ;
79
82
} ) ;
80
83
}
81
84
85
+ paths = { } ;
86
+
82
87
render ( ) {
83
88
const {
84
89
prefixCls, strokeWidth, trailWidth,
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ import enhancer from './enhancer';
3
3
import { propTypes , defaultProps } from './types' ;
4
4
5
5
class Line extends Component {
6
+ paths = { } ;
7
+
6
8
render ( ) {
7
9
const {
8
10
className,
@@ -67,7 +69,9 @@ class Line extends Component {
67
69
stroke = { color }
68
70
strokeWidth = { strokeWidth }
69
71
fillOpacity = "0"
70
- ref = { ( path ) => { this . path = path ; } }
72
+ ref = { ( path ) => {
73
+ this . paths [ index ] = path ;
74
+ } }
71
75
style = { pathStyle }
72
76
/>
73
77
) ;
Original file line number Diff line number Diff line change 1
1
const enhancer = WrappedComponent => class Progress extends WrappedComponent {
2
2
componentDidUpdate ( ) {
3
- if ( ! this . path ) {
4
- return ;
5
- }
6
- const pathStyle = this . path . style ;
7
- pathStyle . transitionDuration = '.3s, .3s, .3s, .06s' ;
8
3
const now = Date . now ( ) ;
9
- if ( this . prevTimeStamp && now - this . prevTimeStamp < 100 ) {
10
- pathStyle . transitionDuration = '0s, 0s' ;
4
+ let updated = false ;
5
+
6
+ Object . keys ( this . paths ) . forEach ( ( key ) => {
7
+ const path = this . paths [ key ] ;
8
+
9
+ if ( ! path ) {
10
+ return ;
11
+ }
12
+
13
+ updated = true ;
14
+ const pathStyle = path . style ;
15
+ pathStyle . transitionDuration = '.3s, .3s, .3s, .06s' ;
16
+
17
+ if ( this . prevTimeStamp && now - this . prevTimeStamp < 100 ) {
18
+ pathStyle . transitionDuration = '0s, 0s' ;
19
+ }
20
+ } ) ;
21
+
22
+ if ( updated ) {
23
+ this . prevTimeStamp = Date . now ( ) ;
11
24
}
12
- this . prevTimeStamp = Date . now ( ) ;
13
25
}
14
26
15
27
render ( ) {
You can’t perform that action at this time.
0 commit comments