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