Created
June 14, 2024 19:56
-
-
Save PreyeaRegmi/c19c34b081e9a261b28d5b9cf237b9d9 to your computer and use it in GitHub Desktop.
verticalscroll-layout-compose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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