|
|
@ -88,12 +88,16 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at |
|
|
|
|
|
|
|
|
|
|
|
fun selectText(x: Float, y: Float): SelectPoint? { |
|
|
|
fun selectText(x: Float, y: Float): SelectPoint? { |
|
|
|
textPage?.let { textPage -> |
|
|
|
textPage?.let { textPage -> |
|
|
|
for (textLine in textPage.textLines) { |
|
|
|
for ((lineIndex, textLine) in textPage.textLines.withIndex()) { |
|
|
|
if (y > textLine.lineTop && y < textLine.lineBottom) { |
|
|
|
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) { |
|
|
|
if (x > textChar.leftBottomPosition.x && x < textChar.rightTopPosition.x) { |
|
|
|
textChar.selected = true |
|
|
|
textChar.selected = true |
|
|
|
invalidate() |
|
|
|
invalidate() |
|
|
|
|
|
|
|
selectStartLine = lineIndex |
|
|
|
|
|
|
|
selectStartChar = charIndex |
|
|
|
|
|
|
|
selectEndLine = lineIndex |
|
|
|
|
|
|
|
selectEndChar = charIndex |
|
|
|
return SelectPoint( |
|
|
|
return SelectPoint( |
|
|
|
textChar.leftBottomPosition.x, |
|
|
|
textChar.leftBottomPosition.x, |
|
|
|
textChar.leftBottomPosition.y.toFloat(), |
|
|
|
textChar.leftBottomPosition.y.toFloat(), |
|
|
|