From 40452715e7e748f8e37e925537af0db67aee4f31 Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 21 Feb 2020 20:01:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/read/page/ContentTextView.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt index bf190deae..52176ac4d 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt @@ -88,12 +88,16 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at fun selectText(x: Float, y: Float): SelectPoint? { textPage?.let { textPage -> - for (textLine in textPage.textLines) { + for ((lineIndex, textLine) in textPage.textLines.withIndex()) { if (y > textLine.lineTop && y < textLine.lineBottom) { - for (textChar in textLine.textChars) { + for ((charIndex, textChar) in textLine.textChars.withIndex()) { if (x > textChar.leftBottomPosition.x && x < textChar.rightTopPosition.x) { textChar.selected = true invalidate() + selectStartLine = lineIndex + selectStartChar = charIndex + selectEndLine = lineIndex + selectEndChar = charIndex return SelectPoint( textChar.leftBottomPosition.x, textChar.leftBottomPosition.y.toFloat(),