| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- 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 Arc =
- /*#__PURE__*/
- function (_Shape) {
- _inheritsLoose(Arc, _Shape);
- function Arc() {
- return _Shape.apply(this, arguments) || this;
- }
- var _proto = Arc.prototype;
- _proto._initProperties = function _initProperties() {
- _Shape.prototype._initProperties.call(this);
- this._attrs.canStroke = true;
- this._attrs.canFill = true;
- this._attrs.type = 'arc';
- };
- _proto.getDefaultAttrs = function getDefaultAttrs() {
- return {
- x: 0,
- y: 0,
- r: 0,
- startAngle: 0,
- endAngle: Math.PI * 2,
- clockwise: false,
- lineWidth: 1
- };
- };
- _proto.createPath = function createPath(context) {
- var attrs = this.get('attrs');
- var x = attrs.x,
- y = attrs.y,
- r = attrs.r,
- startAngle = attrs.startAngle,
- endAngle = attrs.endAngle,
- clockwise = attrs.clockwise;
- context.beginPath();
- context.arc(x, y, r, startAngle, endAngle, clockwise);
- };
- _proto.calculateBox = function calculateBox() {
- var attrs = this.get('attrs');
- var x = attrs.x,
- y = attrs.y,
- r = attrs.r,
- startAngle = attrs.startAngle,
- endAngle = attrs.endAngle,
- clockwise = attrs.clockwise;
- return bbox.getBBoxFromArc(x, y, r, startAngle, endAngle, clockwise);
- };
- return Arc;
- }(Shape);
- Shape.Arc = Arc;
- module.exports = Arc;
|