UNPKG

1.36 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var tslib_1 = require("tslib");
4var util_1 = require("@antv/util");
5var base_1 = (0, tslib_1.__importDefault)(require("./base"));
6/**
7 * @ignore
8 * 多个点构成的 Path 辅助框 Action
9 */
10var PathMask = /** @class */ (function (_super) {
11 (0, tslib_1.__extends)(PathMask, _super);
12 function PathMask() {
13 return _super !== null && _super.apply(this, arguments) || this;
14 }
15 // 生成 mask 的路径
16 PathMask.prototype.getMaskPath = function () {
17 var points = this.points;
18 var path = [];
19 if (points.length) {
20 (0, util_1.each)(points, function (point, index) {
21 if (index === 0) {
22 path.push(['M', point.x, point.y]);
23 }
24 else {
25 path.push(['L', point.x, point.y]);
26 }
27 });
28 path.push(['L', points[0].x, points[0].y]);
29 }
30 return path;
31 };
32 PathMask.prototype.getMaskAttrs = function () {
33 return {
34 path: this.getMaskPath(),
35 };
36 };
37 /**
38 * 添加一个点
39 */
40 PathMask.prototype.addPoint = function () {
41 this.resize();
42 };
43 return PathMask;
44}(base_1.default));
45exports.default = PathMask;
46//# sourceMappingURL=path.js.map
\No newline at end of file