Skip to content

Commit af1ac5f

Browse files
authored
Merge pull request #31 from beaven11/master
fix width adaptation
2 parents 3806a9a + d66418d commit af1ac5f

File tree

1 file changed

+5
-1
lines changed
  • rollingtextview/src/main/java/com/yy/mobile/rollingtextview

1 file changed

+5
-1
lines changed

rollingtextview/src/main/java/com/yy/mobile/rollingtextview/TextColumn.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ internal class TextColumn(
9595
}
9696

9797
//计算当前字符宽度,为第一个字符和最后一个字符的过渡宽度
98-
currentWidth = (lastCharWidth - firstCharWidth) * progress.toFloat() + firstCharWidth
98+
currentWidth = if (currentChar.toInt() > 0) {
99+
(lastCharWidth - firstCharWidth) * progress.toFloat() + firstCharWidth
100+
} else {
101+
0f
102+
}
99103

100104
return PreviousProgress(index, offsetPercentage, progress, currentChar, currentWidth)
101105
}

0 commit comments

Comments
 (0)