circle.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * @fileoverview circle
  3. * @author dengfuping_develop@163.com
  4. */
  5. import { __assign, __extends } from "tslib";
  6. import { each } from '@antv/util';
  7. import { SVG_ATTR_MAP } from '../constant';
  8. import ShapeBase from './base';
  9. var Circle = /** @class */ (function (_super) {
  10. __extends(Circle, _super);
  11. function Circle() {
  12. var _this = _super !== null && _super.apply(this, arguments) || this;
  13. _this.type = 'circle';
  14. _this.canFill = true;
  15. _this.canStroke = true;
  16. return _this;
  17. }
  18. Circle.prototype.getDefaultAttrs = function () {
  19. var attrs = _super.prototype.getDefaultAttrs.call(this);
  20. return __assign(__assign({}, attrs), { x: 0, y: 0, r: 0 });
  21. };
  22. Circle.prototype.createPath = function (context, targetAttrs) {
  23. var attrs = this.attr();
  24. var el = this.get('el');
  25. each(targetAttrs || attrs, function (value, attr) {
  26. // 圆和椭圆的点坐标属性不是 x, y,而是 cx, cy
  27. if (attr === 'x' || attr === 'y') {
  28. el.setAttribute("c" + attr, value);
  29. }
  30. else if (SVG_ATTR_MAP[attr]) {
  31. el.setAttribute(SVG_ATTR_MAP[attr], value);
  32. }
  33. });
  34. };
  35. return Circle;
  36. }(ShapeBase));
  37. export default Circle;
  38. //# sourceMappingURL=circle.js.map