UNPKG

1 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 = require("./base");
6var Position = /** @class */ (function (_super) {
7 tslib_1.__extends(Position, _super);
8 function Position(cfg) {
9 var _this = _super.call(this, cfg) || this;
10 _this.names = ['x', 'y'];
11 _this.type = 'position';
12 return _this;
13 }
14 Position.prototype.mapping = function (x, y) {
15 var _a = this.scales, scaleX = _a[0], scaleY = _a[1];
16 if ((0, util_1.isNil)(x) || (0, util_1.isNil)(y)) {
17 return [];
18 }
19 return [
20 (0, util_1.isArray)(x) ? x.map(function (xi) { return scaleX.scale(xi); }) : scaleX.scale(x),
21 (0, util_1.isArray)(y) ? y.map(function (yi) { return scaleY.scale(yi); }) : scaleY.scale(y),
22 ];
23 };
24 return Position;
25}(base_1.default));
26exports.default = Position;
27//# sourceMappingURL=position.js.map
\No newline at end of file