| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- 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 Rect =
- /*#__PURE__*/
- function (_GuideBase) {
- _inheritsLoose(Rect, _GuideBase);
- function Rect() {
- return _GuideBase.apply(this, arguments) || this;
- }
- var _proto = Rect.prototype;
- _proto._initDefaultCfg = function _initDefaultCfg() {
- this.type = 'rect';
- this.start = [];
- this.end = [];
- this.style = {
- fill: '#CCD7EB',
- opacity: 0.4
- };
- };
- _proto.render = function render(coord, container) {
- var start = this.parsePoint(coord, this.start);
- var end = this.parsePoint(coord, this.end);
- if (!start || !end) {
- return;
- }
- var shape = container.addShape('rect', {
- className: 'guide-rect',
- attrs: Util.mix({
- x: Math.min(start.x, end.x),
- y: Math.min(start.y, end.y),
- width: Math.abs(end.x - start.x),
- height: Math.abs(start.y - end.y)
- }, this.style)
- });
- this.element = shape;
- return shape;
- };
- return Rect;
- }(GuideBase);
- GuideBase.Rect = Rect;
- module.exports = Rect;
|