[d565449] | 1 | "use strict";
|
---|
| 2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 3 | exports.Wedge = void 0;
|
---|
| 4 | const Factory_1 = require("../Factory");
|
---|
| 5 | const Shape_1 = require("../Shape");
|
---|
| 6 | const Global_1 = require("../Global");
|
---|
| 7 | const Validators_1 = require("../Validators");
|
---|
| 8 | const Global_2 = require("../Global");
|
---|
| 9 | class Wedge extends Shape_1.Shape {
|
---|
| 10 | _sceneFunc(context) {
|
---|
| 11 | context.beginPath();
|
---|
| 12 | context.arc(0, 0, this.radius(), 0, Global_1.Konva.getAngle(this.angle()), this.clockwise());
|
---|
| 13 | context.lineTo(0, 0);
|
---|
| 14 | context.closePath();
|
---|
| 15 | context.fillStrokeShape(this);
|
---|
| 16 | }
|
---|
| 17 | getWidth() {
|
---|
| 18 | return this.radius() * 2;
|
---|
| 19 | }
|
---|
| 20 | getHeight() {
|
---|
| 21 | return this.radius() * 2;
|
---|
| 22 | }
|
---|
| 23 | setWidth(width) {
|
---|
| 24 | this.radius(width / 2);
|
---|
| 25 | }
|
---|
| 26 | setHeight(height) {
|
---|
| 27 | this.radius(height / 2);
|
---|
| 28 | }
|
---|
| 29 | }
|
---|
| 30 | exports.Wedge = Wedge;
|
---|
| 31 | Wedge.prototype.className = 'Wedge';
|
---|
| 32 | Wedge.prototype._centroid = true;
|
---|
| 33 | Wedge.prototype._attrsAffectingSize = ['radius'];
|
---|
| 34 | (0, Global_2._registerNode)(Wedge);
|
---|
| 35 | Factory_1.Factory.addGetterSetter(Wedge, 'radius', 0, (0, Validators_1.getNumberValidator)());
|
---|
| 36 | Factory_1.Factory.addGetterSetter(Wedge, 'angle', 0, (0, Validators_1.getNumberValidator)());
|
---|
| 37 | Factory_1.Factory.addGetterSetter(Wedge, 'clockwise', false);
|
---|
| 38 | Factory_1.Factory.backCompat(Wedge, {
|
---|
| 39 | angleDeg: 'angle',
|
---|
| 40 | getAngleDeg: 'getAngle',
|
---|
| 41 | setAngleDeg: 'setAngle',
|
---|
| 42 | });
|
---|