Table of Contents

Class Picker

Namespace
UILib.Components
Assembly
UILib.dll

A 2D picker component.

Kind of like a Slider, but allows you to handle x and y values.

By default: (0, 0) is the bottom left (1, 1) is the top right

public class Picker : UIComponent
Inheritance
Picker
Inherited Members

Constructors

Picker()

Initializes a picker.

public Picker()

Properties

background

The background of this picker.

public Image background { get; }

Property Value

Image

handle

The picker's handle.

public Image handle { get; }

Property Value

Image

maxX

The maximum x value.

public float maxX { get; }

Property Value

float

maxY

The maximum y value.

public float maxY { get; }

Property Value

float

minX

The minimum x value.

public float minX { get; }

Property Value

float

minY

The minimum y value.

public float minY { get; }

Property Value

float

onSubmit

Invokes listeners with the current value when the user stops moving the handle.

public ValueEvent<Vector2> onSubmit { get; }

Property Value

ValueEvent<Vector2>

onValueChanged

Invokes listeners with the current value when the position of the handle is changed by the user.

public ValueEvent<Vector2> onValueChanged { get; }

Property Value

ValueEvent<Vector2>

value

The current value stored in the picker.

The position of the handle is first normalized and then the minimum and maximum x and y values are used to calculate the current value of the handle.

This value will always be between (minX, minY) and (maxX, maxY).

public Vector2 value { get; }

Property Value

Vector2

Methods

OnDrag(Vector2)

Handles this picker being dragged.

protected override void OnDrag(Vector2 position)

Parameters

position Vector2

The position dragged to

SetMaxValues(float, float)

Sets the maximum values of this picker.

public void SetMaxValues(float maxX, float maxY)

Parameters

maxX float

The maximum x value

maxY float

The maximum y value

SetMinValues(float, float)

Sets the minimum values of this picker.

public void SetMinValues(float minX, float minY)

Parameters

minX float

The minimum x value

minY float

The minimum y value

SetThisTheme(Theme)

Allows setting the theme of this picker.

This handles setting the theme specifically for this component, not its children. It's protected to allow overriding if you were to create a subclass.

In most cases, you'd probably want to use SetTheme(Theme) instead.

protected override void SetThisTheme(Theme theme)

Parameters

theme Theme

The theme to apply

SetValue(float, float)

Sets the current value of this picker.

These values must be within your configured min and max values.

public void SetValue(float x, float y)

Parameters

x float

The x value to set the picker to

y float

The y value to set the picker to