"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const namespaceURI_1 = require("../../../../../client/component/namespaceURI");
const element_1 = require("../../../../../client/element");
const style_1 = require("../../../../../client/style");
class SVGLine extends element_1.Element {
    constructor($props, $system) {
        super($props, $system);
        const { className, style = {}, x1 = 0, y1 = 0, x2 = 0, y2 = 0 } = $props;
        const line_el = this.$system.api.document.createElementNS(namespaceURI_1.namespaceURI, 'line');
        if (className !== undefined) {
            line_el.classList.value = className;
        }
        (0, style_1.applyStyle)(line_el, style);
        line_el.setAttribute('x1', `${x1}`);
        line_el.setAttribute('y1', `${y1}`);
        line_el.setAttribute('x2', `${x2}`);
        line_el.setAttribute('y2', `${y2}`);
        this._line_el = line_el;
        this.$element = line_el;
    }
    onPropChanged(prop, current) {
        if (prop === 'className') {
            this._line_el.className.value = current;
        }
        else if (prop === 'style') {
            (0, style_1.applyStyle)(this._line_el, current);
        }
        else if (prop === 'x1' ||
            prop === 'y1' ||
            prop === 'x2' ||
            prop === 'y2') {
            this._line_el.setAttribute(prop, `${current}`);
        }
    }
}
exports.default = SVGLine;
//# sourceMappingURL=Component.js.map