File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
pillarbox-demo-shared/src/main/java/ch/srgssr/pillarbox/demo/shared/ui/components Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -331,12 +331,18 @@ private fun Modifier.dragThumb(
331331 }
332332
333333 return this then Modifier .pointerInput(Unit ) {
334+ fun notifySliderValueChange (offset : Offset ) {
335+ val offsetX = offset.x.coerceIn(0f , size.width.toFloat())
336+
337+ onSliderValueChange(offsetX / size.width)
338+ }
339+
334340 detectHorizontalDragGestures(
335341 onDragStart = { offset ->
336342 startInteraction = DragInteraction .Start ()
337343 .also { interactionSource.tryEmit(it) }
338344
339- onSliderValueChange (offset.x / size.width )
345+ notifySliderValueChange (offset)
340346 },
341347 onDragEnd = {
342348 destroyStartInteraction(DragInteraction ::Stop )
@@ -345,7 +351,7 @@ private fun Modifier.dragThumb(
345351 destroyStartInteraction(DragInteraction ::Cancel )
346352 },
347353 onHorizontalDrag = { change, _ ->
348- onSliderValueChange (change.position.x / size.width )
354+ notifySliderValueChange (change.position)
349355 },
350356 )
351357 }
You can’t perform that action at this time.
0 commit comments