feat: 优化代码

pull/142/head
kunfei 5 years ago
parent 554c388b52
commit 3cf9fb6344
  1. 2
      app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt

@ -22,9 +22,9 @@ data class TextPage(
if (textLines.size <= 1) return if (textLines.size <= 1) return
if (visibleHeight - height > with(textLines.last()) { lineBottom - lineTop }) return if (visibleHeight - height > with(textLines.last()) { lineBottom - lineTop }) return
val surplus = (visibleHeight - textLines.last().lineBottom) val surplus = (visibleHeight - textLines.last().lineBottom)
if (surplus == 0f) return
height += surplus height += surplus
val tj = surplus / (textLines.size - 1) val tj = surplus / (textLines.size - 1)
if (tj == 0f) return
for (i in 1 until textLines.size) { for (i in 1 until textLines.size) {
val line = textLines[i] val line = textLines[i]
line.lineTop = line.lineTop + tj * i line.lineTop = line.lineTop + tj * i

Loading…
Cancel
Save