@antv/g2
Version:
the Grammar of Graphics in Javascript
46 lines • 1.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("./base"));
/**
* @ignore
* 多个点构成的 Path 辅助框 Action
*/
var PathMask = /** @class */ (function (_super) {
tslib_1.__extends(PathMask, _super);
function PathMask() {
return _super !== null && _super.apply(this, arguments) || this;
}
// 生成 mask 的路径
PathMask.prototype.getMaskPath = function () {
var points = this.points;
var path = [];
if (points.length) {
(0, util_1.each)(points, function (point, index) {
if (index === 0) {
path.push(['M', point.x, point.y]);
}
else {
path.push(['L', point.x, point.y]);
}
});
path.push(['L', points[0].x, points[0].y]);
}
return path;
};
PathMask.prototype.getMaskAttrs = function () {
return {
path: this.getMaskPath(),
};
};
/**
* 添加一个点
*/
PathMask.prototype.addPoint = function () {
this.resize();
};
return PathMask;
}(base_1.default));
exports.default = PathMask;
//# sourceMappingURL=path.js.map