UNPKG

847 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.MaybeTuple = void 0;
4const util_1 = require("@antv/util");
5const helper_1 = require("./utils/helper");
6/**
7 * Add 3 constant encode for size channel.
8 * This is useful for point geometry.
9 */
10const MaybeTuple = () => {
11 return (I, mark) => {
12 const { data } = mark;
13 if (!Array.isArray(data) || data.some(helper_1.isObject))
14 return [I, mark];
15 const position = Array.isArray(data[0]) ? data : [data];
16 const X = position.map((d) => d[0]);
17 const Y = position.map((d) => d[1]);
18 return [I, (0, util_1.deepMix)({}, mark, { encode: { x: (0, helper_1.column)(X), y: (0, helper_1.column)(Y) } })];
19 };
20};
21exports.MaybeTuple = MaybeTuple;
22exports.MaybeTuple.props = {};
23//# sourceMappingURL=maybeTuple.js.map
\No newline at end of file