lazy-widgets
Version:
Typescript retained mode GUI for the HTML canvas API
33 lines • 1.04 kB
JavaScript
import { Spacing } from './Spacing.js';
import { BareWidgetXMLInputConfig } from '../xml/BareWidgetXMLInputConfig.js';
/**
* A {@link Spacing} with a colored background, where the color is the same as
* the theme's text color.
*
* @category Widget
*/
export class Separator extends Spacing {
constructor(properties) {
super(Object.assign({ minWidth: 1, minHeight: 1 }, properties));
}
onThemeUpdated(property = null) {
super.onThemeUpdated(property);
if (property === null || property === 'bodyTextFill') {
this.markWholeAsDirty();
}
}
handlePainting(dirtyRects) {
// Paint brackground
const ctx = this.viewport.context;
ctx.save();
ctx.fillStyle = this.bodyTextFill;
ctx.fillRect(this.x, this.y, this.idealWidth, this.idealHeight);
ctx.restore();
super.handlePainting(dirtyRects);
}
}
Separator.autoXML = {
name: 'separator',
inputConfig: BareWidgetXMLInputConfig
};
//# sourceMappingURL=Separator.js.map