point.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. "use strict";
  2. exports.__esModule = true;
  3. exports["default"] = void 0;
  4. var _common = require("../../util/common");
  5. var _base = _interopRequireDefault(require("./base"));
  6. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  7. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
  8. var Point = /*#__PURE__*/function (_GuideBase) {
  9. _inheritsLoose(Point, _GuideBase);
  10. function Point() {
  11. return _GuideBase.apply(this, arguments) || this;
  12. }
  13. var _proto = Point.prototype;
  14. _proto._initDefaultCfg = function _initDefaultCfg() {
  15. this.type = 'point';
  16. this.position = null;
  17. this.offsetX = 0;
  18. this.offsetY = 0;
  19. this.style = {
  20. fill: '#1890FF',
  21. r: 3,
  22. lineWidth: 1,
  23. stroke: '#fff'
  24. };
  25. };
  26. _proto.render = function render(coord, container) {
  27. var position = this.parsePoint(coord, this.position);
  28. if (!position) return null;
  29. var shape = container.addShape('Circle', {
  30. className: 'guide-point',
  31. attrs: (0, _common.mix)({
  32. x: position.x + this.offsetX,
  33. y: position.y + this.offsetY
  34. }, this.style)
  35. });
  36. this.element = shape;
  37. return shape;
  38. };
  39. return Point;
  40. }(_base["default"]);
  41. _base["default"].Point = Point;
  42. var _default = Point;
  43. exports["default"] = _default;