mirror of
https://github.com/gedoor/legado.git
synced 2024-09-01 09:34:25 +08:00
修复滚动模式下,长按选择错乱问题
This commit is contained in:
parent
d2c7512e6d
commit
fb5e178678
@ -524,7 +524,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun relativePage(relativePos: Int): TextPage {
|
fun relativePage(relativePos: Int): TextPage {
|
||||||
return when (relativePos) {
|
return when (relativePos) {
|
||||||
0 -> textPage
|
0 -> textPage
|
||||||
1 -> pageFactory.nextPage
|
1 -> pageFactory.nextPage
|
||||||
|
@ -271,6 +271,10 @@ class PageView(context: Context) : FrameLayout(context) {
|
|||||||
return binding.contentTextView.createBookmark()
|
return binding.contentTextView.createBookmark()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun relativePage(relativePos: Int): TextPage {
|
||||||
|
return binding.contentTextView.relativePage(relativePos)
|
||||||
|
}
|
||||||
|
|
||||||
val selectedText: String get() = binding.contentTextView.selectedText
|
val selectedText: String get() = binding.contentTextView.selectedText
|
||||||
|
|
||||||
val textPage get() = binding.contentTextView.textPage
|
val textPage get() = binding.contentTextView.textPage
|
||||||
|
@ -265,8 +265,9 @@ class ReadView(context: Context, attrs: AttributeSet) :
|
|||||||
*/
|
*/
|
||||||
private fun onLongPress() {
|
private fun onLongPress() {
|
||||||
kotlin.runCatching {
|
kotlin.runCatching {
|
||||||
with(curPage.textPage) {
|
curPage.selectText(startX, startY) { relativePage, lineIndex, charIndex ->
|
||||||
curPage.selectText(startX, startY) { relativePage, lineIndex, charIndex ->
|
val page = if (isScroll) curPage.relativePage(relativePage) else curPage.textPage
|
||||||
|
with(page) {
|
||||||
isTextSelected = true
|
isTextSelected = true
|
||||||
firstRelativePage = relativePage
|
firstRelativePage = relativePage
|
||||||
firstLineIndex = lineIndex
|
firstLineIndex = lineIndex
|
||||||
|
Loading…
Reference in New Issue
Block a user