1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | exports.Ring = 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 | var PIx2 = Math.PI * 2;
|
---|
9 | class Ring extends Shape_1.Shape {
|
---|
10 | _sceneFunc(context) {
|
---|
11 | context.beginPath();
|
---|
12 | context.arc(0, 0, this.innerRadius(), 0, PIx2, false);
|
---|
13 | context.moveTo(this.outerRadius(), 0);
|
---|
14 | context.arc(0, 0, this.outerRadius(), PIx2, 0, true);
|
---|
15 | context.closePath();
|
---|
16 | context.fillStrokeShape(this);
|
---|
17 | }
|
---|
18 | getWidth() {
|
---|
19 | return this.outerRadius() * 2;
|
---|
20 | }
|
---|
21 | getHeight() {
|
---|
22 | return this.outerRadius() * 2;
|
---|
23 | }
|
---|
24 | setWidth(width) {
|
---|
25 | this.outerRadius(width / 2);
|
---|
26 | }
|
---|
27 | setHeight(height) {
|
---|
28 | this.outerRadius(height / 2);
|
---|
29 | }
|
---|
30 | }
|
---|
31 | exports.Ring = Ring;
|
---|
32 | Ring.prototype.className = 'Ring';
|
---|
33 | Ring.prototype._centroid = true;
|
---|
34 | Ring.prototype._attrsAffectingSize = ['innerRadius', 'outerRadius'];
|
---|
35 | (0, Global_1._registerNode)(Ring);
|
---|
36 | Factory_1.Factory.addGetterSetter(Ring, 'innerRadius', 0, (0, Validators_1.getNumberValidator)());
|
---|
37 | Factory_1.Factory.addGetterSetter(Ring, 'outerRadius', 0, (0, Validators_1.getNumberValidator)());
|
---|