Circle.js 755 B

12345678910111213141516171819202122232425262728
  1. import { __extends } from "tslib";
  2. import Path from '../Path.js';
  3. var CircleShape = (function () {
  4. function CircleShape() {
  5. this.cx = 0;
  6. this.cy = 0;
  7. this.r = 0;
  8. }
  9. return CircleShape;
  10. }());
  11. export { CircleShape };
  12. var Circle = (function (_super) {
  13. __extends(Circle, _super);
  14. function Circle(opts) {
  15. return _super.call(this, opts) || this;
  16. }
  17. Circle.prototype.getDefaultShape = function () {
  18. return new CircleShape();
  19. };
  20. Circle.prototype.buildPath = function (ctx, shape) {
  21. ctx.moveTo(shape.cx + shape.r, shape.cy);
  22. ctx.arc(shape.cx, shape.cy, shape.r, 0, Math.PI * 2);
  23. };
  24. return Circle;
  25. }(Path));
  26. ;
  27. Circle.prototype.type = 'circle';
  28. export default Circle;