lazy-widgets
Version:
Typescript retained mode GUI for the HTML canvas API
31 lines • 1.12 kB
JavaScript
import { TextAlignMode, WrapMode } from '../helpers/TextHelper.js';
import { Label } from './Label.js';
import { Alignment } from '../theme/Alignment.js';
import { FilledButton } from './FilledButton.js';
import { filterIDFromProperties } from '../helpers/filterIDFromProperties.js';
/**
* A {@link FilledButton} with a {@link Label}. Alignment is forced to be
* horizontally centered and vertically stretching. Text-wrapping is disabled so
* that text is centered properly.
*
* @category Widget
*/
export class TextButton extends FilledButton {
constructor(text, properties) {
// default properties
properties = Object.assign({ containerAlignment: {
horizontal: Alignment.Center, vertical: Alignment.Stretch,
}, bodyTextAlign: TextAlignMode.Center, wrapMode: WrapMode.Ellipsis }, properties);
super(new Label(text, filterIDFromProperties(properties)), properties);
}
}
TextButton.autoXML = {
name: 'text-button',
inputConfig: [
{
mode: 'text',
name: 'text'
}
]
};
//# sourceMappingURL=TextButton.js.map