UNPKG

cione-comp-lib

Version:

`$ yarn add cione-comp-lib` 或者 `$ npm i cione-comp-lib -S`

40 lines (39 loc) 1.13 kB
import { __extends } from "../../../../tslib/tslib.es6.mjs"; import Path from "../Path.mjs"; var EllipseShape = function() { function EllipseShape2() { this.cx = 0; this.cy = 0; this.rx = 0; this.ry = 0; } return EllipseShape2; }(); var Ellipse = function(_super) { __extends(Ellipse2, _super); function Ellipse2(opts) { return _super.call(this, opts) || this; } Ellipse2.prototype.getDefaultShape = function() { return new EllipseShape(); }; Ellipse2.prototype.buildPath = function(ctx, shape) { var k = 0.5522848; var x = shape.cx; var y = shape.cy; var a = shape.rx; var b = shape.ry; var ox = a * k; var oy = b * k; ctx.moveTo(x - a, y); ctx.bezierCurveTo(x - a, y - oy, x - ox, y - b, x, y - b); ctx.bezierCurveTo(x + ox, y - b, x + a, y - oy, x + a, y); ctx.bezierCurveTo(x + a, y + oy, x + ox, y + b, x, y + b); ctx.bezierCurveTo(x - ox, y + b, x - a, y + oy, x - a, y); ctx.closePath(); }; return Ellipse2; }(Path); Ellipse.prototype.type = "ellipse"; var Ellipse$1 = Ellipse; export { EllipseShape, Ellipse$1 as default };