"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Ellipse = void 0; const Factory_1 = require("../Factory"); const Shape_1 = require("../Shape"); const Validators_1 = require("../Validators"); const Global_1 = require("../Global"); class Ellipse extends Shape_1.Shape { _sceneFunc(context) { var rx = this.radiusX(), ry = this.radiusY(); context.beginPath(); context.save(); if (rx !== ry) { context.scale(1, ry / rx); } context.arc(0, 0, rx, 0, Math.PI * 2, false); context.restore(); context.closePath(); context.fillStrokeShape(this); } getWidth() { return this.radiusX() * 2; } getHeight() { return this.radiusY() * 2; } setWidth(width) { this.radiusX(width / 2); } setHeight(height) { this.radiusY(height / 2); } } exports.Ellipse = Ellipse; Ellipse.prototype.className = 'Ellipse'; Ellipse.prototype._centroid = true; Ellipse.prototype._attrsAffectingSize = ['radiusX', 'radiusY']; (0, Global_1._registerNode)(Ellipse); Factory_1.Factory.addComponentsGetterSetter(Ellipse, 'radius', ['x', 'y']); Factory_1.Factory.addGetterSetter(Ellipse, 'radiusX', 0, (0, Validators_1.getNumberValidator)()); Factory_1.Factory.addGetterSetter(Ellipse, 'radiusY', 0, (0, Validators_1.getNumberValidator)());