"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 Text = /*#__PURE__*/function (_GuideBase) { _inheritsLoose(Text, _GuideBase); function Text() { return _GuideBase.apply(this, arguments) || this; } var _proto = Text.prototype; _proto._initDefaultCfg = function _initDefaultCfg() { this.type = 'text'; /** * the position of text * @type {Function | Array} */ this.position = null; /** * the display content * @type {String} */ this.content = null; /** * style configuration for text * @type {Object} */ this.style = { fill: '#000' }; /** * offset of horizontal direction * @type {Number} */ this.offsetX = 0; /** * offset of vertical direction * @type {Number} */ this.offsetY = 0; }; _proto.render = function render(coord, container) { var position = this.position; var point = this.parsePoint(coord, position); if (!point) { return; } var content = this.content, style = this.style, offsetX = this.offsetX, offsetY = this.offsetY; if (offsetX) { point.x += offsetX; } if (offsetY) { point.y += offsetY; } var shape = container.addShape('text', { className: 'guide-text', attrs: (0, _common.mix)({ x: point.x, y: point.y, text: content }, style) }); this.element = shape; return shape; }; return Text; }(_base["default"]); _base["default"].Text = Text; var _default = Text; exports["default"] = _default;