| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
- var Util = require('../../util/common');
- var GuideBase = require('./base');
- var Line =
- /*#__PURE__*/
- function (_GuideBase) {
- _inheritsLoose(Line, _GuideBase);
- function Line() {
- return _GuideBase.apply(this, arguments) || this;
- }
- var _proto = Line.prototype;
- _proto._initDefaultCfg = function _initDefaultCfg() {
- this.type = 'line';
- this.start = [];
- this.end = [];
- this.style = {
- stroke: '#000',
- lineWidth: 1
- };
- };
- _proto.render = function render(coord, container) {
- var points = [];
- points[0] = this.parsePoint(coord, this.start);
- points[1] = this.parsePoint(coord, this.end);
- if (!points[0] || !points[1]) {
- return;
- }
- var shape = container.addShape('Line', {
- className: 'guide-line',
- attrs: Util.mix({
- x1: points[0].x,
- y1: points[0].y,
- x2: points[1].x,
- y2: points[1].y
- }, this.style)
- });
- this.element = shape;
- return shape;
- };
- return Line;
- }(GuideBase);
- GuideBase.Line = Line;
- module.exports = Line;
|