| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- "use strict";
- var __rest = (this && this.__rest) || function (s, e) {
- var t = {};
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
- t[p] = s[p];
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
- t[p[i]] = s[p[i]];
- }
- return t;
- };
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.Text = void 0;
- const utils_1 = require("../../shape/utils");
- const selection_1 = require("../../utils/selection");
- const advance_1 = require("./advance");
- /**
- * todo autoRotate when in polar coordinate
- */
- const Text = (options) => {
- const style = __rest(options, []);
- return (points, value, coordinate, theme) => {
- const { mark, shape, defaultShape } = value;
- const shapeTheme = __rest((0, utils_1.getShapeTheme)(theme, mark, shape, defaultShape), []);
- const { color, text = '', fontSize, rotate = 0, transform = '' } = value;
- const textStyle = {
- text: String(text),
- stroke: color,
- fill: color,
- fontSize,
- };
- const [[x0, y0]] = points;
- return (0, selection_1.select)(new advance_1.Advance())
- .style('x', x0)
- .style('y', y0)
- .call(utils_1.applyStyle, shapeTheme)
- .style('transform', `${transform}rotate(${+rotate})`)
- .style('coordCenter', coordinate.getCenter())
- .call(utils_1.applyStyle, textStyle)
- .call(utils_1.applyStyle, style)
- .node();
- };
- };
- exports.Text = Text;
- exports.Text.props = {
- defaultMarker: 'point',
- defaultEnterAnimation: 'fadeIn',
- defaultUpdateAnimation: 'morphing',
- defaultExitAnimation: 'fadeOut',
- };
- //# sourceMappingURL=text.js.map
|