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.1 KB
|
Rev | Line | |
---|
[d565449] | 1 | "use strict";
|
---|
| 2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 3 | exports.Circle = 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 Circle extends Shape_1.Shape {
|
---|
| 9 | _sceneFunc(context) {
|
---|
| 10 | context.beginPath();
|
---|
| 11 | context.arc(0, 0, this.attrs.radius || 0, 0, Math.PI * 2, false);
|
---|
| 12 | context.closePath();
|
---|
| 13 | context.fillStrokeShape(this);
|
---|
| 14 | }
|
---|
| 15 | getWidth() {
|
---|
| 16 | return this.radius() * 2;
|
---|
| 17 | }
|
---|
| 18 | getHeight() {
|
---|
| 19 | return this.radius() * 2;
|
---|
| 20 | }
|
---|
| 21 | setWidth(width) {
|
---|
| 22 | if (this.radius() !== width / 2) {
|
---|
| 23 | this.radius(width / 2);
|
---|
| 24 | }
|
---|
| 25 | }
|
---|
| 26 | setHeight(height) {
|
---|
| 27 | if (this.radius() !== height / 2) {
|
---|
| 28 | this.radius(height / 2);
|
---|
| 29 | }
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
| 32 | exports.Circle = Circle;
|
---|
| 33 | Circle.prototype._centroid = true;
|
---|
| 34 | Circle.prototype.className = 'Circle';
|
---|
| 35 | Circle.prototype._attrsAffectingSize = ['radius'];
|
---|
| 36 | (0, Global_1._registerNode)(Circle);
|
---|
| 37 | Factory_1.Factory.addGetterSetter(Circle, 'radius', 0, (0, Validators_1.getNumberValidator)());
|
---|
Note:
See
TracBrowser
for help on using the repository browser.