@antv/f2
Version:
Charts for mobile visualization.
42 lines (41 loc) • 1.14 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _tslib = require("tslib");
var _fEngine = require("@antv/f-engine");
var _util = require("@antv/util");
var _default = exports.default = function _default(props, context) {
var _a = props.theme,
theme = _a === void 0 ? {} : _a;
var _b = (0, _util.deepMix)((0, _tslib.__assign)({}, theme.text), props),
points = _b.points,
style = _b.style,
offsetX = _b.offsetX,
offsetY = _b.offsetY,
content = _b.content,
animation = _b.animation;
var _c = points[0] || {},
x = _c.x,
y = _c.y;
if (isNaN(x) || isNaN(y)) return null;
var offsetXNum = context.px2hd(offsetX);
var offsetYNum = context.px2hd(offsetY);
var posX = x + (offsetXNum || 0);
var posY = y + (offsetYNum || 0);
return (0, _fEngine.jsx)("text", {
attrs: (0, _tslib.__assign)({
text: "".concat(content),
x: posX,
y: posY
}, style),
animation: (0, _util.deepMix)({
update: {
easing: 'linear',
duration: 450,
property: ['x', 'y']
}
}, animation)
});
};
;