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 { PartComponent } from '../../component.js';
import { EventEmitter } from '@kano/common/index.js';
export class SliderComponent extends PartComponent {
    constructor() {
        super(...arguments);
        this.value = 0;
        this.changed = new EventEmitter();
    }
    render(ctx, el) {
        const inputEl = el;
        const value = inputEl.value && parseInt(inputEl.value) > 0 ? parseInt(inputEl.value) / 100 * inputEl.clientWidth : 0;
        ctx.fillStyle = '#8c8c8c';
        ctx.strokeStyle = '#444444';
        ctx.lineWidth = 1;
        ctx.beginPath();
        ctx.rect(0, 0, inputEl.clientWidth, 4);
        ctx.fill();
        ctx.stroke();
        ctx.closePath();
        ctx.strokeStyle = '#666666';
        ctx.fillStyle = '#dddddd';
        ctx.beginPath();
        ctx.arc(value, 2, 8, 0, 2 * Math.PI);
        ctx.fill();
        ctx.stroke();
        ctx.closePath();
    }
}
__decorate([
    property({ type: Number, value: 0 })
], SliderComponent.prototype, "value", void 0);
__decorate([
    property({ type: EventEmitter, value: new EventEmitter(), noReset: true })
], SliderComponent.prototype, "changed", void 0);
//# sourceMappingURL=slider-component.js.map