@playcanvas/pcui
Version:
User interface component library for the web
101 lines (100 loc) • 3.33 kB
TypeScript
import { Observer } from '@playcanvas/observer';
import { Element, ElementArgs, IBindable, IBindableArgs, IFocusable, IPlaceholder, IPlaceholderArgs } from '../Element';
import { NumericInput } from '../NumericInput';
/**
* The arguments for the {@link VectorInput} constructor.
*/
interface VectorInputArgs extends ElementArgs, IPlaceholderArgs, IBindableArgs {
/**
* The number of dimensions in the vector. Can be between 2 to 4. Defaults to 3.
*/
dimensions?: 2 | 3 | 4;
/**
* The minimum value of each vector element.
*/
min?: number;
/**
* The maximum value of each vector element.
*/
max?: number;
/**
* The incremental step when using arrow keys or dragger for each vector element.
*/
step?: number;
/**
* The decimal precision of each vector element. Defaults to 7.
*/
precision?: number;
/**
* The incremental step when holding Shift and using arrow keys or dragger for each vector element.
*/
stepPrecision?: number;
}
/**
* A vector input. The vector can have 2 to 4 dimensions with each dimension being a {@link NumericInput}.
*/
declare class VectorInput extends Element implements IBindable, IFocusable, IPlaceholder {
protected _inputs: NumericInput[];
protected _applyingChange: boolean;
protected _bindAllInputs: boolean;
/**
* Creates a new VectorInput.
*
* @param args - The arguments.
*/
constructor(args?: Readonly<VectorInputArgs>);
protected _onInputChange(input: NumericInput): void;
protected _updateValue(value: number[]): boolean;
link(observers: Observer | Observer[], paths: string | string[]): void;
unlink(): void;
focus(): void;
blur(): void;
set value(value: number[]);
get value(): number[];
set values(values: Array<any>);
set binding(value: import("../..").BindingBase);
get binding(): import("../..").BindingBase;
set placeholder(value: any);
get placeholder(): any;
/**
* Get the array of number inputs owned by this vector.
*/
get inputs(): NumericInput[];
set renderChanges(value: boolean);
get renderChanges(): boolean;
/**
* Sets the minimum value accepted by all inputs of the vector.
*/
set min(value: number);
/**
* Gets the minimum value accepted by all inputs of the vector.
*/
get min(): number;
/**
* Sets the maximum value accepted by all inputs of the vector.
*/
set max(value: number);
/**
* Gets the maximum value accepted by all inputs of the vector.
*/
get max(): number;
/**
* Sets the maximum number of decimal places supported by all inputs of the vector.
*/
set precision(value: number);
/**
* Gets the maximum number of decimal places supported by all inputs of the vector.
*/
get precision(): number;
/**
* Sets the amount that the value will be increased or decreased when using the arrow keys and
* the slider input for all inputs of the vector.
*/
set step(value: number);
/**
* Gets the amount that the value will be increased or decreased when using the arrow keys and
* the slider input for all inputs of the vector.
*/
get step(): number;
}
export { VectorInput, VectorInputArgs };