UNPKG

1 kBJavaScriptView Raw
1import { __extends } from "tslib";
2import Path from '../Path.js';
3var DropletShape = (function () {
4 function DropletShape() {
5 this.cx = 0;
6 this.cy = 0;
7 this.width = 0;
8 this.height = 0;
9 }
10 return DropletShape;
11}());
12export { DropletShape };
13var Droplet = (function (_super) {
14 __extends(Droplet, _super);
15 function Droplet(opts) {
16 return _super.call(this, opts) || this;
17 }
18 Droplet.prototype.getDefaultShape = function () {
19 return new DropletShape();
20 };
21 Droplet.prototype.buildPath = function (ctx, shape) {
22 var x = shape.cx;
23 var y = shape.cy;
24 var a = shape.width;
25 var b = shape.height;
26 ctx.moveTo(x, y + a);
27 ctx.bezierCurveTo(x + a, y + a, x + a * 3 / 2, y - a / 3, x, y - b);
28 ctx.bezierCurveTo(x - a * 3 / 2, y - a / 3, x - a, y + a, x, y + a);
29 ctx.closePath();
30 };
31 return Droplet;
32}(Path));
33Droplet.prototype.type = 'droplet';
34export default Droplet;