Skip to content

Instantly share code, notes, and snippets.

@PiotrPrus
Last active December 15, 2021 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PiotrPrus/a22673a5aea85680b8b093b42f698b98 to your computer and use it in GitHub Desktop.
Save PiotrPrus/a22673a5aea85680b8b093b42f698b98 to your computer and use it in GitHub Desktop.
var selectedPosition by remember { mutableStateOf(0) }
val selectedBar by remember(selectedPosition, barAreas) {
derivedStateOf {
barAreas.find { it.xStart < selectedPosition && selectedPosition < it.xEnd }
}
}
Modifier.tapOrPress(
onStart = { },
onCancel = { },
onCompleted = { selectedPosition = it }
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment