UNPKG

@playcanvas/pcui

Version:

User interface component library for the web

134 lines (133 loc) 4.42 kB
import { Element, ElementArgs, IBindable, IBindableArgs, IFlexArgs, IFocusable, IPlaceholder, IPlaceholderArgs } from '../Element'; import { NumericInput } from '../NumericInput'; /** * The arguments for the {@link SliderInput} constructor. */ interface SliderInputArgs extends ElementArgs, IBindableArgs, IFlexArgs, IPlaceholderArgs { /** * Sets whether any key up event will cause a change event to be fired. */ keyChange?: boolean; /** * Sets the minimum value that the numeric input field can take. */ min?: number; /** * Sets the maximum value that the numeric input field can take. */ max?: number; /** * Sets the minimum value that the slider field can take. Defaults to 0. */ sliderMin?: number; /** * Sets the maximum value that the slider field can take. Defaults to 1. */ sliderMax?: number; /** * Sets the maximum number of decimals a value can take. Defaults to 2. */ precision?: number; /** * Sets the amount that the value will be increased or decreased when using the arrow * keys. Holding Shift will use 10x the step. */ step?: number; /** * Sets whether the value can be null. If not then it will be 0 instead of null. */ allowNull?: boolean; } /** * The SliderInput shows a NumericInput and a slider widget next to it. It acts as a proxy of the * NumericInput. */ declare class SliderInput extends Element implements IBindable, IFocusable, IPlaceholder { protected _historyCombine: boolean; protected _historyPostfix: string; protected _numericInput: NumericInput; protected _sliderMin: number; protected _sliderMax: number; protected _domSlider: HTMLDivElement; protected _domBar: HTMLDivElement; protected _domHandle: HTMLDivElement; protected _cursorHandleOffset: number; protected _pointerId: number; /** * Creates a new SliderInput. * * @param args - The arguments. */ constructor(args?: Readonly<SliderInputArgs>); destroy(): void; protected _onPointerDown: (evt: PointerEvent) => void; protected _onPointerMove: (evt: PointerEvent) => void; protected _onPointerUp: (evt: PointerEvent) => void; protected _onKeyDown: (evt: KeyboardEvent) => void; protected _updateHandle(value: number): void; protected _onValueChange(value: number): void; protected _calculateCursorHandleOffset(pageX: number): number; protected _onSlideStart(pageX: number): void; protected _onSlideMove(pageX: number): void; protected _onSlideEnd(pageX: number): void; focus(): void; blur(): void; /** * Sets the minimum value that the slider field can take. */ set sliderMin(value: number); /** * Gets the minimum value that the slider field can take. */ get sliderMin(): number; /** * Sets the maximum value that the slider field can take. */ set sliderMax(value: number); /** * Gets the maximum value that the slider field can take. */ get sliderMax(): number; set value(value: number); get value(): number; set values(values: Array<number>); set renderChanges(value: boolean); get renderChanges(): boolean; /** * Sets the minimum value that the numeric input field can take. */ set min(value: number); /** * Gets the minimum value that the numeric input field can take. */ get min(): number; /** * Sets the maximum value that the numeric input field can take. */ set max(value: number); /** * Gets the maximum value that the numeric input field can take. */ get max(): number; /** * Sets the amount that the value will be increased or decreased when using the arrow keys. Holding Shift will use 10x the step. */ set step(value: number); /** * Gets the amount that the value will be increased or decreased when using the arrow keys. */ get step(): number; /** * Sets the maximum number of decimals a value can take. */ set precision(value: number); /** * Gets the maximum number of decimals a value can take. */ get precision(): number; set keyChange(value: boolean); get keyChange(): boolean; set placeholder(value: string); get placeholder(): string; } export { SliderInput, SliderInputArgs };