@visactor/vrender-components 0.14.6-alpha.8 → 0.14.6-alpha.9

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 (99) hide show
  1. package/cjs/axis/line.js +1 -50
  2. package/cjs/axis/line.js.map +1 -1
  3. package/cjs/axis/overlap/auto-rotate.js +2 -2
  4. package/cjs/axis/overlap/auto-rotate.js.map +1 -1
  5. package/cjs/axis/type.d.ts +0 -1
  6. package/cjs/axis/type.js.map +1 -1
  7. package/cjs/brush/brush.d.ts +0 -1
  8. package/cjs/brush/brush.js +0 -5
  9. package/cjs/brush/brush.js.map +1 -1
  10. package/cjs/index.d.ts +2 -1
  11. package/cjs/index.js +2 -2
  12. package/cjs/index.js.map +1 -1
  13. package/cjs/jsx/component-type.d.ts +4 -0
  14. package/cjs/jsx/component-type.js +14 -0
  15. package/cjs/jsx/component-type.js.map +1 -0
  16. package/cjs/jsx/index.d.ts +1 -0
  17. package/cjs/jsx/index.js +21 -0
  18. package/cjs/jsx/index.js.map +1 -0
  19. package/cjs/label/arc.d.ts +3 -6
  20. package/cjs/label/arc.js +1 -31
  21. package/cjs/label/arc.js.map +1 -1
  22. package/cjs/label/base.d.ts +9 -12
  23. package/cjs/label/base.js +134 -117
  24. package/cjs/label/base.js.map +1 -1
  25. package/cjs/label/dataLabel.js +4 -4
  26. package/cjs/label/dataLabel.js.map +1 -1
  27. package/cjs/label/overlap/place.d.ts +2 -2
  28. package/cjs/label/overlap/place.js +8 -15
  29. package/cjs/label/overlap/place.js.map +1 -1
  30. package/cjs/label/rect.js.map +1 -1
  31. package/cjs/label/symbol.js.map +1 -1
  32. package/cjs/label/type.d.ts +2 -5
  33. package/cjs/label/type.js.map +1 -1
  34. package/cjs/link-path/index.js +1 -2
  35. package/cjs/link-path/link-path.js +2 -1
  36. package/cjs/marker/point.js +1 -1
  37. package/cjs/poptip/poptip.js +20 -7
  38. package/cjs/poptip/poptip.js.map +1 -1
  39. package/cjs/poptip/register.js +6 -4
  40. package/cjs/poptip/register.js.map +1 -1
  41. package/cjs/util/labelSmartInvert.d.ts +0 -1
  42. package/cjs/util/labelSmartInvert.js +2 -20
  43. package/cjs/util/labelSmartInvert.js.map +1 -1
  44. package/cjs/util/text.js +3 -3
  45. package/cjs/util/text.js.map +1 -1
  46. package/dist/index.js +222 -314
  47. package/dist/index.min.js +1 -1
  48. package/es/axis/line.js +2 -50
  49. package/es/axis/line.js.map +1 -1
  50. package/es/axis/overlap/auto-rotate.js +2 -2
  51. package/es/axis/overlap/auto-rotate.js.map +1 -1
  52. package/es/axis/type.d.ts +0 -1
  53. package/es/axis/type.js.map +1 -1
  54. package/es/brush/brush.d.ts +0 -1
  55. package/es/brush/brush.js +0 -5
  56. package/es/brush/brush.js.map +1 -1
  57. package/es/index.d.ts +2 -1
  58. package/es/index.js +3 -1
  59. package/es/index.js.map +1 -1
  60. package/es/jsx/component-type.d.ts +4 -0
  61. package/es/jsx/component-type.js +6 -0
  62. package/es/jsx/component-type.js.map +1 -0
  63. package/es/jsx/index.d.ts +1 -0
  64. package/es/jsx/index.js +2 -0
  65. package/es/jsx/index.js.map +1 -0
  66. package/es/label/arc.d.ts +3 -6
  67. package/es/label/arc.js +0 -31
  68. package/es/label/arc.js.map +1 -1
  69. package/es/label/base.d.ts +9 -12
  70. package/es/label/base.js +132 -118
  71. package/es/label/base.js.map +1 -1
  72. package/es/label/dataLabel.js +3 -5
  73. package/es/label/dataLabel.js.map +1 -1
  74. package/es/label/overlap/place.d.ts +2 -2
  75. package/es/label/overlap/place.js +8 -15
  76. package/es/label/overlap/place.js.map +1 -1
  77. package/es/label/rect.js.map +1 -1
  78. package/es/label/symbol.js.map +1 -1
  79. package/es/label/type.d.ts +2 -5
  80. package/es/label/type.js.map +1 -1
  81. package/es/link-path/index.js +1 -2
  82. package/es/link-path/link-path.js +2 -1
  83. package/es/marker/point.js +1 -1
  84. package/es/poptip/poptip.js +19 -6
  85. package/es/poptip/poptip.js.map +1 -1
  86. package/es/poptip/register.js +6 -4
  87. package/es/poptip/register.js.map +1 -1
  88. package/es/util/labelSmartInvert.d.ts +0 -1
  89. package/es/util/labelSmartInvert.js +0 -17
  90. package/es/util/labelSmartInvert.js.map +1 -1
  91. package/es/util/text.js +3 -3
  92. package/es/util/text.js.map +1 -1
  93. package/package.json +2 -2
  94. package/cjs/label/polygon.d.ts +0 -12
  95. package/cjs/label/polygon.js +0 -35
  96. package/cjs/label/polygon.js.map +0 -1
  97. package/es/label/polygon.d.ts +0 -12
  98. package/es/label/polygon.js +0 -31
  99. package/es/label/polygon.js.map +0 -1
package/dist/index.js CHANGED
@@ -310,14 +310,14 @@
310
310
  scrollRange: [0, 1]
311
311
  };
312
312
 
313
- function _typeof(o) {
313
+ function _typeof(obj) {
314
314
  "@babel/helpers - typeof";
315
315
 
316
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
317
- return typeof o;
318
- } : function (o) {
319
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
320
- }, _typeof(o);
316
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
317
+ return typeof obj;
318
+ } : function (obj) {
319
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
320
+ }, _typeof(obj);
321
321
  }
