File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -347,6 +347,8 @@ export interface Pen extends Rect {
347
347
video ?: string ;
348
348
audio ?: string ;
349
349
350
+ max ?: number ; // progress最大值
351
+ min ?: number ; // progress最小值
350
352
progress ?: number ;
351
353
progressColor ?: string ;
352
354
verticalProgress ?: boolean ;
@@ -435,6 +437,8 @@ export interface Pen extends Rect {
435
437
height ?: number ;
436
438
borderRadius ?: number ;
437
439
440
+ max ?: number ;
441
+ min ?: number ;
438
442
progress ?: number ;
439
443
progressColor ?: string ;
440
444
progressGradientColors ?: string ;
Original file line number Diff line number Diff line change @@ -1967,8 +1967,10 @@ export function ctxDrawPath(
1967
1967
ctx . restore ( ) ;
1968
1968
}
1969
1969
1970
- const progress = pen . calculative . progress ;
1971
- if ( progress != null ) {
1970
+ const progress =
1971
+ ( pen . calculative . progress - ( pen . calculative . min || 0 ) ) /
1972
+ ( ( pen . calculative . max || 1 ) - ( pen . calculative . min || 0 ) ) ;
1973
+ if ( progress != null && ! isNaN ( progress ) ) {
1972
1974
// 从左往右 x, y, x + width * progress, y
1973
1975
// 从右往左 ex, y, x + width * (1-progress), y
1974
1976
// 从下往上 x, y, x, y + height * progress
You can’t perform that action at this time.
0 commit comments