function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } var Shape = require('../shape'); var bbox = require('../util/bbox'); var Polygon = /*#__PURE__*/ function (_Shape) { _inheritsLoose(Polygon, _Shape); function Polygon() { return _Shape.apply(this, arguments) || this; } var _proto = Polygon.prototype; _proto._initProperties = function _initProperties() { _Shape.prototype._initProperties.call(this); this._attrs.canFill = true; this._attrs.canStroke = true; this._attrs.type = 'polygon'; }; _proto.getDefaultAttrs = function getDefaultAttrs() { return { points: null, lineWidth: 0 }; }; _proto.createPath = function createPath(context) { var self = this; var attrs = self.get('attrs'); var points = attrs.points; context.beginPath(); for (var i = 0, len = points.length; i < len; i++) { var point = points[i]; if (i === 0) { context.moveTo(point.x, point.y); } else { context.lineTo(point.x, point.y); } } context.closePath(); }; _proto.calculateBox = function calculateBox() { var attrs = this.get('attrs'); var points = attrs.points; return bbox.getBBoxFromPoints(points); }; return Polygon; }(Shape); Shape.Polygon = Polygon; module.exports = Polygon;