From b725dc1bd3a65b6d6d0ea8d6d22adc199adf905a Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 22 Feb 2020 10:03:19 +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 --- .../legado/app/ui/book/read/page/ContentTextView.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 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 fd65c0814..0e2001f8e 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 @@ -165,15 +165,16 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at private fun upSelectChars(textPage: TextPage) { for ((lineIndex, textLine) in textPage.textLines.withIndex()) { for ((charIndex, textChar) in textLine.textChars.withIndex()) { - textChar.selected = when (lineIndex) { - selectStartLine -> { + textChar.selected = + if (lineIndex == selectStartLine && lineIndex == selectEndLine) { + charIndex in selectStartChar..selectEndChar + } else if (lineIndex == selectStartLine) { charIndex >= selectStartChar - } - selectEndLine -> { + } else if (lineIndex == selectEndLine) { charIndex <= selectEndChar + } else { + lineIndex in (selectStartLine + 1) until selectEndLine } - else -> lineIndex in (selectStartLine + 1) until selectEndLine - } } } invalidate()