Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save PreyeaRegmi/c19c34b081e9a261b28d5b9cf237b9d9 to your computer and use it in GitHub Desktop.
Save PreyeaRegmi/c19c34b081e9a261b28d5b9cf237b9d9 to your computer and use it in GitHub Desktop.
verticalscroll-layout-compose
layout(constraints.maxWidth, totalHeight) {
var yPosition = 0
placeables.forEachIndexed { index, placeable ->
val dragVal = dragAmount.value
//Calculate the new position based on the drag value and the gaussian factor,
// where the dragged index has highest factor and decreasing factor along its adjacent elements
val newPostion = (yPosition + (dragVal * getFactor(index, draggingItemIndex)))
placeable.placeRelative(0, newPostion.toInt())
yPosition = newPostion.toInt() + placeable.height
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment