lazy-widgets
Version:
Typescript retained mode GUI for the HTML canvas API
34 lines • 953 B
JavaScript
import { TextButton } from '../TextButton.js';
/**
* A {@link TextButton} which calls a given callback and displays a given text source.
*
* For now there's nothing special about this class; it's just a common base
* class for virtual keyboard key widgets.
*
* @category Widget
*/
export class VirtualKey extends TextButton {
/**
* @param text - The text to display in the virtual key.
* @param callback - The callback called when the button is pressed.
*/
constructor(text, callback, properties) {
super(text, Object.assign({ minWidth: 24, minHeight: 24 }, properties));
this.on('click', callback);
}
}
VirtualKey.autoXML = {
name: 'virtual-key',
inputConfig: [
{
mode: 'text',
name: 'text'
},
{
name: 'callback',
mode: 'value',
validator: 'function',
},
]
};
//# sourceMappingURL=VirtualKey.js.map