@visactor/vrender-components 0.14.6-alpha.1 → 0.14.6-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/cjs/index.d.ts +2 -1
  2. package/cjs/index.js +2 -2
  3. package/cjs/index.js.map +1 -1
  4. package/cjs/jsx/component-type.d.ts +4 -0
  5. package/cjs/jsx/component-type.js +14 -0
  6. package/cjs/jsx/component-type.js.map +1 -0
  7. package/cjs/jsx/index.d.ts +1 -0
  8. package/cjs/jsx/index.js +21 -0
  9. package/cjs/jsx/index.js.map +1 -0
  10. package/cjs/label/arc.d.ts +3 -6
  11. package/cjs/label/arc.js +1 -31
  12. package/cjs/label/arc.js.map +1 -1
  13. package/cjs/label/base.d.ts +9 -12
  14. package/cjs/label/base.js +130 -107
  15. package/cjs/label/base.js.map +1 -1
  16. package/cjs/label/dataLabel.js +4 -4
  17. package/cjs/label/dataLabel.js.map +1 -1
  18. package/cjs/label/type.d.ts +2 -4
  19. package/cjs/label/type.js.map +1 -1
  20. package/cjs/link-path/index.js +1 -2
  21. package/cjs/link-path/link-path.js +2 -1
  22. package/cjs/marker/point.js +1 -1
  23. package/cjs/util/labelSmartInvert.d.ts +0 -1
  24. package/cjs/util/labelSmartInvert.js +2 -20
  25. package/cjs/util/labelSmartInvert.js.map +1 -1
  26. package/dist/index.js +151 -163
  27. package/dist/index.min.js +1 -1
  28. package/es/index.d.ts +2 -1
  29. package/es/index.js +3 -1
  30. package/es/index.js.map +1 -1
  31. package/es/jsx/component-type.d.ts +4 -0
  32. package/es/jsx/component-type.js +6 -0
  33. package/es/jsx/component-type.js.map +1 -0
  34. package/es/jsx/index.d.ts +1 -0
  35. package/es/jsx/index.js +2 -0
  36. package/es/jsx/index.js.map +1 -0
  37. package/es/label/arc.d.ts +3 -6
  38. package/es/label/arc.js +0 -31
  39. package/es/label/arc.js.map +1 -1
  40. package/es/label/base.d.ts +9 -12
  41. package/es/label/base.js +127 -108
  42. package/es/label/base.js.map +1 -1
  43. package/es/label/dataLabel.js +3 -5
  44. package/es/label/dataLabel.js.map +1 -1
  45. package/es/label/type.d.ts +2 -4
  46. package/es/label/type.js.map +1 -1
  47. package/es/link-path/index.js +1 -2
  48. package/es/link-path/link-path.js +2 -1
  49. package/es/marker/point.js +1 -1
  50. package/es/util/labelSmartInvert.d.ts +0 -1
  51. package/es/util/labelSmartInvert.js +0 -17
  52. package/es/util/labelSmartInvert.js.map +1 -1
  53. package/package.json +2 -2
  54. package/cjs/label/polygon.d.ts +0 -12
  55. package/cjs/label/polygon.js +0 -35
  56. package/cjs/label/polygon.js.map +0 -1
  57. package/es/label/polygon.d.ts +0 -12
  58. package/es/label/polygon.js +0 -31
  59. package/es/label/polygon.js.map +0 -1
package/dist/index.js CHANGED
@@ -495,20 +495,6 @@
495
495
  const { r, g, b } = c.color;
496
496
  return '#' + vutils.ColorUtil.rgbToHex(r, g, b);
497
497
  }
498
- function smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor) {
499
- let result;
500
- switch (fillStrategy) {
501
- case 'base':
502
- result = baseColor;
503
- break;
504
- case 'invertBase':
505
- result = invertColor;
506
- break;
507
- case 'similarBase':
508
- result = similarColor;
509
- }
510
- return result;
511
- }
512
498
 
513
499
  function scale(vector, scale) {
514
500
  return [vector[0] * scale, vector[1] * scale];
@@ -1417,6 +1403,12 @@
1417
1403
  }
