Initial commit
This commit is contained in:
37
node_modules/konva/cmj/shapes/Circle.js
generated
vendored
Normal file
37
node_modules/konva/cmj/shapes/Circle.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Circle = void 0;
|
||||
const Factory_1 = require("../Factory");
|
||||
const Shape_1 = require("../Shape");
|
||||
const Validators_1 = require("../Validators");
|
||||
const Global_1 = require("../Global");
|
||||
class Circle extends Shape_1.Shape {
|
||||
_sceneFunc(context) {
|
||||
context.beginPath();
|
||||
context.arc(0, 0, this.attrs.radius || 0, 0, Math.PI * 2, false);
|
||||
context.closePath();
|
||||
context.fillStrokeShape(this);
|
||||
}
|
||||
getWidth() {
|
||||
return this.radius() * 2;
|
||||
}
|
||||
getHeight() {
|
||||
return this.radius() * 2;
|
||||
}
|
||||
setWidth(width) {
|
||||
if (this.radius() !== width / 2) {
|
||||
this.radius(width / 2);
|
||||
}
|
||||
}
|
||||
setHeight(height) {
|
||||
if (this.radius() !== height / 2) {
|
||||
this.radius(height / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Circle = Circle;
|
||||
Circle.prototype._centroid = true;
|
||||
Circle.prototype.className = 'Circle';
|
||||
Circle.prototype._attrsAffectingSize = ['radius'];
|
||||
(0, Global_1._registerNode)(Circle);
|
||||
Factory_1.Factory.addGetterSetter(Circle, 'radius', 0, (0, Validators_1.getNumberValidator)());
|
||||
Reference in New Issue
Block a user