pull/1463/head^2
gedoor 3 years ago
parent a173dc149d
commit 6ca5850ade
  1. 1
      app/src/main/assets/updateLog.md
  2. 2
      app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt
  3. 9
      app/src/main/java/io/legado/app/ui/book/read/page/entities/TextLine.kt

@ -16,6 +16,7 @@
* 朗读出错不弹出朗读界面的时候可以长按朗读按钮进入朗读界面切换朗读引擎,这个有很多人不知道
* 修复cronet访问出错时应用崩溃的bug
* 修复一些epub目录不全或内容不全的问题
* 修复横屏双页时文字选择的问题
* 电脑硬盘坏了还好资料恢复出来了,还是要经常备份比较好
**2021/11/27**

@ -313,7 +313,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
}
val textPage = relativePage(relativePos)
for ((lineIndex, textLine) in textPage.textLines.withIndex()) {
if (textLine.isTouch(y, relativeOffset)) {
if (textLine.isTouch(x, y, relativeOffset)) {
for ((charIndex, textChar) in textLine.textChars.withIndex()) {
if (textChar.isTouch(x)) {
touched.invoke(

@ -17,6 +17,8 @@ data class TextLine(
) {
val charSize: Int get() = textChars.size
val lineStart: Float get() = textChars.firstOrNull()?.start ?: 0f
val lineEnd: Float get() = textChars.lastOrNull()?.end ?: 0f
fun upTopBottom(durY: Float, textPaint: TextPaint) {
lineTop = ChapterProvider.paddingTop + durY
@ -38,7 +40,10 @@ data class TextLine(
return textChars.size
}
fun isTouch(y: Float, relativeOffset: Float): Boolean {
return y > lineTop + relativeOffset && y < lineBottom + relativeOffset
fun isTouch(x: Float, y: Float, relativeOffset: Float): Boolean {
return y > lineTop + relativeOffset
&& y < lineBottom + relativeOffset
&& x >= lineStart
&& x <= lineEnd
}
}

Loading…
Cancel
Save