322
322
 
323
323
  function __rest(s, e) {
@@ -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];
@@ -575,16 +561,16 @@
575
561
  }, getTextBounds: useNaiveCanvas ? undefined : vrender.getTextBounds, specialCharSet: '-/: .,@%\'"~' + vutils.TextMeasure.ALPHABET_CHAR_SET + vutils.TextMeasure.ALPHABET_CHAR_SET.toUpperCase() }, (option !== null && option !== void 0 ? option : {})), textSpec);
576
562
  };
577
563
  function measureTextSize(text, textSpec) {
578
- var _a, _b;
564
+ var _a;
579
565
  if (!text) {
580
566
  return { width: 0, height: 0 };
581
567
  }
582
568
  const bounds = vrender.getTextBounds({
583
569
  text,
584
- fontFamily: (_a = textSpec.fontFamily) !== null && _a !== void 0 ? _a : '',
570
+ fontFamily: textSpec.fontFamily,
585
571
  fontSize: textSpec.fontSize || 12,
586
572
  fontWeight: textSpec.fontWeight,
587
- textAlign: (_b = textSpec.textAlign) !== null && _b !== void 0 ? _b : 'center',
573
+ textAlign: (_a = textSpec.textAlign) !== null && _a !== void 0 ? _a : 'center',
588
574
  textBaseline: textSpec.textBaseline,
589
575
  ellipsis: !!textSpec.ellipsis,
590
576
  maxLineWidth: textSpec.maxLineWidth || Infinity,
@@ -717,14 +703,14 @@
717
703
  this.positionList = ['top', 'tl', 'tr', 'bottom', 'bl', 'br', 'left', 'lt', 'lb', 'right', 'rt', 'rb'];
718
704
  }
719
705
  render() {
720
- var _a, _b, _c, _d, _e;
706
+ var _a, _b, _c, _d, _e, _f, _g;
721
707
  const { title = '', titleStyle = {}, position, content = '', contentStyle = {}, panel = {}, space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, visible, state, dx = 0, dy = 0 } = this.attribute;
722
708
  const parsedPadding = vutils.normalizePadding(padding);
723
709
  const group = this.createOrUpdateChild('poptip-content', { x: 0, y: 0, zIndex: 1 }, 'group');
724
710
  const maxLineWidth = maxWidth - parsedPadding[1] - parsedPadding[3];
725
711
  const titleVisible = vutils.isValid(title) && visible !== false;
726
- const titleAttrs = Object.assign(Object.assign({ text: title, visible: titleVisible }, titleStyle), { x: parsedPadding[3], y: parsedPadding[0], maxLineWidth, textAlign: 'left', textBaseline: 'top' });
727
- const titleShape = group.createOrUpdateChild('poptip-title', titleAttrs, 'text');
712
+ const titleAttrs = Object.assign(Object.assign({ text: vutils.isArray(title) ? title : [title], visible: titleVisible }, titleStyle), { x: parsedPadding[3], y: parsedPadding[0], maxLineWidth, textAlign: 'left', textBaseline: 'top' });
713
+ const titleShape = group.createOrUpdateChild('poptip-title', titleAttrs, 'wrapText');
728
714
  if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.title)) {
729
715
  titleShape.states = state.title;
730
716
  }
@@ -736,8 +722,8 @@
736
722
  height = 0;
737
723
  }
738
724
  const contentVisible = vutils.isValid(content) && visible !== false;
739
- const contentAttrs = Object.assign(Object.assign({ text: content, visible: contentVisible }, contentStyle), { x: parsedPadding[3], y: parsedPadding[0] + height, maxLineWidth, textAlign: 'left', textBaseline: 'top' });
740
- const contentShape = group.createOrUpdateChild('poptip-content', contentAttrs, 'text');
725
+ const contentAttrs = Object.assign(Object.assign({ text: vutils.isArray(content) ? content : [content], visible: contentVisible }, contentStyle), { x: parsedPadding[3], y: parsedPadding[0] + height, maxLineWidth, textAlign: 'left', textBaseline: 'top' });
726
+ const contentShape = group.createOrUpdateChild('poptip-content', contentAttrs, 'wrapText');
741
727
  if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.content)) {
742
728
  contentShape.states = state.content;
743
729
  }
@@ -754,7 +740,7 @@
754
740
  else if (popTipWidth < minWidth) {
755
741
  popTipWidth = minWidth;
756
742
  }
757
- const poptipHeight = parsedPadding[0] + parsedPadding[2] + height;
743
+ let poptipHeight = parsedPadding[0] + parsedPadding[2] + height;
758
744
  const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
759
745
  const symbolSize = (_a = backgroundStyle.size) !== null && _a !== void 0 ? _a : 12;
760
746
  const spaceSize = vutils.isArray(symbolSize)
@@ -762,8 +748,29 @@
762
748
  : symbolSize + ((_d = backgroundStyle.space) !== null && _d !== void 0 ? _d : 0);
763
749
  const lineWidth = (_e = backgroundStyle.lineWidth) !== null && _e !== void 0 ? _e : 1;
764
750
  const range = this.stage
765
- ? [this.stage.width, this.stage.height]
751
+ ? [
752
+ (_f = this.stage.viewWidth) !== null && _f !== void 0 ? _f : this.stage.width,
753
+ (_g = this.stage.viewHeight) !== null && _g !== void 0 ? _g : this.stage.height
754
+ ]
766
755
  : undefined;
756
+ if (range) {
757
+ const b = this.AABBBounds;
758
+ const leftWidth = b.x1;
759
+ const rightWidth = range[0] - b.x1;
760
+ let maxSpace = Math.max(leftWidth, rightWidth);
761
+ maxSpace = Math.max(maxSpace - 10, maxSpace * 0.7);
762
+ if (maxSpace < popTipWidth) {
763
+ popTipWidth = maxSpace;
764
+ const buf = parsedPadding[1] + parsedPadding[3];
765
+ titleShape.setAttribute('maxLineWidth', maxSpace - buf);
766
+ contentShape.setAttribute('maxLineWidth', maxSpace - buf);
767
+ poptipHeight = parsedPadding[0] + parsedPadding[2];
768
+ if (titleVisible) {
769
+ poptipHeight += titleShape.AABBBounds.height() + space;
770
+ }
771
+ poptipHeight += contentShape.AABBBounds.height();
772
+ }
773
+ }
767
774
  const layout = position === 'auto';
