Circle.js 800 B

123456789101112131415161718192021222324252627282930
  1. import { __extends } from "tslib";
  2. import Path from '../Path';
  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, inBundle) {
  21. if (inBundle) {
  22. ctx.moveTo(shape.cx + shape.r, shape.cy);
  23. }
  24. ctx.arc(shape.cx, shape.cy, shape.r, 0, Math.PI * 2);
  25. };
  26. return Circle;
  27. }(Path));
  28. ;
  29. Circle.prototype.type = 'circle';
  30. export default Circle;