Class RangeSliderBase<TRangeType, TValueType>
Base class for Sliders (RangeSliderFloat, RangeSliderInt).
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public abstract class RangeSliderBase<TRangeType, TValueType> : BaseSlider<TRangeType, TValueType>, IEventHandler, IVisualElementScheduler, IExperimentalFeatures, ITransitionAnimations, ITransform, IResolvedStyle, IContextOverrideElement, IAdditionalDataHolder, IInputElement<TRangeType>, IValidatableElement<TRangeType>, INotifyValueChanging<TRangeType>, INotifyValueChanged<TRangeType> where TRangeType : IEquatable<TRangeType> where TValueType : struct, IComparable, IEquatable<TValueType>
Type Parameters
Name | Description |
---|---|
TRangeType | The range type. |
TValueType | A comparable value type. |
Constructors
RangeSliderBase()
Default constructor.
Declaration
protected RangeSliderBase()
Fields
controlContainerUssClassName
The Slider control container styling class.
Declaration
public const string controlContainerUssClassName = "appui-slider__control-container"
Field Value
Type | Description |
---|---|
string |
controlsUssClassName
The Slider controls styling class.
Declaration
public const string controlsUssClassName = "appui-slider__controls"
Field Value
Type | Description |
---|---|
string |
handleContainerUssClassName
The Slider handle container styling class.
Declaration
public const string handleContainerUssClassName = "appui-slider__handle-container"
Field Value
Type | Description |
---|---|
string |
handleUssClassName
The Slider handle styling class.
Declaration
public const string handleUssClassName = "appui-slider__handle"
Field Value
Type | Description |
---|---|
string |
inlineValueLabelUssClassName
The Slider inline value label styling class.
Declaration
public const string inlineValueLabelUssClassName = "appui-slider__inline-valuelabel"
Field Value
Type | Description |
---|---|
string |
inlineValueUssClassName
The Slider inline value styling class.
Declaration
public const string inlineValueUssClassName = "appui-slider--inline-value-"
Field Value
Type | Description |
---|---|
string |
labelContainerUssClassName
The Slider label container styling class.
Declaration
public const string labelContainerUssClassName = "appui-slider__labelcontainer"
Field Value
Type | Description |
---|---|
string |
labelUssClassName
The Slider label styling class.
Declaration
public const string labelUssClassName = "appui-slider__label"
Field Value
Type | Description |
---|---|
string |
noLabelUssClassName
The Slider no label variant styling class.
Declaration
public const string noLabelUssClassName = "appui-slider--no-label"
Field Value
Type | Description |
---|---|
string |
paddedContainerUssClassName
The Slider padded container styling class.
Declaration
public const string paddedContainerUssClassName = "appui-slider__padded-container"
Field Value
Type | Description |
---|---|
string |
progressContainerUssClassName
The Slider progress container styling class.
Declaration
public const string progressContainerUssClassName = "appui-slider__interactive-area"
Field Value
Type | Description |
---|---|
string |
progressUssClassName
The Slider progress styling class.
Declaration
public const string progressUssClassName = "appui-slider__progress"
Field Value
Type | Description |
---|---|
string |
sizeUssClassName
The Slider size styling class.
Declaration
public const string sizeUssClassName = "appui-slider--size-"
Field Value
Type | Description |
---|---|
string |
tickLabelUssClassName
The Slider tick label styling class.
Declaration
public const string tickLabelUssClassName = "appui-slider__ticklabel"
Field Value
Type | Description |
---|---|
string |
tickLabelVariantUssClassName
The Slider with tick labels variant styling class.
Declaration
public const string tickLabelVariantUssClassName = "appui-slider--tick-labels"
Field Value
Type | Description |
---|---|
string |
tickUssClassName
The Slider tick styling class.
Declaration
public const string tickUssClassName = "appui-slider__tick"
Field Value
Type | Description |
---|---|
string |
ticksUssClassName
The Slider ticks container styling class.
Declaration
public const string ticksUssClassName = "appui-slider__ticks"
Field Value
Type | Description |
---|---|
string |
trackUssClassName
The Slider track styling class.
Declaration
public const string trackUssClassName = "appui-slider__track"
Field Value
Type | Description |
---|---|
string |
ussClassName
The Slider main styling class.
Declaration
public const string ussClassName = "appui-slider"
Field Value
Type | Description |
---|---|
string |
valueLabelUssClassName
The Slider value label styling class.
Declaration
public const string valueLabelUssClassName = "appui-slider__valuelabel"
Field Value
Type | Description |
---|---|
string |
Properties
filled
If the slider progress is filled.
Declaration
public bool filled { get; set; }
Property Value
Type | Description |
---|---|
bool |
inlineValue
The inline mode for the slider value element.
Declaration
public InlineValue inlineValue { get; set; }
Property Value
Type | Description |
---|---|
InlineValue |
label
Text which will be used for the Slider label.
Declaration
public string label { get; set; }
Property Value
Type | Description |
---|---|
string |
maxValue
The value of the right handle.
Declaration
public abstract TValueType maxValue { get; set; }
Property Value
Type | Description |
---|---|
TValueType |
Remarks
This is not the same as the highValue which is the maximum value of the slider.
minValue
The value of the left handle.
Declaration
public abstract TValueType minValue { get; set; }
Property Value
Type | Description |
---|---|
TValueType |
Remarks
This is not the same as the lowValue which is the minimum value of the slider.
size
The size of the slider.
Declaration
public Size size { get; set; }
Property Value
Type | Description |
---|---|
Size |
tickCount
The number of ticks to display on the slider.
Declaration
public int tickCount { get; set; }
Property Value
Type | Description |
---|---|
int |
tickLabel
Should the tick labels be displayed.
Declaration
public bool tickLabel { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
Clamp(TRangeType, TValueType, TValueType)
Utility method to clamp a TValueType value between specified bounds.
Declaration
protected override TRangeType Clamp(TRangeType v, TValueType lowBound, TValueType highBound)
Parameters
Type | Name | Description |
---|---|---|
TRangeType | v | The value to clamp. |
TValueType | lowBound | Minimum |
TValueType | highBound | Maximum |
Returns
Type | Description |
---|---|
TRangeType | The clamped value. |
Overrides
ClosestHandleIndex(float)
Find the closest handle index to the mouse position.
Declaration
protected int ClosestHandleIndex(float mousePosition)
Parameters
Type | Name | Description |
---|---|---|
float | mousePosition | The mouse position. |
Returns
Type | Description |
---|---|
int | The closest handle index. |
ComputeValueFromHandlePosition(float, float)
Returns the value to set as slider value based on a given dragger position.
Declaration
protected override TRangeType ComputeValueFromHandlePosition(float sliderLength, float dragElementPos)
Parameters
Type | Name | Description |
---|---|---|
float | sliderLength | The length of the slider. |
float | dragElementPos | The position of the dragger. |
Returns
Type | Description |
---|---|
TRangeType | The value to set as slider value based on a given dragger position. |
Overrides
GetClampedValue(TValueType, TValueType, TValueType)
Get the clamped value.
Declaration
protected abstract TValueType GetClampedValue(TValueType value, TValueType lowerValue, TValueType higherValue)
Parameters
Type | Name | Description |
---|---|---|
TValueType | value | The value to clamp. |
TValueType | lowerValue | The lower bound. |
TValueType | higherValue | The higher bound. |
Returns
Type | Description |
---|---|
TValueType | The clamped value. |
GetInlineValueUssClassName(InlineValue)
Declaration
public static string GetInlineValueUssClassName(InlineValue enumValue)
Parameters
Type | Name | Description |
---|---|---|
InlineValue | enumValue |
Returns
Type | Description |
---|---|
string |
GetMaxValue(TRangeType)
Get the maximum value from the range value.
Declaration
protected abstract TValueType GetMaxValue(TRangeType rangeValue)
Parameters
Type | Name | Description |
---|---|---|
TRangeType | rangeValue | The range value. |
Returns
Type | Description |
---|---|
TValueType | The maximum value of the range. |
GetMinValue(TRangeType)
Get the minimum value from the range value.
Declaration
protected abstract TValueType GetMinValue(TRangeType rangeValue)
Parameters
Type | Name | Description |
---|---|---|
TRangeType | rangeValue | The range value. |
Returns
Type | Description |
---|---|
TValueType | The minimum value of the range. |
GetSizeUssClassName(Size)
Declaration
public static string GetSizeUssClassName(Size enumValue)
Parameters
Type | Name | Description |
---|---|---|
Size | enumValue |
Returns
Type | Description |
---|---|
string |
GetSliderRect()
Returns the rect of the interactive part of the slider.
Declaration
protected override Rect GetSliderRect()
Returns
Type | Description |
---|---|
Rect | The rect of the interactive part of the slider. |
Overrides
LerpUnclamped(TValueType, TValueType, float)
Lerp between two values.
Declaration
protected abstract TValueType LerpUnclamped(TValueType a, TValueType b, float interpolant)
Parameters
Type | Name | Description |
---|---|---|
TValueType | a | The first value. |
TValueType | b | The second value. |
float | interpolant | The interpolant. |
Returns
Type | Description |
---|---|
TValueType | The lerped value. |
MakeRangeValue(TValueType, TValueType)
Create a range value from the min and max values.
Declaration
protected abstract TRangeType MakeRangeValue(TValueType minValue, TValueType maxValue)
Parameters
Type | Name | Description |
---|---|---|
TValueType | minValue | The minimum value of the range. |
TValueType | maxValue | The maximum value of the range. |
Returns
Type | Description |
---|---|
TRangeType | A new range value. |
OnSliderRangeChanged()
Called when the low or high value of Slider has changed.
Declaration
protected override void OnSliderRangeChanged()
Overrides
SetValueWithoutNotify(TRangeType)
Set the value of the slider without notifying the change.
Declaration
public override void SetValueWithoutNotify(TRangeType newValue)
Parameters
Type | Name | Description |
---|---|---|
TRangeType | newValue | The new value of the slider. |