Skip to content

Commit b2b4271

Browse files
committed
Update calculateStep to use Double.MIN_VALUE
1 parent ebeaa22 commit b2b4271

File tree

1 file changed

+3
-3
lines changed
  • material3/src/jsMain/kotlin/com/huanshankeji/compose/material3

1 file changed

+3
-3
lines changed

material3/src/jsMain/kotlin/com/huanshankeji/compose/material3/Slider.js.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import com.huanshankeji.compose.web.attributes.isFalseOrNull
1010
/**
1111
* Calculate the step to match the Compose UI behavior.
1212
*/
13-
private fun calculateStep(steps: Int, valueRange: ClosedFloatingPointRange<Float>): Float =
14-
// We can also use `Double.MIN_VALUE` and change the return type to `Number`, but `Float.MIN_VALUE` should be sufficient here.
15-
if (steps > 0) (valueRange.endInclusive - valueRange.start) / (steps + 1) else Float.MIN_VALUE
13+
private fun calculateStep(steps: Int, valueRange: ClosedFloatingPointRange<Float>): Number =
14+
// JavaScript doesn't have a 32-bit float type so we just use `Double.MIN_VALUE` here.
15+
if (steps > 0) (valueRange.endInclusive - valueRange.start) / (steps + 1) else Double.MIN_VALUE
1616

1717
@Composable
1818
actual fun Slider(

0 commit comments

Comments
 (0)