[d565449] | 1 | "use strict";
|
---|
| 2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 3 | exports.Ellipse = void 0;
|
---|
| 4 | const Factory_1 = require("../Factory");
|
---|
| 5 | const Shape_1 = require("../Shape");
|
---|
| 6 | const Validators_1 = require("../Validators");
|
---|
| 7 | const Global_1 = require("../Global");
|
---|
| 8 | class Ellipse extends Shape_1.Shape {
|
---|
| 9 | _sceneFunc(context) {
|
---|
| 10 | var rx = this.radiusX(), ry = this.radiusY();
|
---|
| 11 | context.beginPath();
|
---|
| 12 | context.save();
|
---|
| 13 | if (rx !== ry) {
|
---|
| 14 | context.scale(1, ry / rx);
|
---|
| 15 | }
|
---|
| 16 | context.arc(0, 0, rx, 0, Math.PI * 2, false);
|
---|
| 17 | context.restore();
|
---|
| 18 | context.closePath();
|
---|
| 19 | context.fillStrokeShape(this);
|
---|
| 20 | }
|
---|
| 21 | getWidth() {
|
---|
| 22 | return this.radiusX() * 2;
|
---|
| 23 | }
|
---|
| 24 | getHeight() {
|
---|
| 25 | return this.radiusY() * 2;
|
---|
| 26 | }
|
---|
| 27 | setWidth(width) {
|
---|
| 28 | this.radiusX(width / 2);
|
---|
| 29 | }
|
---|
| 30 | setHeight(height) {
|
---|
| 31 | this.radiusY(height / 2);
|
---|
| 32 | }
|
---|
| 33 | }
|
---|
| 34 | exports.Ellipse = Ellipse;
|
---|
| 35 | Ellipse.prototype.className = 'Ellipse';
|
---|
| 36 | Ellipse.prototype._centroid = true;
|
---|
| 37 | Ellipse.prototype._attrsAffectingSize = ['radiusX', 'radiusY'];
|
---|
| 38 | (0, Global_1._registerNode)(Ellipse);
|
---|
| 39 | Factory_1.Factory.addComponentsGetterSetter(Ellipse, 'radius', ['x', 'y']);
|
---|
| 40 | Factory_1.Factory.addGetterSetter(Ellipse, 'radiusX', 0, (0, Validators_1.getNumberValidator)());
|
---|
| 41 | Factory_1.Factory.addGetterSetter(Ellipse, 'radiusY', 0, (0, Validators_1.getNumberValidator)());
|
---|