"use strict"; exports.__esModule = true; exports["default"] = void 0; var _common = require("../../util/common"); var _base = _interopRequireDefault(require("./base")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } var Arc = /*#__PURE__*/function (_GuideBase) { _inheritsLoose(Arc, _GuideBase); function Arc() { return _GuideBase.apply(this, arguments) || this; } var _proto = Arc.prototype; _proto._initDefaultCfg = function _initDefaultCfg() { this.type = 'arc'; /** * start point * @type {Array | Function} */ this.start = []; /** * end point * @type {Array | Function} */ this.end = []; /** * style configuration * @type {Object} */ this.style = { stroke: '#999', lineWidth: 1 }; }; _proto.render = function render(coord, container) { var self = this; var start = self.parsePoint(coord, self.start); var end = self.parsePoint(coord, self.end); if (!start || !end) { return; } var coordCenter = coord.center; var radius = Math.sqrt((start.x - coordCenter.x) * (start.x - coordCenter.x) + (start.y - coordCenter.y) * (start.y - coordCenter.y)); var startAngle = Math.atan2(start.y - coordCenter.y, start.x - coordCenter.x); var endAngle = Math.atan2(end.y - coordCenter.y, end.x - coordCenter.x); var shape = container.addShape('arc', { className: 'guide-arc', attrs: (0, _common.mix)({ x: coordCenter.x, y: coordCenter.y, r: radius, startAngle: startAngle, endAngle: endAngle }, self.style) }); self.element = shape; return shape; }; return Arc; }(_base["default"]); _base["default"].Arc = Arc; var _default = Arc; exports["default"] = _default;