# Double Option

## DoubleOption Class

### General Summary

`DoubleOption` provides a slider for selecting a `double` value within a specified range in the DynamicHUD library.

### Constructor Parameters

* `name`: The display name for the slider.
* `minValue`: The minimum value the slider can represent.
* `maxValue`: The maximum value the slider can represent.
* `step`: The increment between each value on the slider is defined by the "step." For a slider ranging from 0 to 1, with a step of 0.1f, the slider will be divided into ten equal parts. Each movement will increase the value by one step, or 0.1f.
* `getter`: **Supplier** that retrieves the current value.
* `setter`: **Consumer** that sets the new value after interaction.

{% hint style="warning" %}
The width of the slider is limited to only 30 pixels unit, so incase of vast difference between the min and max values along with small step value, the slider may break and not function properly.
{% endhint %}

{% hint style="warning" %}
Step cannot be less than or equal to 0. Passing 0 will result in a crash.
{% endhint %}

### Interactivity

* **Click**: Initiates the value change and starts dragging.
* **Drag**: Adjusts the slider's value as the user drags the handle.
* **Release**: Stops the dragging action and finalizes the value selection.

### Rendering

* **Label**: Shows the name and current value.
* **Slider**: A visual representation of the value range, with a handle that moves to represent the current value.

### Example Usage

```java
DoubleOption volumeOption = new DoubleOption(
    "Volume",
    0.0, // Minimum volume
    100.0, // Maximum volume
    10f, // Step, with 10f each "slide", the value will be incremented by 10
    () -> audioSettings.getVolume(), // Getter
    value -> audioSettings.setVolume(value) // Setter
);
```
