Class RangeSliderOption
java.lang.Object
dev.boze.api.option.Option<double[]>
dev.boze.api.option.RangeSliderOption
- All Implemented Interfaces:
Serializable<double[]>
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal doubleThe maximum value either handle can be set tofinal doubleThe minimum value either handle can be set tofinal doubleThe increment by which the handles changeFields inherited from class Option
description, name, owner -
Constructor Summary
ConstructorsConstructorDescriptionRangeSliderOption(BaseModule owner, String name, String description, double low, double high, double min, double max, double step) Creates a new range slider option.RangeSliderOption(BaseModule owner, String name, String description, double low, double high, double min, double max, double step, Option<?> parent) Creates a new range slider option with a parent.RangeSliderOption(BaseModule owner, String name, String description, double low, double high, double min, double max, double step, BooleanSupplier visibility) Creates a new range slider option with visibility.RangeSliderOption(BaseModule owner, String name, String description, double low, double high, double min, double max, double step, BooleanSupplier visibility, Option<?> parent) Creates a new range slider option with visibility and a parent. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]fromJson(com.google.gson.JsonObject object) doublegetMax()doublegetMin()double[]getValue()Gets the current value of this optionintmaxIndex()intminIndex()double[]reset()Resets this option to its default valuedoubleset(int index, double newValue) Sets one handle's value, clamped to [min, max].double[]setValue(double[] newValue) Sets the value of this optioncom.google.gson.JsonObjecttoJson()Methods inherited from class Option
getFullName, getParent, isParent, isVisible, setParent, setVisibility
-
Field Details
-
min
public final double minThe minimum value either handle can be set to -
max
public final double maxThe maximum value either handle can be set to -
step
public final double stepThe increment by which the handles change
-
-
Constructor Details
-
RangeSliderOption
public RangeSliderOption(BaseModule owner, String name, String description, double low, double high, double min, double max, double step) Creates a new range slider option.- Parameters:
owner- The module that owns this optionname- The name of this optiondescription- The description of this optionlow- The initial low valuehigh- The initial high valuemin- The minimum allowed valuemax- The maximum allowed valuestep- The increment between values
-
RangeSliderOption
public RangeSliderOption(BaseModule owner, String name, String description, double low, double high, double min, double max, double step, Option<?> parent) Creates a new range slider option with a parent. -
RangeSliderOption
public RangeSliderOption(BaseModule owner, String name, String description, double low, double high, double min, double max, double step, BooleanSupplier visibility) Creates a new range slider option with visibility. -
RangeSliderOption
public RangeSliderOption(BaseModule owner, String name, String description, double low, double high, double min, double max, double step, BooleanSupplier visibility, Option<?> parent) Creates a new range slider option with visibility and a parent.
-
-
Method Details
-
getValue
-
setValue
-
set
public double set(int index, double newValue) Sets one handle's value, clamped to [min, max].- Parameters:
index- 0 or 1newValue- The new value- Returns:
- The clamped value
-
minIndex
public int minIndex()- Returns:
- the index (0 or 1) of the lower handle
-
maxIndex
public int maxIndex()- Returns:
- the index (0 or 1) of the higher handle
-
getMin
public double getMin()- Returns:
- the lower of the two values
-
getMax
public double getMax()- Returns:
- the higher of the two values
-
reset
-
toJson
public com.google.gson.JsonObject toJson()- Returns:
- The object as a JsonObject
-
fromJson
public double[] fromJson(com.google.gson.JsonObject object) - Parameters:
object- The JsonObject to deserialize- Returns:
- The deserialized object
-