768
775
  let maxBBoxI;
769
776
  let maxBBoxSize = -Infinity;
@@ -1070,13 +1077,20 @@
1070
1077
  injectable()
1071
1078
  ], PopTipForClipedTextPlugin);
1072
1079
 
1073
- const popTipModule = new ContainerModule(bind => {
1074
- bind(PopTipRenderContribution).toSelf().inSingletonScope();
1075
- bind(vrender.InteractiveSubRenderContribution).toService(PopTipRenderContribution);
1076
- bind(PopTipPlugin).toSelf().inSingletonScope();
1077
- bind(vrender.AutoEnablePlugins).toService(PopTipPlugin);
1078
- bind(PopTipForClipedTextPlugin).toSelf().inSingletonScope();
1079
- bind(vrender.AutoEnablePlugins).toService(PopTipForClipedTextPlugin);
1080
+ const popTipModule = new ContainerModule((bind, unbind, isBound, rebind) => {
1081
+ if (!isBound(PopTipRenderContribution) || !isBound(PopTipPlugin) || !isBound(PopTipForClipedTextPlugin)) {
1082
+ bind(PopTipRenderContribution).toSelf().inSingletonScope();
1083
+ bind(vrender.InteractiveSubRenderContribution).toService(PopTipRenderContribution);
1084
+ bind(PopTipPlugin).toSelf();
1085
+ bind(vrender.AutoEnablePlugins).toService(PopTipPlugin);
1086
+ bind(PopTipForClipedTextPlugin).toSelf();
1087
+ bind(vrender.AutoEnablePlugins).toService(PopTipForClipedTextPlugin);
1088
+ }
1089
+ else {
1090
+ rebind(PopTipRenderContribution).toSelf().inSingletonScope();
1091
+ rebind(PopTipPlugin).toSelf();
1092
+ rebind(PopTipForClipedTextPlugin).toSelf();
1093
+ }
1080
1094
  });
1081
1095
  function loadPoptip(defaultPoptipTheme) {
1082
1096
  vutils.merge(theme.poptip, defaultPoptipTheme);
@@ -1409,29 +1423,26 @@
1409
1423
  };
1410
1424
  }
1411
1425
 
1412
- function canPlace($, bitmap, bound, checkBound = true, pad = 0) {
1413
- let range = bound;
1414
- if (pad > 0) {
1415
- range = {
1416
- x1: bound.x1 - pad,
1417
- x2: bound.x2 + pad,
1418
- y1: bound.y1 - pad,
1419
- y2: bound.y2 + pad
1420
- };
1421
- }
1422
- range = boundToRange($, range);
1426
+ function canPlace($, bitmap, bound, checkBound = true) {
1427
+ const range = boundToRange($, bound);
1423
1428
  const outOfBounds = checkBound && bitmap.outOfBounds(range);
1424
1429
  if (outOfBounds) {
1425
1430
  return false;
1426
1431
  }
1427
1432
  return !bitmap.getRange(range);
1428
1433
  }
1429
- function placeToCandidates($, bitmap, text, candidates = [], clampForce = true, pad = 0) {
1434
+ function canPlaceInside(textBound, shapeBound) {
1435
+ if (!textBound || !shapeBound) {
1436
+ return false;
1437
+ }
1438
+ return shapeBound.encloses(textBound);
1439
+ }
1440
+ function placeToCandidates($, bitmap, text, candidates = [], clampForce = true) {
1430
1441
  for (let i = 0; i < candidates.length; i++) {
1431
1442
  const tempText = text.clone();
1432
1443
  tempText.setAttributes(candidates[i]);
1433
1444
  tempText.update();
1434
- if (canPlace($, bitmap, boundToRange($, tempText.AABBBounds), clampForce, pad)) {
1445
+ if (canPlace($, bitmap, boundToRange($, tempText.AABBBounds), clampForce)) {
1435
1446
  bitmap.setRange(boundToRange($, tempText.AABBBounds, true));
1436
1447
  return candidates[i];
1437
1448
  }
@@ -1439,15 +1450,13 @@
1439
1450
  return false;
1440
1451
  }
1441
1452
  function place($, bitmap, s, attrs, text, bounds, labeling) {
1442
- var _a, _b;
1443
- const clampForce = (_a = attrs.overlap) === null || _a === void 0 ? void 0 : _a.clampForce;
1444
- const overlapPadding = (_b = attrs.overlap) === null || _b === void 0 ? void 0 : _b.overlapPadding;
1453
+ var _a, _b, _c;
1445
1454
  if (s.type === 'bound' || s.type === 'position') {
1446
1455
  if (vutils.isFunction(labeling)) {
1447
1456
  const userPosition = vutils.isFunction(s.position) ? s.position(text.attribute) : s.position;
1448
1457
  const positions = (userPosition || defaultLabelPosition(attrs.type));
1449
1458
  const candidates = positions.map(p => labeling(text.AABBBounds, bounds, p, attrs.offset));
1450
- return placeToCandidates($, bitmap, text, candidates, clampForce, overlapPadding);
1459
+ return placeToCandidates($, bitmap, text, candidates, (_a = attrs.overlap) === null || _a === void 0 ? void 0 : _a.clampForce);
1451
1460
  }
1452
1461
  return false;
1453
1462
  }
@@ -1456,14 +1465,14 @@
1456
1465
  const candidates = offset.map(dy => {
1457
1466
  return { x: text.attribute.x, y: text.attribute.y + dy };
1458
1467
  });
1459
- return placeToCandidates($, bitmap, text, candidates, clampForce, overlapPadding);
1468
+ return placeToCandidates($, bitmap, text, candidates, (_b = attrs.overlap) === null || _b === void 0 ? void 0 : _b.clampForce);
1460
1469
  }
1461
1470
  if (s.type === 'moveX') {
1462
1471
  const offset = s.offset ? (vutils.isFunction(s.offset) ? s.offset(text.attribute) : s.offset) : [];
1463
1472
  const candidates = offset.map(dx => {
1464
1473
  return { x: text.attribute.x + dx, y: text.attribute.y };
1465
1474
  });
1466
- return placeToCandidates($, bitmap, text, candidates, clampForce, overlapPadding);
1475
+ return placeToCandidates($, bitmap, text, candidates, (_c = attrs.overlap) === null || _c === void 0 ? void 0 : _c.clampForce);
1467
1476
  }
1468
1477
  return false;
1469
1478
  }
@@ -1551,14 +1560,8 @@
1551
1560
  };
1552
1561
 
1553
1562
  class LabelBase extends AbstractComponent {
1554
- setBitmap(bitmap) {
1555
- this._bitmap = bitmap;
1556
- }
1557
- setBitmapTool(bmpTool) {
1558
- this._bmpTool = bmpTool;
1559
- }
1560
- constructor(attributes) {
1561
- super(vutils.merge({}, LabelBase.defaultAttributes, attributes));
1563
+ constructor() {
1564
+ super(...arguments);
1562
1565
  this.name = 'label';
1563
1566
  this._onHover = (e) => {
1564
1567
  const target = e.target;
@@ -1606,11 +1609,15 @@
1606
1609
  }
1607
1610
  };
1608
1611
  }
1609
- labeling(textBounds, graphicBounds, position, offset) {
1610
- return;
1612
+ setBitmap(bitmap) {
1613
+ this._bitmap = bitmap;
1611
1614
  }
1612
- _labelLine(text) {
1613
- return;
1615
+ setBitmapTool(bmpTool) {
1616
+ this._bmpTool = bmpTool;
1617
+ }
1618
+ layoutArcLabels(position, attribute, currentMarks, data, textBoundsArray, ellipsisWidth) {
1619
+ const arcs = [];
1620
+ return arcs;
1614
1621
  }
1615
1622
  render() {
1616
1623
  this._prepare();
@@ -1624,14 +1631,14 @@
1624
1631
  labels = customLayoutFunc(data, (d) => this._idToGraphic.get(d.id));
1625
1632
  }
1626
1633
  else {
1627
- labels = this._layout(data);
1628
- }
1629
- if (vutils.isFunction(customOverlapFunc)) {
1630
- labels = customOverlapFunc(labels, (d) => this._idToGraphic.get(d.id));
1631
- }
1632
- else {
1633
- if (overlap !== false) {
1634
- labels = this._overlapping(labels);
1634
+ labels = this.layout(data);
1635
+ if (vutils.isFunction(customOverlapFunc)) {
1636
+ labels = customOverlapFunc(labels, (d) => this._idToGraphic.get(d.id));
1637
+ }
1638
+ else {
1639
+ if (overlap !== false) {
1640
+ labels = this._overlapping(labels);
1641
+ }
1635
1642
  }
1636
1643
  }
1637
1644
  if (smartInvert !== false) {
@@ -1700,24 +1707,49 @@
1700
1707
  }
1701
1708
  }
1702
1709
  }
1703
- _layout(data = []) {
1710
+ layout(data = []) {
1704
1711
  const { textStyle = {}, position, offset } = this.attribute;
1705
1712
  const labels = [];
1713
+ const textBoundsArray = [];
1706
1714
  for (let i = 0; i < data.length; i++) {
1707
1715
  const textData = data[i];
1708
1716
  const baseMark = this._idToGraphic.get(textData.id);
1709
1717
  const labelAttribute = Object.assign(Object.assign({ fill: baseMark.attribute.fill }, textStyle), textData);
1710
1718
  const text = this._createLabelText(labelAttribute);
1711
1719
  const textBounds = this.getGraphicBounds(text);
1720
+ textBoundsArray.push(textBounds);
1712
1721
  const graphicBounds = this.getGraphicBounds(baseMark, { x: textData.x, y: textData.y });
1713
1722
  const textLocation = this.labeling(textBounds, graphicBounds, vutils.isFunction(position) ? position(textData) : position, offset);
1714
- if (textLocation) {
1715
- labelAttribute.x = textLocation.x;
1716
- labelAttribute.y = textLocation.y;
1717
- text.setAttributes(textLocation);
1723
+ if (!textLocation) {
1724
+ continue;
1718
1725
  }
1726
+ labelAttribute.x = textLocation.x;
1727
+ labelAttribute.y = textLocation.y;
1728
+ text.setAttributes(textLocation);
1719
1729
  labels.push(text);
1720
1730
  }
1731
+ if (this.attribute.type === 'arc') {
1732
+ const ellipsisLabelAttribute = Object.assign(Object.assign({}, this.attribute.textStyle), { text: '...' });
1733
+ const ellipsisText = this._createLabelText(ellipsisLabelAttribute);
1734
+ const ellipsisTextBounds = this.getGraphicBounds(ellipsisText);
1735
+ const ellipsisWidth = ellipsisTextBounds.x2 - ellipsisTextBounds.x1;
1736
+ const arcs = this.layoutArcLabels(position, this.attribute, Array.from(this._idToGraphic.values()), data, textBoundsArray, ellipsisWidth);
1737
+ for (let i = 0; i < data.length; i++) {
1738
+ const textData = data[i];
1739
+ const basedArc = arcs.find(arc => arc.refDatum.id === textData.id);
1740
+ const labelAttribute = {
1741
+ visible: basedArc.labelVisible,
1742
+ x: basedArc.labelPosition.x,
1743
+ y: basedArc.labelPosition.y,
1744
+ angle: basedArc.angle,
1745
+ maxLineWidth: basedArc.labelLimit,
1746
+ 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)
1747
+ ? [basedArc.pointA, basedArc.pointB, basedArc.pointC]
1748
+ : undefined
1749
+ };
1750
+ labels[i].setAttributes(labelAttribute);
1751
+ }
1752
+ }
1721
1753
  return labels;
1722
1754
  }
1723
1755
  _overlapping(labels) {
@@ -1735,7 +1767,7 @@
1735
1767
  if (size.width === 0 || size.height === 0) {
1736
1768
  return labels;
1737
1769
  }
1738
- const { avoidBaseMark, strategy = [], hideOnHit = true, clampForce = true, avoidMarks = [], overlapPadding } = option;
1770
+ const { avoidBaseMark, strategy = [], hideOnHit = true, clampForce = true, avoidMarks = [] } = option;
1739
1771
  const bmpTool = this._bmpTool || bitmapTool(size.width, size.height);
1740
1772
  const bitmap = this._bitmap || bmpTool.bitmap();
1741
1773
  const checkBounds = strategy.some(s => s.type === 'bound');
@@ -1763,16 +1795,13 @@
1763
1795
  const text = labels[i];
1764
1796
  const baseMark = this._idToGraphic.get(text.attribute.id);
1765
1797
  text.update();
1766
- if (!vutils.isRectIntersect(baseMark.AABBBounds, { x1: 0, x2: bmpTool.width, y1: 0, y2: bmpTool.height }, true)) {
1767
- continue;
1768
- }
1769
- if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce, overlapPadding)) {
1798
+ if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce)) {
1770
1799
  if (!checkBounds) {
1771
1800
  bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
1772
1801
  result.push(text);
1773
1802
  continue;
1774
1803
  }
1775
- if (checkBounds && (baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds) && this._canPlaceInside(text.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds)) {
1804
+ if (checkBounds && (baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds) && canPlaceInside(text.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds)) {
1776
1805
  bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
1777
1806
  result.push(text);
1778
1807
  continue;
@@ -1795,7 +1824,7 @@
1795
1824
  x2: text.AABBBounds.x2 + dx,
1796
1825
  y1: text.AABBBounds.y1 + dy,
1797
1826
  y2: text.AABBBounds.y2 + dy
1798
- }, undefined, overlapPadding)) {
1827
+ })) {
1799
1828
  text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
1800
1829
  bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
1801
1830
  result.push(text);
@@ -1826,17 +1855,9 @@
1826
1855
  });
1827
1856
  }
