@@ -223,7 +223,7 @@ export function addWaterWave(
223
223
224
224
// 循环 waveCount 个数
225
225
for ( let idx = 0 ; idx < waveCount ; idx ++ ) {
226
- const factor = waveCount <= 1 ? 0 : idx / ( waveCount - 1 ) ;
226
+ const factor = waveCount <= 1 ? 1 : idx / ( waveCount - 1 ) ;
227
227
228
228
// 画波
229
229
const wave = group . addShape ( 'path' , {
@@ -389,7 +389,7 @@ registerShape('interval', 'liquid-fill-gauge', {
389
389
const cy = 0.5 ;
390
390
391
391
const { customInfo } = cfg ;
392
- const { radius : radio , shape, background, animation } = customInfo as CustomInfo ;
392
+ const { radius : radio , shape, shapeStyle , background, animation } = customInfo as CustomInfo ;
393
393
const outline : LiquidOptions [ 'outline' ] = customInfo . outline ;
394
394
const wave : LiquidOptions [ 'wave' ] = customInfo . wave ;
395
395
const { border, distance } = outline ;
@@ -417,7 +417,18 @@ registerShape('interval', 'liquid-fill-gauge', {
417
417
const buildPath = typeof shape === 'function' ? shape : builtInShapeByName [ shape ] || builtInShapeByName [ 'circle' ] ;
418
418
const shapePath = buildPath ( center . x , center . y , innerRadius * 2 , innerRadius * 2 ) ;
419
419
420
- // 1. 绘制一个波
420
+ // 1. 当 shapeStyle 不为空时,绘制形状样式作为背景
421
+ if ( shapeStyle ) {
422
+ container . addShape ( 'path' , {
423
+ name : 'shape' ,
424
+ attrs : {
425
+ path : shapePath ,
426
+ ...shapeStyle ,
427
+ } ,
428
+ } ) ;
429
+ }
430
+
431
+ // 2. 绘制一个波
421
432
const waves = container . addGroup ( {
422
433
name : 'waves' ,
423
434
} ) ;
@@ -444,7 +455,7 @@ registerShape('interval', 'liquid-fill-gauge', {
444
455
animation
445
456
) ;
446
457
447
- // 2 . 绘制一个 distance 宽的 border
458
+ // 5 . 绘制一个 distance 宽的 border
448
459
container . addShape ( 'path' , {
449
460
name : 'distance' ,
450
461
attrs : {
@@ -455,7 +466,7 @@ registerShape('interval', 'liquid-fill-gauge', {
455
466
} ,
456
467
} ) ;
457
468
458
- // 3 . 绘制一个 border 宽的 border
469
+ // 6 . 绘制一个 border 宽的 border
459
470
container . addShape ( 'path' , {
460
471
name : 'wrap' ,
461
472
attrs : mix ( outlineAttrs , {
0 commit comments