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