mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 15:29:15 +01:00
stretch the leading edge of the tab indicator toward the target
This commit is contained in:
@@ -637,12 +637,16 @@ private fun LibraryTabs(
|
|||||||
val step = if (neighbour != null) abs(fraction) else 0f
|
val step = if (neighbour != null) abs(fraction) else 0f
|
||||||
val left = current.left + ((neighbour?.left ?: current.left) - current.left) * step
|
val left = current.left + ((neighbour?.left ?: current.left) - current.left) * step
|
||||||
val right = current.right + ((neighbour?.right ?: current.right) - current.right) * step
|
val right = current.right + ((neighbour?.right ?: current.right) - current.right) * step
|
||||||
val stretch = with(density) { indicatorStretch.toPx() } * abs(fraction) / 2f
|
val stretch = with(density) { indicatorStretch.toPx() } * step
|
||||||
|
val leading = stretch * 2f
|
||||||
|
val trailing = stretch * 0.25f
|
||||||
|
val leftExtra = if (fraction >= 0f) trailing else leading
|
||||||
|
val rightExtra = if (fraction >= 0f) leading else trailing
|
||||||
Box(
|
Box(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.offset { IntOffset((left - stretch).roundToInt(), current.top.roundToInt()) }
|
.offset { IntOffset((left - leftExtra).roundToInt(), current.top.roundToInt()) }
|
||||||
.width(with(density) { (right - left + stretch * 2f).toDp() })
|
.width(with(density) { (right - left + leftExtra + rightExtra).toDp() })
|
||||||
.height(with(density) { current.height.toDp() })
|
.height(with(density) { current.height.toDp() })
|
||||||
.clip(RoundedCornerShape(8.dp))
|
.clip(RoundedCornerShape(8.dp))
|
||||||
.background(artwork?.scheme?.primary ?: MaterialTheme.colorScheme.onBackground),
|
.background(artwork?.scheme?.primary ?: MaterialTheme.colorScheme.onBackground),
|
||||||
|
|||||||
Reference in New Issue
Block a user