Class SliderFloat
Slider UI element for floating point values.
Inheritance
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public class SliderFloat : Slider<float, float, FloatField>, IEventHandler, IVisualElementScheduler, IExperimentalFeatures, ITransitionAnimations, ITransform, IResolvedStyle, IContextOverrideElement, IAdditionalDataHolder, IInputElement<float>, IValidatableElement<float>, INotifyValueChanging<float>, INotifyValueChanged<float>, IFormattable<float>
Constructors
SliderFloat()
Default constructor.
Declaration
public SliderFloat()
Properties
thumbCount
Get the number of thumbs for this slider.
Declaration
protected override int thumbCount { get; }
Property Value
Type | Description |
---|---|
int |
Overrides
Methods
ClampThumb(float, float, float)
Clamp the thumb value.
Declaration
protected override float ClampThumb(float x, float min, float max)
Parameters
Type | Name | Description |
---|---|---|
float | x | The value to clamp. |
float | min | The minimum value. |
float | max | The maximum value. |
Returns
Type | Description |
---|---|
float | The clamped values. |
Overrides
GetScalarValuesFromValue(float, Span<float>)
Get the list of thumb values from the TValue value. This must be sorted.
Declaration
protected override void GetScalarValuesFromValue(float v, Span<float> values)
Parameters
Type | Name | Description |
---|---|---|
float | v | |
Span<float> | values | The list of thumb values. |
Overrides
GetStepCount(float)
Declaration
protected override int GetStepCount(float stepValue)
Parameters
Type | Name | Description |
---|---|---|
float | stepValue | The step value. |
Returns
Type | Description |
---|---|
int | The number of possible steps. |
Overrides
GetValueFromScalarValues(Span<float>)
Get the TValue value from the list of thumb values.
Declaration
protected override float GetValueFromScalarValues(Span<float> values)
Parameters
Type | Name | Description |
---|---|---|
Span<float> | values | The list of thumb values. |
Returns
Type | Description |
---|---|
float | The TValue value. |
Overrides
Mad(int, float, float)
Performs an arithmetic multiply/add operation.
Declaration
protected override float Mad(int m, float a, float b)
Parameters
Type | Name | Description |
---|---|---|
int | m | The number of times to multiply the a value. |
float | a | The value that will be multiplied N times and then added to the base value. |
float | b | The addition value. |
Returns
Type | Description |
---|---|
float | The incremented value. |
Overrides
ParseStringToValue(string, out float)
Method to implement to resolve a string value into a float value.
You can use TryParse(string, out float) for floating point value types for example.
Declaration
protected override bool ParseStringToValue(string strValue, out float v)
Parameters
Type | Name | Description |
---|---|---|
string | strValue | The string value to convert. |
float | v |
Returns
Type | Description |
---|---|
bool | True if can be parsed, False otherwise. |
Overrides
ParseSubValueToString(float)
Method to implement to resolve a float value into a string value.
You can use ToString() for floating point value types for example.
You can also round the value if you want a specific number of decimals.
Declaration
protected override string ParseSubValueToString(float val)
Parameters
Type | Name | Description |
---|---|---|
float | val | The float value to convert. |
Returns
Type | Description |
---|---|
string | The converted value. |
Overrides
ParseValueToString(float)
Method to implement to resolve a float value into a string value.
You can use ToString() for floating point value types for example.
You can also round the value if you want a specific number of decimals.
Declaration
protected override string ParseValueToString(float val)
Parameters
Type | Name | Description |
---|---|---|
float | val | The float value to convert. |
Returns
Type | Description |
---|---|
string | The converted value. |
Overrides
SliderLerpUnclamped(float, float, float)
Method to implement which returns a value based on the linear interpolation of a given interpolant between a specific range.
Usually, you can use directly LerpUnclamped(float, float, float) for floating point value types.
Declaration
protected override float SliderLerpUnclamped(float a, float b, float interpolant)
Parameters
Type | Name | Description |
---|---|---|
float | a | The lowest value in the range. |
float | b | The highest value in the range. |
float | interpolant | The normalized value to process. |
Returns
Type | Description |
---|---|
float | The interpolated value. |
Overrides
SliderNormalizeValue(float, float, float)
Method to implement which returns the normalized value of a given value in a specific range.
Usually, you can use directly an InverseLerp(float, float, float) for floating point value types.
Declaration
protected override float SliderNormalizeValue(float currentValue, float lowerValue, float higherValue)
Parameters
Type | Name | Description |
---|---|---|
float | currentValue | The value to normalize. |
float | lowerValue | The lowest value in the range. |
float | higherValue | The highest value in the range. |
Returns
Type | Description |
---|---|
float | The normalized value. |