File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
slider/src/main/java/io/monstarlab/mosaic/slider/distribution Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,24 @@ public interface SliderValueDistribution {
39
39
return ParabolicValueDistribution (a, b, c)
40
40
}
41
41
42
+ /* *
43
+ * Creates a [SliderValueDistribution] with a distribution strategy based on a list of check points.
44
+ * Each check point is a pair of offset fraction and value that will be associated with with this progress
45
+ * The distribution will interpolate between the check points using linear equations.
46
+ *
47
+ * Example:
48
+ * For the value range of 0..100
49
+ * CheckPointsValueDistribution(listOf(0f to 0f, 0.5f to 80f, 1f to 100f))
50
+ * This will create a distribution that will place value of 80 at 0.5 progress allowing the user to
51
+ * have more precision while selecting values between 80 and 100
52
+ *
53
+ * @param values a list of check points, each check point is a pair of offset fraction and value
54
+ * @return a [SliderValueDistribution] instance with a check points distribution strategy
55
+ */
56
+ public fun checkpoints (vararg values : Pair <Float , Float >): SliderValueDistribution {
57
+ return CheckPointsValueDistribution (values.toList())
58
+ }
59
+
42
60
/* *
43
61
* A linear distribution strategy where the input value is directly mapped to the output value.
44
62
* Used in [Slider] by default
You can’t perform that action at this time.
0 commit comments