Skip to content

Commit ad00d04

Browse files
committed
make values normalized ( between 0 and 1 )
1 parent 9e535b0 commit ad00d04

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

slider/src/main/java/io/monstarlab/mosaic/slider/SliderValueDistribution.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.monstarlab.mosaic.slider
22

3+
import androidx.annotation.FloatRange
34
import kotlin.math.sqrt
45

56
/**
@@ -12,18 +13,18 @@ public interface SliderValueDistribution {
1213

1314
/**
1415
* Interpolates a value based on the distribution strategy.
15-
* @param value the input value to interpolate
16-
* @return the interpolated value based on the distribution strategy
16+
* @param value the normalized input value to interpolate, it must be between 0 and 1
17+
* @return the normalized interpolated value based on the distribution strategy, between 0 and 1
1718
*/
18-
public fun interpolate(value: Float): Float
19+
public fun interpolate(@FloatRange(0.0, 1.0) value: Float): Float
1920

2021
/**
2122
* Inversely interpolates a value from the output range to the input range based on the distribution strategy.
2223
*
23-
* @param value the output value to inverse interpolate
24-
* @return the inverse interpolated value based on the distribution strategy
24+
* @param value the normalized value to inverse interpolate, must be between 0 and 1
25+
* @return the normalized inverse interpolated value based on the distribution strategy, between 0 and 1
2526
*/
26-
public fun inverse(value: Float): Float
27+
public fun inverse(@FloatRange(0.0, 1.0) value: Float): Float
2728

2829
public companion object {
2930

0 commit comments

Comments
 (0)