Skip to content

Commit

Permalink
Merge pull request #24 from dev-weiqi/master
Browse files Browse the repository at this point in the history
Fix incorrect offset when no gesture events
  • Loading branch information
SmartToolFactory authored Oct 6, 2023
2 parents b1fbd4c + cd0feab commit 352ee0a
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ fun ColorfulSlider(
value
)

LaunchedEffect(valueRange) {
onValueChangeState.value(
value,
Offset(x = rawOffset.value.coerceIn(trackStart, trackEnd), y = strokeRadius)
)
}

val coerced = value.coerceIn(valueRange.start, valueRange.endInclusive)
val fraction = calculateFraction(valueRange.start, valueRange.endInclusive, coerced)

Expand Down

0 comments on commit 352ee0a

Please sign in to comment.