| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- 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;
- };
- import { applyStyle, getShapeTheme } from '../../shape/utils';
- import { select } from '../../utils/selection';
- import { Advance } from './advance';
- /**
- * todo autoRotate when in polar coordinate
- */
- export const Text = (options) => {
- const style = __rest(options, []);
- return (points, value, coordinate, theme) => {
- const { mark, shape, defaultShape } = value;
- const shapeTheme = __rest(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 select(new Advance())
- .style('x', x0)
- .style('y', y0)
- .call(applyStyle, shapeTheme)
- .style('transform', `${transform}rotate(${+rotate})`)
- .style('coordCenter', coordinate.getCenter())
- .call(applyStyle, textStyle)
- .call(applyStyle, style)
- .node();
- };
- };
- Text.props = {
- defaultMarker: 'point',
- defaultEnterAnimation: 'fadeIn',
- defaultUpdateAnimation: 'morphing',
- defaultExitAnimation: 'fadeOut',
- };
- //# sourceMappingURL=text.js.map
|