VerticalFastScroller: Fix incorrect touch target (#7384)

(cherry picked from commit 9ff6ae81bdcb7ce8d1a180f86fad8870324bcf1e)
This commit is contained in:
Ivan Iskandar 2022-06-26 23:58:31 +07:00 committed by Jobobby04
parent 42c8b47f04
commit 4eb45d0ade

View File

@ -114,18 +114,6 @@ fun VerticalFastScroller(
Box( Box(
modifier = Modifier modifier = Modifier
.offset { IntOffset(0, thumbOffsetY.roundToInt()) } .offset { IntOffset(0, thumbOffsetY.roundToInt()) }
.height(ThumbLength)
.then(
// Exclude thumb from gesture area only when needed
if (isThumbVisible && !isThumbDragged && !listState.isScrollInProgress) {
Modifier.systemGestureExclusion()
} else Modifier,
)
.padding(horizontal = 8.dp)
.padding(end = endContentPadding)
.width(ThumbThickness)
.alpha(alpha.value)
.background(color = thumbColor, shape = ThumbShape)
.then( .then(
// Recompose opts // Recompose opts
if (!listState.isScrollInProgress) { if (!listState.isScrollInProgress) {
@ -139,7 +127,19 @@ fun VerticalFastScroller(
}, },
) )
} else Modifier, } else Modifier,
), )
.then(
// Exclude thumb from gesture area only when needed
if (isThumbVisible && !isThumbDragged && !listState.isScrollInProgress) {
Modifier.systemGestureExclusion()
} else Modifier,
)
.height(ThumbLength)
.padding(horizontal = 8.dp)
.padding(end = endContentPadding)
.width(ThumbThickness)
.alpha(alpha.value)
.background(color = thumbColor, shape = ThumbShape),
) )
}.map { it.measure(scrollerConstraints) } }.map { it.measure(scrollerConstraints) }
val scrollerWidth = scrollerPlaceable.fastMaxBy { it.width }?.width ?: 0 val scrollerWidth = scrollerPlaceable.fastMaxBy { it.width }?.width ?: 0