1828
1857
  _renderLabels(labels) {
1829
- const disableAnimation = this._enableAnimation === false || this.attribute.animation === false;
1830
- if (disableAnimation) {
1831
- this._renderWithOutAnimation(labels);
1832
- }
1833
- else {
1834
- this._renderWithAnimation(labels);
1835
- }
1836
- }
1837
- _renderWithAnimation(labels) {
1838
1858
  var _a, _b, _c, _d, _e;
1839
1859
  const animationConfig = ((_a = this.attribute.animation) !== null && _a !== void 0 ? _a : {});
1860
+ const disableAnimation = this._enableAnimation === false || animationConfig === false;
1840
1861
  const mode = (_b = animationConfig.mode) !== null && _b !== void 0 ? _b : DefaultLabelAnimation.mode;
1841
1862
  const duration = (_c = animationConfig.duration) !== null && _c !== void 0 ? _c : DefaultLabelAnimation.duration;
1842
1863
  const easing = (_d = animationConfig.easing) !== null && _d !== void 0 ? _d : DefaultLabelAnimation.easing;
@@ -1845,18 +1866,27 @@
1845
1866
  const prevTextMap = this._graphicToText || new Map();
1846
1867
  const texts = [];
1847
1868
  labels.forEach((text, index) => {
1848
- var _a;
1849
- const labelLine = this._labelLine(text);
1869
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
1870
+ const labelLine = ((_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points)
1871
+ ? vrender.createLine({
1872
+ visible: (_c = (_b = text.attribute) === null || _b === void 0 ? void 0 : _b.visible) !== null && _c !== void 0 ? _c : true,
1873
+ 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,
1874
+ 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,
1875
+ points: (_l = text.attribute) === null || _l === void 0 ? void 0 : _l.points
1876
+ })
1877
+ : undefined;
1850
1878
  const relatedGraphic = this._idToGraphic.get(text.attribute.id);
1851
1879
  const state = (prevTextMap === null || prevTextMap === void 0 ? void 0 : prevTextMap.get(relatedGraphic)) ? 'update' : 'enter';
1852
1880
  if (state === 'enter') {
1853
1881
  texts.push(text);
1854
1882
  currentTextMap.set(relatedGraphic, labelLine ? { text, labelLine } : { text });
1855
- if (relatedGraphic) {
1883
+ if (!disableAnimation && relatedGraphic) {
1856
1884
  const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');
1857
1885
  this.add(text);
1858
- labelLine && this.add(labelLine);
1859
- relatedGraphic.once('animate-bind', () => {
1886
+ if (labelLine) {
1887
+ this.add(labelLine);
1888
+ }
1889
+ relatedGraphic.onAnimateBind = () => {
1860
1890
  text.setAttributes(from);
1861
1891
  const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, {
1862
1892
  mode,
@@ -1866,69 +1896,58 @@
1866
1896
  delay
1867
1897
  });
1868
1898
  relatedGraphic.on('afterAttributeUpdate', listener);
1869
- });
1899
+ };
1900
+ }
1901
+ else {
1902
+ this.add(text);
1903
+ if (labelLine) {
1904
+ this.add(labelLine);
1905
+ }
1870
1906
  }
1871
1907
  }
1872
- else if (state === 'update') {
1908
+ if (state === 'update') {
1873
1909
  const prevLabel = prevTextMap.get(relatedGraphic);
1874
1910
  prevTextMap.delete(relatedGraphic);
1875
1911
  currentTextMap.set(relatedGraphic, prevLabel);
1876
- const prevText = prevLabel.text;
1877
- prevText.animate().to(text.attribute, duration, easing);
1878
- if (prevLabel.labelLine) {
1879
- prevLabel.labelLine.animate().to(vutils.merge({}, prevLabel.labelLine.attribute, {
1880
- points: (_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points
1881
- }), duration, easing);
1912
+ if (!disableAnimation) {
1913
+ const prevText = prevLabel.text;
1914
+ prevText.animate().to(text.attribute, duration, easing);
1915
+ if (prevLabel.labelLine) {
1916
+ prevLabel.labelLine.animate().to(vutils.merge({}, prevLabel.labelLine.attribute, {
1917
+ points: (_m = text.attribute) === null || _m === void 0 ? void 0 : _m.points
1918
+ }), duration, easing);
1919
+ }
1920
+ if (animationConfig.increaseEffect !== false &&
1921
+ prevText.attribute.text !== text.attribute.text &&
1922
+ vutils.isValidNumber(Number(prevText.attribute.text) * Number(text.attribute.text))) {
1923
+ prevText
1924
+ .animate()
1925
+ .play(new vrender.IncreaseCount({ text: prevText.attribute.text }, { text: text.attribute.text }, duration, easing));
1926
+ }
1882
1927
  }
1883
- if (animationConfig.increaseEffect !== false &&
1884
- prevText.attribute.text !== text.attribute.text &&
1885
- vutils.isValidNumber(Number(prevText.attribute.text) * Number(text.attribute.text))) {
1886
- prevText
1887
- .animate()
1888
- .play(new vrender.IncreaseCount({ text: prevText.attribute.text }, { text: text.attribute.text }, duration, easing));
1928
+ else {
1929
+ prevLabel.text.setAttributes(text.attribute);
1930
+ if (prevLabel === null || prevLabel === void 0 ? void 0 : prevLabel.labelLine) {
1931
+ prevLabel.labelLine.setAttributes({ points: (_o = text.attribute) === null || _o === void 0 ? void 0 : _o.points });
1932
+ }
1889
1933
  }
1890
1934
  }
1891
1935
  });
1892
1936
  prevTextMap.forEach(label => {
1893
1937
  var _a;
1894
- (_a = label.text) === null || _a === void 0 ? void 0 : _a.animate().to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, duration, easing).onEnd(() => {
1938
+ if (disableAnimation) {
1895
1939
  this.removeChild(label.text);
1896
1940
  if (label === null || label === void 0 ? void 0 : label.labelLine) {
1897
1941
  this.removeChild(label.labelLine);
1898
1942
  }
1899
- });
1900
- });
1901
- this._graphicToText = currentTextMap;
1902
- }
1903
- _renderWithOutAnimation(labels) {
1904
- const currentTextMap = new Map();
1905
- const prevTextMap = this._graphicToText || new Map();
1906
- labels.forEach(text => {
1907
- var _a;
1908
- const labelLine = this._labelLine(text);
1909
- const relatedGraphic = this._idToGraphic.get(text.attribute.id);
1910
- const state = (prevTextMap === null || prevTextMap === void 0 ? void 0 : prevTextMap.get(relatedGraphic)) ? 'update' : 'enter';
1911
- if (state === 'enter') {
1912
- currentTextMap.set(relatedGraphic, labelLine ? { text, labelLine } : { text });
1913
- this.add(text);
1914
- if (labelLine) {
1915
- this.add(labelLine);
1916
- }
1917
- }
1918
- else if (state === 'update') {
1919
- const prevLabel = prevTextMap.get(relatedGraphic);
1920
- prevTextMap.delete(relatedGraphic);
1921
- currentTextMap.set(relatedGraphic, prevLabel);
1922
- prevLabel.text.setAttributes(text.attribute);
1923
- if (prevLabel === null || prevLabel === void 0 ? void 0 : prevLabel.labelLine) {
1924
- prevLabel.labelLine.setAttributes({ points: (_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points });
1925
- }
1926
1943
  }
1927
- });
1928
- prevTextMap.forEach(label => {
1929
- this.removeChild(label.text);
1930
- if (label === null || label === void 0 ? void 0 : label.labelLine) {
1931
- this.removeChild(label.labelLine);
1944
+ else {
1945
+ (_a = label.text) === null || _a === void 0 ? void 0 : _a.animate().to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, duration, easing).onEnd(() => {
1946
+ this.removeChild(label.text);
1947
+ if (label === null || label === void 0 ? void 0 : label.labelLine) {
1948
+ this.removeChild(label.labelLine);
1949
+ }
1950
+ });
1932
1951
  }
1933
1952
  });
1934
1953
  this._graphicToText = currentTextMap;
@@ -1999,20 +2018,21 @@
1999
2018
  continue;
2000
2019
  }
2001
2020
  const baseMark = this._idToGraphic.get(label.attribute.id);
2002
- const isInside = this._canPlaceInside(label.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds);
2021
+ let isInside = canPlaceInside(label.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds);
2022
+ if (this.attribute.type === 'arc') {
2023
+ isInside = this.attribute.position === 'inside';
2024
+ }
2003
2025
  const backgroundColor = baseMark.attribute.fill;
2004
2026
  const foregroundColor = label.attribute.fill;
2005
2027
  const baseColor = backgroundColor;
2006
2028
  const invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors);
2007
- const similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;
2029
+ const simialrColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;
2008
2030
  if (isInside) {
2009
- const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
2010
- fill && label.setAttributes({ fill });
2031
+ this.setFillStrategy(fillStrategy, label, baseColor, invertColor, simialrColor);
2011
2032
  if (label.attribute.lineWidth === 0) {
2012
2033
  continue;
2013
2034
  }
2014
- const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);
2015
- stroke && label.setAttributes({ stroke });
2035
+ this.setStrokeStrategy(strokeStrategy, label, baseColor, invertColor, simialrColor);
2016
2036
  }
2017
2037
  else {
2018
2038
  if (label.attribute.lineWidth === 0) {
@@ -2024,18 +2044,47 @@
2024
2044
  });
2025
2045
  continue;
2026
2046
  }
2027
- const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
2028
- fill && label.setAttributes({ fill });
2029
- const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);
2030
- stroke && label.setAttributes({ stroke });
2047
+ this.setFillStrategy(fillStrategy, label, baseColor, invertColor, simialrColor);
2048
+ this.setStrokeStrategy(strokeStrategy, label, baseColor, invertColor, simialrColor);
2031
2049
  }
2032
2050
  }
