|
|
@ -57,6 +57,9 @@ import kotlinx.coroutines.delay
|
|
|
|
import kotlin.math.max
|
|
|
|
import kotlin.math.max
|
|
|
|
import kotlin.math.min
|
|
|
|
import kotlin.math.min
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private const val SCROLLBAR_PRESS_DELAY = 100L
|
|
|
|
|
|
|
|
private const val SCROLLBAR_PRESS_DELTA = 0.1f
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Class definition for the core properties of a scroll bar
|
|
|
|
* Class definition for the core properties of a scroll bar
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -310,8 +313,7 @@ fun Scrollbar(
|
|
|
|
dimension = orientation.valueOf(pressedOffset),
|
|
|
|
dimension = orientation.valueOf(pressedOffset),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
val isPositive = currentTravel < destinationTravel
|
|
|
|
val isPositive = currentTravel < destinationTravel
|
|
|
|
// TODO: Come up with a better heuristic for jumps
|
|
|
|
val delta = SCROLLBAR_PRESS_DELTA * if (isPositive) 1f else -1f
|
|
|
|
val delta = if (isPositive) 0.1f else -0.1f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (currentTravel != destinationTravel) {
|
|
|
|
while (currentTravel != destinationTravel) {
|
|
|
|
currentTravel =
|
|
|
|
currentTravel =
|
|
|
@ -322,8 +324,7 @@ fun Scrollbar(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onThumbMoved(currentTravel)
|
|
|
|
onThumbMoved(currentTravel)
|
|
|
|
interactionThumbTravelPercent = currentTravel
|
|
|
|
interactionThumbTravelPercent = currentTravel
|
|
|
|
// TODO: Define this more thoroughly
|
|
|
|
delay(SCROLLBAR_PRESS_DELAY)
|
|
|
|
delay(100)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|