Naveen Perumal
02/27/2024, 11:40 AMval verticalScrollState = rememberScrollState()
val horizontalScrollState = rememberScrollState()
val coroutineScope = rememberCoroutineScope()
Box(
modifier = Modifier
.fillMaxWidth()
.fillMaxHeight()
.horizontalScroll(horizontalScrollState)
.verticalScroll(verticalScrollState)
.pointerInput(Unit) {
detectDragGestures { change, dragAmount ->
coroutineScope.launch {
verticalScrollState.scrollBy(-dragAmount.y)
horizontalScrollState.scrollBy(-dragAmount.x)
}
change.consume()
}
}
)
But when using dragGestures, fling doesn't work. How to achieve the spreadsheet behaviour in a clean way?MR3Y
02/27/2024, 11:46 AMLazyLayout
and I'm not sure If you need that lazy behavior here, looking at how at handles gestures can still be beneficial though for your use-case.Filip Wiesner
02/27/2024, 11:47 AMVelocityTracker
to calculate fling on your own.Naveen Perumal
02/27/2024, 11:50 AMZach Klippenstein (he/him) [MOD]
02/27/2024, 2:13 PMAlbert Chang
02/27/2024, 2:32 PManimateDecay
for the two axes separately.