Explorar o código

优化歌词高亮显示

onecold hai 7 meses
pai
achega
4ff6f8d06f
Modificáronse 1 ficheiros con 3 adicións e 8 borrados
  1. 3 8
      lib/src/main/ets/view/LyricView2.ets

+ 3 - 8
lib/src/main/ets/view/LyricView2.ets

@@ -290,13 +290,8 @@ export struct LyricView2 {
     NormalLyricLine(item: LyricLine, index: number) {
         Column(){
             Text(item.text)
-                .fontSize(this.textSize)
+                .fontSize(index == this.currentIndex ?this.textSize*this.controller.getHighlightScale():this.textSize)
                 .textAlign(this.alignMode == 'center' ? TextAlign.Center : TextAlign.Start)
-                .scale({
-                    x: index == this.currentIndex ? this.controller.getHighlightScale() : 1,
-                    y: index == this.currentIndex ? this.controller.getHighlightScale() : 1,
-                    centerX: this.alignMode == 'center' ? '50%' : 0
-                })
                 .fontColor(index == this.currentIndex ? this.textHighlightColor : this.textColor)
                 .fontWeight(index == this.currentIndex && this.isHighlightBold ? FontWeight.Bold : this.textWeight)
                 .animation({
@@ -312,7 +307,7 @@ export struct LyricView2 {
                 .visibility(this.isSingleLine?
                     (index >= this.currentIndex && index <= this.currentIndex + 1 ? Visibility.Visible : Visibility.None)
                     : Visibility.Visible)
-                .width(this.alignMode == 'center' ? '100%' :index == this.currentIndex ?'100%': '80%')
+                .width(this.alignMode == 'center' ? '100%' :index == this.currentIndex ?'95%': '80%')
 
             // 中文翻译(整行显示)
             if (item.translation)  {
@@ -335,7 +330,7 @@ export struct LyricView2 {
                     index == this.currentIndex ? BlendMode.DST_IN : undefined,
                     index == this.currentIndex ? BlendApplyType.OFFSCREEN : undefined
                 )
-                .width(this.alignMode == 'center' ? '100%' :index == this.currentIndex ?'100%': '80%')
+                .width(this.alignMode == 'center' ? '100%' :index == this.currentIndex ?'95%': '80%')
 
             }
         }