Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,22 @@ class FastScrollerView @JvmOverloads constructor(
}
is TextView -> {
@Suppress("UNCHECKED_CAST")
val possibleTouchedIndicators = view.tag as List<FastScrollItemIndicator.Text>
val possibleTouchedIndicators = view.tag as List<FastScrollItemIndicator.Text>
if (possibleTouchedIndicators.isEmpty() || heightForCalculations == 0) {
return false
}

val textIndicatorsTouchY = touchY - view.top

val textLineHeight = heightForCalculations / possibleTouchedIndicators.size
val touchedIndicatorIndex = min(
textIndicatorsTouchY / textLineHeight,
possibleTouchedIndicators.lastIndex
)
val touchedIndicatorIndex = if (textLineHeight > 0) {
min(
textIndicatorsTouchY / textLineHeight,
possibleTouchedIndicators.lastIndex
)
} else {
0
}

val touchedIndicator = possibleTouchedIndicators[touchedIndicatorIndex]
val centerY = view.y.toInt() + (textLineHeight / 2) + (touchedIndicatorIndex * textLineHeight)
Expand Down
Loading