source: imaps-frontend/node_modules/konva/lib/shapes/Ellipse.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.4 KB
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.Ellipse = void 0;
4const Factory_1 = require("../Factory");
5const Shape_1 = require("../Shape");
6const Validators_1 = require("../Validators");
7const Global_1 = require("../Global");
8class 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}
34exports.Ellipse = Ellipse;
35Ellipse.prototype.className = 'Ellipse';
36Ellipse.prototype._centroid = true;
37Ellipse.prototype._attrsAffectingSize = ['radiusX', 'radiusY'];
38(0, Global_1._registerNode)(Ellipse);
39Factory_1.Factory.addComponentsGetterSetter(Ellipse, 'radius', ['x', 'y']);
40Factory_1.Factory.addGetterSetter(Ellipse, 'radiusX', 0, (0, Validators_1.getNumberValidator)());
41Factory_1.Factory.addGetterSetter(Ellipse, 'radiusY', 0, (0, Validators_1.getNumberValidator)());
Note: See TracBrowser for help on using the repository browser.