2033
2051
  }
2034
- _canPlaceInside(textBound, shapeBound) {
2035
- if (!textBound || !shapeBound) {
2036
- return false;
2052
+ setFillStrategy(fillStrategy, label, baseColor, invertColor, simialrColor) {
2053
+ switch (fillStrategy) {
2054
+ case 'base':
2055
+ label.setAttributes({
2056
+ fill: baseColor
2057
+ });
2058
+ break;
2059
+ case 'invertBase':
2060
+ label.setAttributes({
2061
+ fill: invertColor
2062
+ });
2063
+ break;
2064
+ case 'similarBase':
2065
+ label.setAttributes({
2066
+ fill: simialrColor
2067
+ });
2068
+ }
2069
+ }
2070
+ setStrokeStrategy(strokeStrategy, label, baseColor, invertColor, simialrColor) {
2071
+ switch (strokeStrategy) {
2072
+ case 'base':
2073
+ label.setAttributes({
2074
+ stroke: baseColor
2075
+ });
2076
+ break;
2077
+ case 'invertBase':
2078
+ label.setAttributes({
2079
+ stroke: invertColor
2080
+ });
2081
+ break;
2082
+ case 'similarBase':
2083
+ label.setAttributes({
2084
+ stroke: simialrColor
2085
+ });
2086
+ break;
2037
2087
  }
2038
- return shapeBound.encloses(textBound);
2039
2088
  }
2040
2089
  setLocation(point) {
2041
2090
  this.translateTo(point.x, point.y);
@@ -2047,16 +2096,6 @@
2047
2096
  this._enableAnimation = true;
2048
2097
  }
2049
2098
  }
2050
- LabelBase.defaultAttributes = {
2051
- textStyle: {
2052
- fontSize: 12,
2053
- textAlign: 'center',
2054
- textBaseline: 'middle',
2055
- boundsPadding: [-1, 0, -1, 0]
2056
- },
2057
- offset: 0,
2058
- pickable: false
2059
- };
2060
2099
 
2061
2100
  class SymbolLabel extends LabelBase {
2062
2101
  constructor(attributes) {
@@ -2411,31 +2450,6 @@
2411
2450
  }
2412
2451
  return { x: 0, y: 0 };
2413
2452
  }
2414
- _layout(data = []) {
2415
- const labels = super._layout(data);
2416
- const textBoundsArray = labels.map(label => this.getGraphicBounds(label));
2417
- const ellipsisLabelAttribute = Object.assign(Object.assign({}, this.attribute.textStyle), { text: '...' });
2418
- const ellipsisText = this._createLabelText(ellipsisLabelAttribute);
2419
- const ellipsisTextBounds = this.getGraphicBounds(ellipsisText);
2420
- const ellipsisWidth = ellipsisTextBounds.x2 - ellipsisTextBounds.x1;
2421
- const arcs = this.layoutArcLabels(this.attribute.position, this.attribute, Array.from(this._idToGraphic.values()), data, textBoundsArray, ellipsisWidth);
2422
- for (let i = 0; i < data.length; i++) {
2423
- const textData = data[i];
2424
- const basedArc = arcs.find(arc => arc.refDatum.id === textData.id);
2425
- const labelAttribute = {
2426
- visible: basedArc.labelVisible,
2427
- x: basedArc.labelPosition.x,
2428
- y: basedArc.labelPosition.y,
2429
- angle: basedArc.angle,
2430
- maxLineWidth: basedArc.labelLimit,
2431
- 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)
2432
- ? [basedArc.pointA, basedArc.pointB, basedArc.pointC]
2433
- : undefined
2434
- };
2435
- labels[i].setAttributes(labelAttribute);
2436
- }
2437
- return labels;
2438
- }
2439
2453
  layoutArcLabels(position, attribute, currentMarks, data, textBoundsArray, ellipsisWidth) {
2440
2454
  var _a;
2441
2455
  this._arcLeft.clear();
@@ -3002,18 +3016,6 @@
3002
3016
  }
