var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { property } from '../../decorators.js';
import { Color } from '../../types/color.js';
import { PartComponent } from '../../component.js';
import { degreesToRadians } from '../../../util/conversions.js';
export class ButtonComponent extends PartComponent {
    constructor() {
        super(...arguments);
        this.label = 'Click Me!';
        this.backgroundColor = '#FF8F00';
        this.textColor = '#FFFFFF';
    }
    render(ctx, el) {
        const height = el.clientHeight;
        const halfHeight = height / 2;
        // circle on left side
        ctx.beginPath();
        ctx.arc(halfHeight, halfHeight, halfHeight, degreesToRadians(90), degreesToRadians(270));
        ctx.fill();
        ctx.closePath();
        // circle on right side
        ctx.beginPath();
        ctx.arc((el.clientWidth) - halfHeight, halfHeight, halfHeight, degreesToRadians(270), degreesToRadians(450));
        ctx.fill();
        ctx.closePath();
        // Main body of button
        ctx.fillRect(halfHeight - 1, 0, (el.clientWidth - height) + 2, height);
        // Text for button - values are a little hacked in because rendering the padding isn't accurate 
        // TODO: Find solution for opacity not rendering text perfectly
        ctx.fillStyle = el.style.color || '#ffffff';
        ctx.font = "16px Bariol";
        ctx.fillText(el.textContent || '', halfHeight - 2, 6 + (halfHeight));
    }
}
__decorate([
    property({ type: String, value: 'Click Me!' })
], ButtonComponent.prototype, "label", void 0);
__decorate([
    property({ type: Color, value: '#FF8F00' })
], ButtonComponent.prototype, "backgroundColor", void 0);
__decorate([
    property({ type: Color, value: '#FFFFFF' })
], ButtonComponent.prototype, "textColor", void 0);
//# sourceMappingURL=button-component.js.map