calculateLabelOffset

fun calculateLabelOffset(singleValue: Float? = null, rangeValue: ClosedFloatingPointRange<Float>? = null, valueRange: ClosedFloatingPointRange<Float>, sliderWidth: Dp, labelWidth: Int, density: Density): Dp

Calculates the horizontal offset for the label based on the slider's value and range.

Return

The calculated horizontal offset for the label in dp.

Parameters

singleValue

The value for a single value slider.

rangeValue

The value for a range slider.

valueRange

The range of values the slider can represent.

sliderWidth

The width of the slider in dp.

labelWidth

The width of the label in pixels.

density

The density of the current context.