lazy-widgets
Version:
Typescript retained mode GUI for the HTML canvas API
43 lines • 1.62 kB
JavaScript
import { ScrollableViewportWidget, ScrollbarMode } from './ScrollableViewportWidget.js';
import { TextInput } from './TextInput.js';
import { AxisCoupling } from '../core/AxisCoupling.js';
import { filterIDFromProperties } from '../helpers/filterIDFromProperties.js';
/**
* A {@link ScrollableViewportWidget} with a {@link TextInput}. Meant to be used
* as an analogue to the HTML textarea. Allows tab typing by default.
*
* Using uni-directional coupling with
* {@link ScrollbarMode.Hidden | hidden scrollbars} (the default) is
* recommended. However, if the scrollbars need to be visible, then
* {@link ScrollbarMode.Layout | layout scrollbars} are recommended since
* {@link ScrollbarMode.Overlay | overlay scrollbars} will hide text near the
* borders.
*
* @category Widget
*/
export class TextArea extends ScrollableViewportWidget {
constructor(variable, properties) {
// default properties
properties = Object.assign({ widthCoupling: AxisCoupling.ParentToChild, heightCoupling: AxisCoupling.ParentToChild, scrollbarMode: ScrollbarMode.Hidden, typeableTab: true }, properties);
super(new TextInput(variable, filterIDFromProperties(properties)), properties);
}
/**
* Get the {@link TextInput} of this TextArea. Equivalent to
* {@link TextArea#child}.
*/
get textInput() {
return this.child;
}
}
TextArea.autoXML = {
name: 'text-area',
inputConfig: [
{
mode: 'value',
name: 'variable',
validator: 'box',
optional: true,
}
]
};
//# sourceMappingURL=TextArea.js.map