3003
3017
  }
3004
3018
  }
3005
- _labelLine(text) {
3006
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
3007
- const labelLine = ((_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points)
3008
- ? vrender.createLine({
3009
- visible: (_c = (_b = text.attribute) === null || _b === void 0 ? void 0 : _b.visible) !== null && _c !== void 0 ? _c : true,
3010
- 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,
3011
- 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,
3012
- points: (_l = text.attribute) === null || _l === void 0 ? void 0 : _l.points
3013
- })
3014
- : undefined;
3015
- return labelLine;
3016
- }
3017
3019
  computeRadius(r, width, height, centerOffset, k) {
3018
3020
  var _a;
3019
3021
  return ((_a = this.computeLayoutRadius(width ? width : 0, height ? height : 0) * r * (vutils.isNil(k) ? 1 : k) + centerOffset) !== null && _a !== void 0 ? _a : 0);
@@ -3021,9 +3023,6 @@
3021
3023
  computeLayoutRadius(width, height) {
3022
3024
  return Math.min(width / 2, height / 2);
3023
3025
  }
3024
- _canPlaceInside(textBound, shapeBound) {
3025
- return this.attribute.position === 'inside';
3026
- }
3027
3026
  computeLayoutOuterRadius(r, width, height) {
3028
3027
  return r / (Math.min(width, height) / 2);
3029
3028
  }
@@ -3088,8 +3087,7 @@
3088
3087
  const prevComponentMap = this._componentMap;
3089
3088
  for (let i = 0; i < dataLabels.length; i++) {
3090
3089
  const dataLabel = dataLabels[i];
3091
- const labelComponent = labelComponentMap[dataLabel.type] || LabelBase;
3092
- if (labelComponent) {
3090
+ if (labelComponentMap[dataLabel.type]) {
3093
3091
  const { baseMarkGroupName } = dataLabel;
3094
3092
  let component = this._componentMap.get(baseMarkGroupName);
3095
3093
  if (component) {
@@ -3099,7 +3097,7 @@
3099
3097
  currentComponentMap.set(baseMarkGroupName, component);
3100
3098
  }
3101
3099
  else {
3102
- component = new labelComponent(dataLabel);
3100
+ component = new labelComponentMap[dataLabel.type](dataLabel);
3103
3101
  component.setBitmap(bitmap);
3104
3102
  component.setBitmapTool(tool);
3105
3103
  this.add(component);
@@ -4099,14 +4097,12 @@
4099
4097
  }
4100
4098
  function rotateYAxis(orient, items) {
4101
4099
  items.forEach((item, i) => {
4102
- item.attribute.angle &&
4103
- item.setAttributes(Object.assign(Object.assign({}, getYAxisLabelAlign(orient, item.attribute.angle)), { angle: clampAngle(item.attribute.angle) }));
4100
+ item.setAttributes(Object.assign(Object.assign({}, getYAxisLabelAlign(orient, item.attribute.angle)), { angle: clampAngle(item.attribute.angle) }));
4104
4101
  });
4105
4102
  }
4106
4103
  function rotateXAxis(orient, items) {
4107
4104
  items.forEach(item => {
4108
- item.attribute.angle &&
4109
- item.setAttributes(Object.assign(Object.assign({}, getXAxisLabelAlign(orient, item.attribute.angle)), { angle: clampAngle(item.attribute.angle) }));
4105
+ item.setAttributes(Object.assign(Object.assign({}, getXAxisLabelAlign(orient, item.attribute.angle)), { angle: clampAngle(item.attribute.angle) }));
4110
4106
  });
4111
4107
  }
4112
4108
  function getXAxisLabelAlign(orient, angle = 0) {
@@ -4572,92 +4568,6 @@
4572
4568
  };
4573
4569
  }
4574
4570
  beforeLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
4575
- const { flush = false } = this.attribute.label || {};
4576
- if (flush) {
4577
- const { orient, start, end } = this.attribute;
4578
- const isX = orient === 'bottom' || orient === 'top';
4579
- const first = labelShapes[0];
4580
- const last = vutils.last(labelShapes);
4581
- const isInverse = isX ? first.attribute.x > last.attribute.x : first.attribute.y < last.attribute.y;
4582
- if (isX) {
4583
- const width = Math.abs(start.x - end.x);
4584
- if (isInverse) {
4585
- const start = width;
4586
- const end = 0;
4587
- const startBound = first.AABBBounds.x2;
4588
- const endBound = last.AABBBounds.x1;
4589
- if (startBound > start) {
4590
- first.setAttributes({
4591
- x: start,
4592
- textAlign: 'right'
4593
- });
4594
- }
4595
- if (endBound < end) {
4596
- last.setAttributes({
4597
- x: end,
4598
- textAlign: 'left'
4599
- });
4600
- }
4601
- }
4602
- else {
4603
- const start = 0;
4604
- const end = width;
4605
- const startBound = first.AABBBounds.x1;
4606
- const endBound = last.AABBBounds.x2;
4607
- if (startBound < start) {
4608
- first.setAttributes({
4609
- x: start,
4610
- textAlign: 'left'
4611
- });
4612
- }
4613
- if (endBound > end) {
4614
- last.setAttributes({
4615
- x: end,
4616
- textAlign: 'right'
4617
- });
4618
- }
4619
- }
4620
- }
4621
- else {
4622
- const height = Math.abs(start.y - end.y);
4623
- if (isInverse) {
4624
- const startBound = first.AABBBounds.y1;
4625
- const endBound = last.AABBBounds.y2;
4626
- const start = 0;
4627
- const end = height;
4628
- if (startBound < start) {
4629
- first.setAttributes({
4630
- y: start,
4631
- textBaseline: 'top'
4632
- });
4633
- }
4634
- if (endBound > end) {
4635
- last.setAttributes({
4636
- y: end,
4637
- textBaseline: 'bottom'
4638
- });
4639
- }
4640
- }
4641
- else {
4642
- const start = height;
4643
- const end = 0;
4644
- const startBound = first.AABBBounds.y2;
4645
- const endBound = last.AABBBounds.y1;
4646
- if (startBound > start) {
4647
- first.setAttributes({
4648
- y: start,
4649
- textBaseline: 'bottom'
4650
- });
4651
- }
4652
- if (endBound < end) {
4653
- last.setAttributes({
4654
- y: end,
4655
- textBaseline: 'top'
4656
- });
4657
- }
4658
- }
4659
- }
4660
- }
4661
4571
  return;
4662
4572
  }
4663
4573
  handleLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
@@ -9852,13 +9762,6 @@
9852
9762
  setUpdateDragMaskCallback(callback) {
9853
9763
  vutils.isFunction(callback) && (this._updateDragMaskCallback = callback);
9854
9764
  }
9855
- releaseBrushEvents() {
9856
- const { delayType = 'throttle', delayTime = 0 } = this.attribute;
9857
- this.stage.removeEventListener('pointerdown', this._onBrushStart);
9858
- this.stage.removeEventListener('pointermove', delayMap[delayType](this._onBrushing, delayTime));
9859
- this.stage.removeEventListener('pointerup', this._onBrushEnd);
9860
- this.stage.removeEventListener('pointerupoutside', this._onBrushEnd);
9861
- }
9862
9765
  }
9863
9766
  Brush.defaultAttributes = DEFAULT_BRUSH_ATTRIBUTES;
9864
9767
 
@@ -10244,7 +10147,11 @@
10244
10147
  }
10245
10148
  Tooltip.defaultAttributes = defaultAttributes;
10246
10149
 
10247
- const version = "0.14.6-alpha.8";
10150
+ function VTag(params) {
10151
+ return new Tag(params ? params.attribute : {});
10152
+ }
10153
+
10154
+ const version = "0.14.6-alpha.9";
10248
10155
 
10249
10156
  exports.AbstractComponent = AbstractComponent;
10250
10157
  exports.ArcInfo = ArcInfo;
@@ -10295,6 +10202,7 @@
10295
10202
  exports.Tag = Tag;
10296
10203
  exports.Title = Title;
10297
10204
  exports.Tooltip = Tooltip;
10205
+ exports.VTag = VTag;
10298
10206
  exports.getHorizontalPath = getHorizontalPath;
10299
10207
  exports.getSizeHandlerPath = getSizeHandlerPath;
10300
10208
  exports.getVerticalPath = getVerticalPath;