1418
1404
  return !bitmap.getRange(range);
1419
1405
  }
1406
+ function canPlaceInside(textBound, shapeBound) {
1407
+ if (!textBound || !shapeBound) {
1408
+ return false;
1409
+ }
1410
+ return shapeBound.encloses(textBound);
1411
+ }
1420
1412
  function placeToCandidates($, bitmap, text, candidates = [], clampForce = true) {
1421
1413
  for (let i = 0; i < candidates.length; i++) {
1422
1414
  const tempText = text.clone();
@@ -1540,14 +1532,8 @@
1540
1532
  };
1541
1533
 
1542
1534
  class LabelBase extends AbstractComponent {
1543
- setBitmap(bitmap) {
1544
- this._bitmap = bitmap;
1545
- }
1546
- setBitmapTool(bmpTool) {
1547
- this._bmpTool = bmpTool;
1548
- }
1549
- constructor(attributes) {
1550
- super(vutils.merge({}, LabelBase.defaultAttributes, attributes));
1535
+ constructor() {
1536
+ super(...arguments);
1551
1537
  this.name = 'label';
1552
1538
  this._onHover = (e) => {
1553
1539
  const target = e.target;
@@ -1595,11 +1581,15 @@
1595
1581
  }
1596
1582
  };
1597
1583
  }
1598
- labeling(textBounds, graphicBounds, position, offset) {
1599
- return;
1584
+ setBitmap(bitmap) {
1585
+ this._bitmap = bitmap;
1600
1586
  }
1601
- _labelLine(text) {
1602
- return;
1587
+ setBitmapTool(bmpTool) {
1588
+ this._bmpTool = bmpTool;
1589
+ }
1590
+ layoutArcLabels(position, attribute, currentMarks, data, textBoundsArray, ellipsisWidth) {
1591
+ const arcs = [];
1592
+ return arcs;
1603
1593
  }
1604
1594
  render() {
1605
1595
  this._prepare();
@@ -1613,7 +1603,7 @@
1613
1603
  labels = customLayoutFunc(data, (d) => this._idToGraphic.get(d.id));
1614
1604
  }
1615
1605
  else {
1616
- labels = this._layout(data);
1606
+ labels = this.layout(data);
1617
1607
  if (vutils.isFunction(customOverlapFunc)) {
1618
1608
  labels = customOverlapFunc(labels, (d) => this._idToGraphic.get(d.id));
1619
1609
  }
@@ -1689,24 +1679,49 @@
1689
1679
  }
1690
1680
  }
1691
1681
  }
1692
- _layout(data = []) {
1682
+ layout(data = []) {
1693
1683
  const { textStyle = {}, position, offset } = this.attribute;
1694
1684
  const labels = [];
1685
+ const textBoundsArray = [];
1695
1686
  for (let i = 0; i < data.length; i++) {
1696
1687
  const textData = data[i];
1697
1688
  const baseMark = this._idToGraphic.get(textData.id);
1698
1689
  const labelAttribute = Object.assign(Object.assign({ fill: baseMark.attribute.fill }, textStyle), textData);
1699
1690
  const text = this._createLabelText(labelAttribute);
1700
1691
  const textBounds = this.getGraphicBounds(text);
1692
+ textBoundsArray.push(textBounds);
1701
1693
  const graphicBounds = this.getGraphicBounds(baseMark, { x: textData.x, y: textData.y });
1702
1694
  const textLocation = this.labeling(textBounds, graphicBounds, vutils.isFunction(position) ? position(textData) : position, offset);
1703
- if (textLocation) {
1704
- labelAttribute.x = textLocation.x;
1705
- labelAttribute.y = textLocation.y;
1706
- text.setAttributes(textLocation);
1695
+ if (!textLocation) {
1696
+ continue;
1707
1697
  }
1698
+ labelAttribute.x = textLocation.x;
1699
+ labelAttribute.y = textLocation.y;
1700
+ text.setAttributes(textLocation);
1708
1701
  labels.push(text);
1709
1702
  }
1703
+ if (this.attribute.type === 'arc') {
1704
+ const ellipsisLabelAttribute = Object.assign(Object.assign({}, this.attribute.textStyle), { text: '...' });
1705
+ const ellipsisText = this._createLabelText(ellipsisLabelAttribute);
1706
+ const ellipsisTextBounds = this.getGraphicBounds(ellipsisText);
1707
+ const ellipsisWidth = ellipsisTextBounds.x2 - ellipsisTextBounds.x1;
1708
+ const arcs = this.layoutArcLabels(position, this.attribute, Array.from(this._idToGraphic.values()), data, textBoundsArray, ellipsisWidth);
1709
+ for (let i = 0; i < data.length; i++) {
1710
+ const textData = data[i];
1711
+ const basedArc = arcs.find(arc => arc.refDatum.id === textData.id);
1712
+ const labelAttribute = {
1713
+ visible: basedArc.labelVisible,
1714
+ x: basedArc.labelPosition.x,
1715
+ y: basedArc.labelPosition.y,
1716
+ angle: basedArc.angle,
1717
+ maxLineWidth: basedArc.labelLimit,
1718
+ points: (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointA) && (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointB) && (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointC)
1719
+ ? [basedArc.pointA, basedArc.pointB, basedArc.pointC]
1720
+ : undefined
1721
+ };
1722
+ labels[i].setAttributes(labelAttribute);
1723
+ }
1724
+ }
1710
1725
  return labels;
1711
1726
  }
1712
1727
  _overlapping(labels) {
@@ -1758,7 +1773,7 @@
1758
1773
  result.push(text);
1759
1774
  continue;
1760
1775
  }
1761
- if (checkBounds && (baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds) && this._canPlaceInside(text.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds)) {
1776
+ if (checkBounds && (baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds) && canPlaceInside(text.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds)) {
1762
1777
  bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
1763
1778
  result.push(text);
1764
1779
  continue;
@@ -1812,17 +1827,9 @@
1812
1827
  });
1813
1828
  }
1814
1829
  _renderLabels(labels) {
1815
- const disableAnimation = this._enableAnimation === false || this.attribute.animation === false;
1816
- if (disableAnimation) {
1817
- this._renderWithOutAnimation(labels);
1818
- }
1819
- else {
1820
- this._renderWithAnimation(labels);
1821
- }
1822
- }
1823
- _renderWithAnimation(labels) {
1824
1830
  var _a, _b, _c, _d, _e;
1825
1831
  const animationConfig = ((_a = this.attribute.animation) !== null && _a !== void 0 ? _a : {});
1832
+ const disableAnimation = this._enableAnimation === false || animationConfig === false;
1826
1833
  const mode = (_b = animationConfig.mode) !== null && _b !== void 0 ? _b : DefaultLabelAnimation.mode;
1827
1834
  const duration = (_c = animationConfig.duration) !== null && _c !== void 0 ? _c : DefaultLabelAnimation.duration;
1828
1835
  const easing = (_d = animationConfig.easing) !== null && _d !== void 0 ? _d : DefaultLabelAnimation.easing;
@@ -1831,18 +1838,27 @@
1831
1838
  const prevTextMap = this._graphicToText || new Map();
1832
1839
  const texts = [];
1833
1840
  labels.forEach((text, index) => {
1834
- var _a;
1835
- const labelLine = this._labelLine(text);
1841
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
1842
+ const labelLine = ((_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points)
1843
+ ? vrender.createLine({
1844
+ visible: (_c = (_b = text.attribute) === null || _b === void 0 ? void 0 : _b.visible) !== null && _c !== void 0 ? _c : true,
1845
+ stroke: (_f = (_e = (_d = text.attribute) === null || _d === void 0 ? void 0 : _d.line) === null || _e === void 0 ? void 0 : _e.stroke) !== null && _f !== void 0 ? _f : (_g = text.attribute) === null || _g === void 0 ? void 0 : _g.fill,
1846
+ lineWidth: (_k = (_j = (_h = text.attribute) === null || _h === void 0 ? void 0 : _h.line) === null || _j === void 0 ? void 0 : _j.lineWidth) !== null && _k !== void 0 ? _k : 1,
1847
+ points: (_l = text.attribute) === null || _l === void 0 ? void 0 : _l.points
1848
+ })
1849
+ : undefined;
1836
1850
  const relatedGraphic = this._idToGraphic.get(text.attribute.id);
1837
1851
  const state = (prevTextMap === null || prevTextMap === void 0 ? void 0 : prevTextMap.get(relatedGraphic)) ? 'update' : 'enter';
1838
1852
  if (state === 'enter') {
1839
1853
  texts.push(text);
1840
1854
  currentTextMap.set(relatedGraphic, labelLine ? { text, labelLine } : { text });
1841
- if (relatedGraphic) {
1855
+ if (!disableAnimation && relatedGraphic) {
1842
1856
  const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');
1843
1857
  this.add(text);
1844
- labelLine && this.add(labelLine);
1845
- relatedGraphic.once('animate-bind', () => {
1858
+ if (labelLine) {
1859
+ this.add(labelLine);
1860
+ }
1861
+ relatedGraphic.onAnimateBind = () => {
1846
1862
  text.setAttributes(from);
1847
1863
  const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, {
1848
1864
  mode,
@@ -1852,69 +1868,58 @@
1852
1868
  delay
1853
1869
  });
1854
1870
  relatedGraphic.on('afterAttributeUpdate', listener);
1855
- });
1871
+ };
1872
+ }
1873
+ else {
1874
+ this.add(text);
1875
+ if (labelLine) {
1876
+ this.add(labelLine);
1877
+ }
1856
1878
  }
1857
1879
  }
1858
- else if (state === 'update') {
1880
+ if (state === 'update') {
1859
1881
  const prevLabel = prevTextMap.get(relatedGraphic);
1860
1882
  prevTextMap.delete(relatedGraphic);
1861
1883
  currentTextMap.set(relatedGraphic, prevLabel);
1862
- const prevText = prevLabel.text;
1863
- prevText.animate().to(text.attribute, duration, easing);
1864
- if (prevLabel.labelLine) {
1865
- prevLabel.labelLine.animate().to(vutils.merge({}, prevLabel.labelLine.attribute, {
1866
- points: (_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points
1867
- }), duration, easing);
1884
+ if (!disableAnimation) {
1885
+ const prevText = prevLabel.text;
1886
+ prevText.animate().to(text.attribute, duration, easing);
1887
+ if (prevLabel.labelLine) {
1888
+ prevLabel.labelLine.animate().to(vutils.merge({}, prevLabel.labelLine.attribute, {
1889
+ points: (_m = text.attribute) === null || _m === void 0 ? void 0 : _m.points
1890
+ }), duration, easing);
1891
+ }
1892
+ if (animationConfig.increaseEffect !== false &&
1893
+ prevText.attribute.text !== text.attribute.text &&
1894
+ vutils.isValidNumber(Number(prevText.attribute.text) * Number(text.attribute.text))) {
1895
+ prevText
1896
+ .animate()
1897
+ .play(new vrender.IncreaseCount({ text: prevText.attribute.text }, { text: text.attribute.text }, duration, easing));
1898
+ }
1868
1899
  }
1869
- if (animationConfig.increaseEffect !== false &&
1870
- prevText.attribute.text !== text.attribute.text &&
1871
- vutils.isValidNumber(Number(prevText.attribute.text) * Number(text.attribute.text))) {
1872
- prevText
1873
- .animate()
1874
- .play(new vrender.IncreaseCount({ text: prevText.attribute.text }, { text: text.attribute.text }, duration, easing));
1900
+ else {
1901
+ prevLabel.text.setAttributes(text.attribute);
1902
+ if (prevLabel === null || prevLabel === void 0 ? void 0 : prevLabel.labelLine) {
1903
+ prevLabel.labelLine.setAttributes({ points: (_o = text.attribute) === null || _o === void 0 ? void 0 : _o.points });
1904
+ }
1875
1905
  }
1876
1906
  }
1877
1907
  });
1878
1908
  prevTextMap.forEach(label => {
1879
1909
  var _a;
1880
- (_a = label.text) === null || _a === void 0 ? void 0 : _a.animate().to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, duration, easing).onEnd(() => {
1910
+ if (disableAnimation) {
1881
1911
  this.removeChild(label.text);
1882
1912
  if (label === null || label === void 0 ? void 0 : label.labelLine) {
1883
1913
  this.removeChild(label.labelLine);
1884
1914
  }
1885
- });
1886
- });
1887
- this._graphicToText = currentTextMap;
1888
- }
1889
- _renderWithOutAnimation(labels) {
1890
- const currentTextMap = new Map();
1891
- const prevTextMap = this._graphicToText || new Map();
1892
- labels.forEach(text => {
1893
- var _a;
1894
- const labelLine = this._labelLine(text);
1895
- const relatedGraphic = this._idToGraphic.get(text.attribute.id);
1896
- const state = (prevTextMap === null || prevTextMap === void 0 ? void 0 : prevTextMap.get(relatedGraphic)) ? 'update' : 'enter';
1897
- if (state === 'enter') {
1898
- currentTextMap.set(relatedGraphic, labelLine ? { text, labelLine } : { text });
1899
- this.add(text);
1900
- if (labelLine) {
1901
- this.add(labelLine);
1902
- }
1903
- }
1904
- else if (state === 'update') {
1905
- const prevLabel = prevTextMap.get(relatedGraphic);
1906
- prevTextMap.delete(relatedGraphic);
1907
- currentTextMap.set(relatedGraphic, prevLabel);
1908
- prevLabel.text.setAttributes(text.attribute);
1909
- if (prevLabel === null || prevLabel === void 0 ? void 0 : prevLabel.labelLine) {
1910
- prevLabel.labelLine.setAttributes({ points: (_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points });
1911
- }
1912
1915
  }
1913
- });
1914
- prevTextMap.forEach(label => {
1915
- this.removeChild(label.text);
1916
- if (label === null || label === void 0 ? void 0 : label.labelLine) {
1917
- this.removeChild(label.labelLine);
1916
+ else {
1917
+ (_a = label.text) === null || _a === void 0 ? void 0 : _a.animate().to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, duration, easing).onEnd(() => {
1918
+ this.removeChild(label.text);
1919
+ if (label === null || label === void 0 ? void 0 : label.labelLine) {
1920
+ this.removeChild(label.labelLine);
1921
+ }
1922
+ });
1918
1923
  }
1919
1924
  });
1920
1925
  this._graphicToText = currentTextMap;
@@ -1985,20 +1990,21 @@
1985
1990
  continue;
1986
1991
  }
1987
1992
  const baseMark = this._idToGraphic.get(label.attribute.id);
1988
- const isInside = this._canPlaceInside(label.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds);
1993
+ let isInside = canPlaceInside(label.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds);
1994
+ if (this.attribute.type === 'arc') {
1995
+ isInside = this.attribute.position === 'inside';
1996
+ }
1989
1997
  const backgroundColor = baseMark.attribute.fill;
1990
1998
  const foregroundColor = label.attribute.fill;
1991
1999
  const baseColor = backgroundColor;
1992
2000
  const invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors);
1993
- const similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;
2001
+ const simialrColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;
1994
2002
  if (isInside) {
1995
- const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
1996
- fill && label.setAttributes({ fill });
2003
+ this.setFillStrategy(fillStrategy, label, baseColor, invertColor, simialrColor);
1997
2004
  if (label.attribute.lineWidth === 0) {
1998
2005
  continue;
1999
2006
  }
2000
- const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);
2001
- stroke && label.setAttributes({ stroke });
2007
+ this.setStrokeStrategy(strokeStrategy, label, baseColor, invertColor, simialrColor);
2002
2008
  }
2003
2009
  else {
2004
2010
  if (label.attribute.lineWidth === 0) {
@@ -2010,18 +2016,47 @@
2010
2016
  });
2011
2017
  continue;
2012
2018
  }
2013
- const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
2014
- fill && label.setAttributes({ fill });
2015
- const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);
2016
- stroke && label.setAttributes({ stroke });
2019
+ this.setFillStrategy(fillStrategy, label, baseColor, invertColor, simialrColor);
2020
+ this.setStrokeStrategy(strokeStrategy, label, baseColor, invertColor, simialrColor);
2017
2021
  }
2018
2022
  }
2019
2023
  }
2020
- _canPlaceInside(textBound, shapeBound) {
2021
- if (!textBound || !shapeBound) {
2022
- return false;
2024
+ setFillStrategy(fillStrategy, label, baseColor, invertColor, simialrColor) {
2025
+ switch (fillStrategy) {
2026
+ case 'base':
2027
+ label.setAttributes({
2028
+ fill: baseColor
2029
+ });
2030
+ break;
2031
+ case 'invertBase':
2032
+ label.setAttributes({
2033
+ fill: invertColor
2034
+ });
2035
+ break;
2036
+ case 'similarBase':
2037
+ label.setAttributes({
2038
+ fill: simialrColor
2039
+ });
2040
+ }
2041
+ }
2042
+ setStrokeStrategy(strokeStrategy, label, baseColor, invertColor, simialrColor) {
2043
+ switch (strokeStrategy) {
2044
+ case 'base':
2045
+ label.setAttributes({
2046
+ stroke: baseColor
2047
+ });
2048
+ break;
2049
+ case 'invertBase':
2050
+ label.setAttributes({
2051
+ stroke: invertColor
2052
+ });
2053
+ break;
2054
+ case 'similarBase':
2055
+ label.setAttributes({
2056
+ stroke: simialrColor
2057
+ });
2058
+ break;
2023
2059
  }
2024
- return shapeBound.encloses(textBound);
2025
2060
  }
2026
2061
  setLocation(point) {
2027
2062
  this.translateTo(point.x, point.y);
@@ -2033,17 +2068,6 @@
2033
2068
  this._enableAnimation = true;
2034
2069
  }
2035
2070
  }
2036
- LabelBase.defaultAttributes = {
2037
- textStyle: {
2038
- fontSize: 12,
2039
- fill: '#000',
2040
- textAlign: 'center',
2041
- textBaseline: 'middle',
2042
- boundsPadding: [-1, 0, -1, 0]
2043
- },
2044
- offset: 0,
2045
- pickable: false
2046
- };
2047
2071
 
2048
2072
  class SymbolLabel extends LabelBase {
2049
2073
  constructor(attributes) {
@@ -2398,31 +2422,6 @@
2398
2422
  }
2399
2423
  return { x: 0, y: 0 };
2400
2424
  }
2401
- _layout(data = []) {
2402
- const labels = super._layout(data);
2403
- const textBoundsArray = labels.map(label => this.getGraphicBounds(label));
2404
- const ellipsisLabelAttribute = Object.assign(Object.assign({}, this.attribute.textStyle), { text: '...' });
2405
- const ellipsisText = this._createLabelText(ellipsisLabelAttribute);
2406
- const ellipsisTextBounds = this.getGraphicBounds(ellipsisText);
2407
- const ellipsisWidth = ellipsisTextBounds.x2 - ellipsisTextBounds.x1;
2408
- const arcs = this.layoutArcLabels(this.attribute.position, this.attribute, Array.from(this._idToGraphic.values()), data, textBoundsArray, ellipsisWidth);
2409
- for (let i = 0; i < data.length; i++) {
2410
- const textData = data[i];
2411
- const basedArc = arcs.find(arc => arc.refDatum.id === textData.id);
2412
- const labelAttribute = {
2413
- visible: basedArc.labelVisible,
2414
- x: basedArc.labelPosition.x,
2415
- y: basedArc.labelPosition.y,
2416
- angle: basedArc.angle,
2417
- maxLineWidth: basedArc.labelLimit,
2418
- points: (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointA) && (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointB) && (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointC)
2419
- ? [basedArc.pointA, basedArc.pointB, basedArc.pointC]
2420
- : undefined
2421
- };
2422
- labels[i].setAttributes(labelAttribute);
2423
- }
2424
- return labels;
2425
- }
2426
2425
  layoutArcLabels(position, attribute, currentMarks, data, textBoundsArray, ellipsisWidth) {
2427
2426
  var _a;
2428
2427
  this._arcLeft.clear();
@@ -2989,18 +2988,6 @@
2989
2988
  }
2990
2989
  }
2991
2990
  }
2992
- _labelLine(text) {
2993
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
2994
- const labelLine = ((_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points)
2995
- ? vrender.createLine({
2996
- visible: (_c = (_b = text.attribute) === null || _b === void 0 ? void 0 : _b.visible) !== null && _c !== void 0 ? _c : true,
2997
- stroke: (_f = (_e = (_d = text.attribute) === null || _d === void 0 ? void 0 : _d.line) === null || _e === void 0 ? void 0 : _e.stroke) !== null && _f !== void 0 ? _f : (_g = text.attribute) === null || _g === void 0 ? void 0 : _g.fill,
2998
- lineWidth: (_k = (_j = (_h = text.attribute) === null || _h === void 0 ? void 0 : _h.line) === null || _j === void 0 ? void 0 : _j.lineWidth) !== null && _k !== void 0 ? _k : 1,
2999
- points: (_l = text.attribute) === null || _l === void 0 ? void 0 : _l.points
3000
- })
3001
- : undefined;
3002
- return labelLine;
3003
- }
3004
2991
  computeRadius(r, width, height, centerOffset, k) {
3005
2992
  var _a;
3006
2993
  return ((_a = this.computeLayoutRadius(width ? width : 0, height ? height : 0) * r * (vutils.isNil(k) ? 1 : k) + centerOffset) !== null && _a !== void 0 ? _a : 0);
@@ -3008,9 +2995,6 @@
3008
2995
  computeLayoutRadius(width, height) {
3009
2996
  return Math.min(width / 2, height / 2);
3010
2997
  }
3011
- _canPlaceInside(textBound, shapeBound) {
3012
- return this.attribute.position === 'inside';
3013
- }
3014
2998
  computeLayoutOuterRadius(r, width, height) {
3015
2999
  return r / (Math.min(width, height) / 2);
3016
3000
  }
@@ -3075,8 +3059,7 @@
3075
3059
  const prevComponentMap = this._componentMap;
3076
3060
  for (let i = 0; i < dataLabels.length; i++) {
3077
3061
  const dataLabel = dataLabels[i];
3078
- const labelComponent = labelComponentMap[dataLabel.type] || LabelBase;
3079
- if (labelComponent) {
3062
+ if (labelComponentMap[dataLabel.type]) {
3080
3063
  const { baseMarkGroupName } = dataLabel;
3081
3064
  let component = this._componentMap.get(baseMarkGroupName);
3082
3065
  if (component) {
@@ -3086,7 +3069,7 @@
3086
3069
  currentComponentMap.set(baseMarkGroupName, component);
3087
3070
  }
3088
3071
  else {
3089
- component = new labelComponent(dataLabel);
3072
+ component = new labelComponentMap[dataLabel.type](dataLabel);
3090
3073
  component.setBitmap(bitmap);
3091
3074
  component.setBitmapTool(tool);
3092
3075
  this.add(component);
@@ -10136,7 +10119,11 @@
10136
10119
  }
10137
10120
  Tooltip.defaultAttributes = defaultAttributes;
10138
10121
 
10139
- const version = "0.14.6-alpha.1";
10122
+ function VTag(params) {
10123
+ return new Tag(params ? params.attribute : {});
10124
+ }
10125
+
10126
+ const version = "0.14.6-alpha.3";
10140
10127
 
10141
10128
  exports.AbstractComponent = AbstractComponent;
10142
10129
  exports.ArcInfo = ArcInfo;
@@ -10187,6 +10174,7 @@
10187
10174
  exports.Tag = Tag;
10188
10175
  exports.Title = Title;
10189
10176
  exports.Tooltip = Tooltip;
10177
+ exports.VTag = VTag;
10190
10178
  exports.getHorizontalPath = getHorizontalPath;
10191
10179
  exports.getSizeHandlerPath = getSizeHandlerPath;
10192
10180
  exports.getVerticalPath = getVerticalPath;