@visactor/vrender-components 0.20.3 → 0.20.5

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 (84) hide show
  1. package/cjs/axis/base.d.ts +0 -2
  2. package/cjs/axis/base.js +0 -5
  3. package/cjs/axis/base.js.map +1 -1
  4. package/cjs/axis/circle.d.ts +2 -5
  5. package/cjs/axis/circle.js +41 -9
  6. package/cjs/axis/circle.js.map +1 -1
  7. package/cjs/axis/line.d.ts +1 -0
  8. package/cjs/axis/line.js +5 -0
  9. package/cjs/axis/line.js.map +1 -1
  10. package/cjs/axis/overlap/circle-auto-limit.d.ts +16 -0
  11. package/cjs/axis/overlap/circle-auto-limit.js +62 -0
  12. package/cjs/axis/overlap/circle-auto-limit.js.map +1 -0
  13. package/cjs/axis/tick-data/discrete/polar-angle.js +12 -10
  14. package/cjs/axis/tick-data/discrete/polar-angle.js.map +1 -1
  15. package/cjs/axis/type.d.ts +1 -1
  16. package/cjs/axis/type.js.map +1 -1
  17. package/cjs/axis/util.d.ts +3 -3
  18. package/cjs/axis/util.js +8 -17
  19. package/cjs/axis/util.js.map +1 -1
  20. package/cjs/brush/type.js +1 -2
  21. package/cjs/checkbox/checkbox.js +3 -1
  22. package/cjs/checkbox/checkbox.js.map +1 -1
  23. package/cjs/data-zoom/data-zoom.js +5 -4
  24. package/cjs/data-zoom/data-zoom.js.map +1 -1
  25. package/cjs/index.d.ts +1 -1
  26. package/cjs/index.js +1 -1
  27. package/cjs/index.js.map +1 -1
  28. package/cjs/interface.d.ts +2 -2
  29. package/cjs/interface.js.map +1 -1
  30. package/cjs/label/arc.js +8 -7
  31. package/cjs/label/arc.js.map +1 -1
  32. package/cjs/label/base.js +5 -2
  33. package/cjs/label/base.js.map +1 -1
  34. package/cjs/label/type.d.ts +2 -2
  35. package/cjs/label/type.js.map +1 -1
  36. package/cjs/radio/radio.js +3 -1
  37. package/cjs/radio/radio.js.map +1 -1
  38. package/cjs/tag/tag.js +24 -38
  39. package/cjs/tag/tag.js.map +1 -1
  40. package/cjs/util/text.js +3 -3
  41. package/cjs/util/text.js.map +1 -1
  42. package/dist/index.es.js +349 -166
  43. package/es/axis/base.d.ts +0 -2
  44. package/es/axis/base.js +1 -6
  45. package/es/axis/base.js.map +1 -1
  46. package/es/axis/circle.d.ts +2 -5
  47. package/es/axis/circle.js +45 -10
  48. package/es/axis/circle.js.map +1 -1
  49. package/es/axis/line.d.ts +1 -0
  50. package/es/axis/line.js +5 -0
  51. package/es/axis/line.js.map +1 -1
  52. package/es/axis/overlap/circle-auto-limit.d.ts +16 -0
  53. package/es/axis/overlap/circle-auto-limit.js +54 -0
  54. package/es/axis/overlap/circle-auto-limit.js.map +1 -0
  55. package/es/axis/tick-data/discrete/polar-angle.js +13 -10
  56. package/es/axis/tick-data/discrete/polar-angle.js.map +1 -1
  57. package/es/axis/type.d.ts +1 -1
  58. package/es/axis/type.js.map +1 -1
  59. package/es/axis/util.d.ts +3 -3
  60. package/es/axis/util.js +7 -16
  61. package/es/axis/util.js.map +1 -1
  62. package/es/brush/type.js +1 -2
  63. package/es/checkbox/checkbox.js +3 -1
  64. package/es/checkbox/checkbox.js.map +1 -1
  65. package/es/data-zoom/data-zoom.js +5 -4
  66. package/es/data-zoom/data-zoom.js.map +1 -1
  67. package/es/index.d.ts +1 -1
  68. package/es/index.js +1 -1
  69. package/es/index.js.map +1 -1
  70. package/es/interface.d.ts +2 -2
  71. package/es/interface.js.map +1 -1
  72. package/es/label/arc.js +8 -7
  73. package/es/label/arc.js.map +1 -1
  74. package/es/label/base.js +5 -2
  75. package/es/label/base.js.map +1 -1
  76. package/es/label/type.d.ts +2 -2
  77. package/es/label/type.js.map +1 -1
  78. package/es/radio/radio.js +3 -1
  79. package/es/radio/radio.js.map +1 -1
  80. package/es/tag/tag.js +24 -38
  81. package/es/tag/tag.js.map +1 -1
  82. package/es/util/text.js +4 -4
  83. package/es/util/text.js.map +1 -1
  84. package/package.json +8 -8
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, isString, cos, sin, pi, isArray, pointAt, isNumber, getDecimalPlaces, isNil, Color, has, normalTransform, isValidUrl, isBase64, acos, sqrt, transformBoundsWithMatrix, arrayEqual, getContextFont, clampAngleByRadian, asin, Bounds, getRectIntersect, isRectIntersect, isPlainObject, merge, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isEmpty, isValid, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, array, isValidNumber, calculateAnchorOfBounds, computeQuadrant, isGreater, isLess, isNumberClose, normalizeAngle, flattenArray, cloneDeep, get, isRotateAABBIntersect, last, mixin, isEqual, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, polygonContainPoint } from '@visactor/vutils';
1
+ import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, isString, cos, sin, pi, isArray, pointAt, isNumber, getDecimalPlaces, isNil, Color, has, normalTransform, isValidUrl, isBase64, acos, sqrt, transformBoundsWithMatrix, arrayEqual, getContextFont, clampAngleByRadian, asin, Bounds, getRectIntersect, isRectIntersect, isPlainObject, merge, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isValid, isEmpty, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, array, isValidNumber, calculateAnchorOfBounds, computeQuadrant, isGreater, isLess, isNumberClose, normalizeAngle, flattenArray, cloneDeep, get, isRotateAABBIntersect, last, mixin, isEqual, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, polygonContainPoint } from '@visactor/vutils';
2
2
  import { isContinuous, isDiscrete, LinearScale } from '@visactor/vscale';
3
3
 
4
4
  class Generator {
@@ -770,7 +770,7 @@ class BoundsContext {
770
770
  this.bounds.add(cx + xmin, cy + ymin), this.bounds.add(cx + xmax, cy + ymax);
771
771
  }
772
772
  arcTo(x1, y1, x2, y2, radius) {
773
- throw new Error("不支持arcTo");
773
+ this.bounds.add(x1, y1);
774
774
  }
775
775
  bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) {
776
776
  this.bounds.add(cp1x, cp1y), this.bounds.add(cp2x, cp2y), this.bounds.add(x, y);
@@ -979,19 +979,25 @@ function drawArc(context, x, y, coords) {
979
979
  }
980
980
  const addArcToBezierPath = (bezierPath, startAngle, endAngle, cx, cy, rx, ry) => {
981
981
  const delta = Math.abs(endAngle - startAngle),
982
- len = 4 * Math.tan(delta / 4) / 3,
983
- dir = endAngle < startAngle ? -1 : 1,
984
- c1 = Math.cos(startAngle),
985
- s1 = Math.sin(startAngle),
986
- c2 = Math.cos(endAngle),
987
- s2 = Math.sin(endAngle),
988
- x1 = c1 * rx + cx,
989
- y1 = s1 * ry + cy,
990
- x4 = c2 * rx + cx,
991
- y4 = s2 * ry + cy,
992
- hx = rx * len * dir,
993
- hy = ry * len * dir;
994
- bezierPath.push(x1 - hx * s1, y1 + hy * c1, x4 + hx * s2, y4 - hy * c2, x4, y4);
982
+ count = delta > .5 * Math.PI ? Math.ceil(2 * delta / Math.PI) : 1,
983
+ stepAngle = (endAngle - startAngle) / count;
984
+ for (let i = 0; i < count; i++) {
985
+ const sa = startAngle + stepAngle * i,
986
+ ea = startAngle + stepAngle * (i + 1),
987
+ len = 4 * Math.tan(Math.abs(stepAngle) / 4) / 3,
988
+ dir = ea < sa ? -1 : 1,
989
+ c1 = Math.cos(sa),
990
+ s1 = Math.sin(sa),
991
+ c2 = Math.cos(ea),
992
+ s2 = Math.sin(ea),
993
+ x1 = c1 * rx + cx,
994
+ y1 = s1 * ry + cy,
995
+ x4 = c2 * rx + cx,
996
+ y4 = s2 * ry + cy,
997
+ hx = rx * len * dir,
998
+ hy = ry * len * dir;
999
+ bezierPath.push(x1 - hx * s1, y1 + hy * c1, x4 + hx * s2, y4 - hy * c2, x4, y4);
1000
+ }
995
1001
  };
996
1002
 
997
1003
  const commandFuncs = [(command, context, x, y, sx, sy, z) => context.arc(command[1] * sx + x, command[2] * sy + y, command[3] * (sx + sy) / 2, command[4], command[5], command[6], z), (command, context, x, y, sx, sy, z) => context.arcTo(command[1] * sx + x, command[2] * sy + y, command[3] * sx + x, command[4] * sy + y, command[5] * (sx + sy) / 2, z), (command, context, x, y, sx, sy, z) => context.bezierCurveTo(command[1] * sx + x, command[2] * sy + y, command[3] * sx + x, command[4] * sy + y, command[5] * sx + x, command[6] * sy + y, z), (command, context, x, y) => context.closePath(), (command, context, x, y, sx, sy) => context.ellipse(command[1] * sx + x, command[2] * sy + y, command[3] * sx, command[4] * sy, command[5], command[6], command[7], command[8]), (command, context, x, y, sx, sy, z) => context.lineTo(command[1] * sx + x, command[2] * sy + y, z), (command, context, x, y, sx, sy, z) => context.moveTo(command[1] * sx + x, command[2] * sy + y, z), (command, context, x, y, sx, sy, z) => context.quadraticCurveTo(command[1] * sx + x, command[2] * sy + y, command[3] * sx + x, command[4] * sy + y, z), (command, context, x, y, sx, sy, z) => context.rect(command[1] * sx + x, command[2] * sy + y, command[3] * sx, command[4] * sy, z)];
@@ -6322,6 +6328,7 @@ let DefaultGraphicService = class {
6322
6328
  validCheck(attribute, theme, aabbBounds, graphic) {
6323
6329
  if (!graphic) return !0;
6324
6330
  if (null != attribute.forceBoundsHeight || null != attribute.forceBoundsWidth) return !0;
6331
+ if (graphic.shadowRoot) return !0;
6325
6332
  if (!graphic.valid) return aabbBounds.clear(), !1;
6326
6333
  const {
6327
6334
  visible = theme.visible
@@ -9448,13 +9455,23 @@ class Text extends Graphic {
9448
9455
  if (this.isSimplify()) return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
9449
9456
  }
9450
9457
  get cliped() {
9458
+ var _a, _b;
9451
9459
  const textTheme = this.getGraphicTheme(),
9452
- attribute = this.attribute;
9453
- if (this.isMultiLine) return;
9454
- const {
9455
- maxLineWidth = textTheme.maxLineWidth
9456
- } = attribute;
9457
- return !!Number.isFinite(maxLineWidth) && (this.tryUpdateAABBBounds(), "vertical" === attribute.direction && this.cache.verticalList && this.cache.verticalList[0] ? this.cache.verticalList[0].map(item => item.text).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString());
9460
+ attribute = this.attribute,
9461
+ {
9462
+ maxLineWidth = textTheme.maxLineWidth,
9463
+ text: text,
9464
+ whiteSpace = textTheme.whiteSpace
9465
+ } = attribute;
9466
+ if (!Number.isFinite(maxLineWidth)) return !1;
9467
+ if (this.tryUpdateAABBBounds(), null === (_b = null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData) || void 0 === _b ? void 0 : _b.lines) {
9468
+ let mergedText = "";
9469
+ this.cache.layoutData.lines.forEach(item => {
9470
+ mergedText += item.str;
9471
+ });
9472
+ return (Array.isArray(text) ? text.join("") : text) !== mergedText;
9473
+ }
9474
+ return "vertical" === attribute.direction && this.cache.verticalList && this.cache.verticalList[0] ? this.cache.verticalList[0].map(item => item.text).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString();
9458
9475
  }
9459
9476
  get multilineLayout() {
9460
9477
  if (this.isMultiLine) return this.tryUpdateAABBBounds(), this.cache.layoutData;
@@ -11176,10 +11193,22 @@ class Line {
11176
11193
  }
11177
11194
  draw(ctx, lastLine, x, y, drawEllipsis, drawIcon) {
11178
11195
  if (drawEllipsis && (lastLine || this.paragraphs.some(p => p.overflow))) {
11179
- let otherParagraphWidth = 0;
11196
+ let emptyOverflow = !0,
11197
+ skipEllipsis = !1;
11180
11198
  for (let i = this.paragraphs.length - 1; i >= 0; i--) {
11181
11199
  const paragraph = this.paragraphs[i];
11182
- if (paragraph.overflow) continue;
11200
+ if (paragraph.overflow) emptyOverflow = emptyOverflow && "" === paragraph.text;else if (emptyOverflow) {
11201
+ skipEllipsis = !0;
11202
+ break;
11203
+ }
11204
+ }
11205
+ let otherParagraphWidth = 0;
11206
+ if (!skipEllipsis) for (let i = this.paragraphs.length - 1; i >= 0; i--) {
11207
+ const paragraph = this.paragraphs[i];
11208
+ if (paragraph.overflow) {
11209
+ if ("" === paragraph.text) break;
11210
+ continue;
11211
+ }
11183
11212
  if (paragraph instanceof RichTextIcon) break;
11184
11213
  if ("vertical" === this.direction && "vertical" !== paragraph.direction) {
11185
11214
  paragraph.verticalEllipsis = !0;
@@ -11273,7 +11302,13 @@ class Wrapper {
11273
11302
  const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", "fill", "stroke", "fontSize", ...GRAPHIC_UPDATE_TAG_KEY];
11274
11303
  class RichText extends Graphic {
11275
11304
  constructor(params) {
11276
- super(params), this.type = "richtext", this._currentHoverIcon = null, this.numberType = RICHTEXT_NUMBER_TYPE;
11305
+ super(params), this.type = "richtext", this._currentHoverIcon = null, this.numberType = RICHTEXT_NUMBER_TYPE, this.onBeforeAttributeUpdate = (val, attributes, key) => {
11306
+ for (const key in val) if ("hoverIconId" === key) {
11307
+ if (val[key] === attributes[key]) continue;
11308
+ const icon = this._frameCache.icons.get(val[key]);
11309
+ this.updateHoverIconState(icon);
11310
+ }
11311
+ };
11277
11312
  }
11278
11313
  get width() {
11279
11314
  var _a;
@@ -11398,6 +11433,21 @@ class RichText extends Graphic {
11398
11433
  getFrameCache() {
11399
11434
  return this.shouldUpdateShape() && (this.doUpdateFrameCache(), this.clearUpdateShapeTag()), this._frameCache;
11400
11435
  }
11436
+ get cliped() {
11437
+ const frameCache = this.getFrameCache();
11438
+ if (frameCache.actualHeight > frameCache.height) return !0;
11439
+ const {
11440
+ disableAutoWrapLine: disableAutoWrapLine
11441
+ } = this.attribute;
11442
+ if (disableAutoWrapLine) for (let i = 0; i < frameCache.lines.length; i++) {
11443
+ const l = frameCache.lines[i];
11444
+ for (let j = 0; j < l.paragraphs.length; j++) {
11445
+ const p = l.paragraphs[j];
11446
+ if (p.overflow && "" !== p.text) return !0;
11447
+ }
11448
+ }
11449
+ return !1;
11450
+ }
11401
11451
  combinedStyleToCharacter(config) {
11402
11452
  const {
11403
11453
  fill: fill,
@@ -11444,8 +11494,9 @@ class RichText extends Graphic {
11444
11494
  paragraphs = [],
11445
11495
  textConfig = null != tc ? tc : _tc;
11446
11496
  for (let i = 0; i < textConfig.length; i++) if ("image" in textConfig[i]) {
11447
- const config = this.combinedStyleToCharacter(textConfig[i]),
11448
- iconCache = config.id && this._frameCache && this._frameCache.icons && this._frameCache.icons.get(config.id);
11497
+ const config = this.combinedStyleToCharacter(textConfig[i]);
11498
+ config.lineWidth = void 0;
11499
+ const iconCache = config.id && this._frameCache && this._frameCache.icons && this._frameCache.icons.get(config.id);
11449
11500
  if (iconCache) paragraphs.push(iconCache);else {
11450
11501
  const icon = new RichTextIcon(config);
11451
11502
  icon.successCallback = () => {
@@ -11495,14 +11546,16 @@ class RichText extends Graphic {
11495
11546
  }
11496
11547
  bindIconEvent() {
11497
11548
  this.addEventListener("pointermove", e => {
11498
- var _a, _b, _c, _d, _e;
11499
11549
  const pickedIcon = this.pickIcon(e.global);
11500
- pickedIcon && pickedIcon === this._currentHoverIcon || (pickedIcon ? (null === (_a = this._currentHoverIcon) || void 0 === _a || _a.setHoverState(!1), this._currentHoverIcon = pickedIcon, this._currentHoverIcon.setHoverState(!0), null === (_b = this.stage) || void 0 === _b || _b.setCursor(pickedIcon.attribute.cursor), null === (_c = this.stage) || void 0 === _c || _c.renderNextFrame()) : !pickedIcon && this._currentHoverIcon && (this._currentHoverIcon.setHoverState(!1), this._currentHoverIcon = null, null === (_d = this.stage) || void 0 === _d || _d.setCursor(), null === (_e = this.stage) || void 0 === _e || _e.renderNextFrame()));
11550
+ pickedIcon && pickedIcon === this._currentHoverIcon || (pickedIcon ? this.setAttribute("hoverIconId", pickedIcon.richtextId) : !pickedIcon && this._currentHoverIcon && this.setAttribute("hoverIconId", void 0));
11501
11551
  }), this.addEventListener("pointerleave", e => {
11502
- var _a, _b;
11503
- this._currentHoverIcon && (this._currentHoverIcon.setHoverState(!1), this._currentHoverIcon = null, null === (_a = this.stage) || void 0 === _a || _a.setCursor(), null === (_b = this.stage) || void 0 === _b || _b.renderNextFrame());
11552
+ this._currentHoverIcon && this.setAttribute("hoverIconId", void 0);
11504
11553
  });
11505
11554
  }
11555
+ updateHoverIconState(pickedIcon) {
11556
+ var _a, _b, _c, _d, _e;
11557
+ pickedIcon ? (null === (_a = this._currentHoverIcon) || void 0 === _a || _a.setHoverState(!1), this._currentHoverIcon = pickedIcon, this._currentHoverIcon.setHoverState(!0), null === (_b = this.stage) || void 0 === _b || _b.setCursor(pickedIcon.attribute.cursor), null === (_c = this.stage) || void 0 === _c || _c.renderNextFrame()) : (this._currentHoverIcon.setHoverState(!1), this._currentHoverIcon = null, null === (_d = this.stage) || void 0 === _d || _d.setCursor(), null === (_e = this.stage) || void 0 === _e || _e.renderNextFrame());
11558
+ }
11506
11559
  pickIcon(point) {
11507
11560
  const frameCache = this.getFrameCache(),
11508
11561
  {
@@ -11510,7 +11563,7 @@ class RichText extends Graphic {
11510
11563
  f: y
11511
11564
  } = this.globalTransMatrix;
11512
11565
  let pickIcon;
11513
- return frameCache.icons.forEach(icon => {
11566
+ return frameCache.icons.forEach((icon, key) => {
11514
11567
  var _a, _b;
11515
11568
  const bounds = icon.AABBBounds.clone();
11516
11569
  bounds.translate(icon._marginArray[3], icon._marginArray[0]), bounds.containsPoint({
@@ -14606,9 +14659,12 @@ function getTextType(attributes, typeKey = 'type') {
14606
14659
  }
14607
14660
  function richTextAttributeTransform(attributes) {
14608
14661
  var _a, _b;
14662
+ if (isValid(attributes.maxLineWidth)) {
14663
+ attributes.maxWidth = attributes.maxLineWidth;
14664
+ delete attributes.maxLineWidth;
14665
+ }
14609
14666
  attributes.width = (_a = attributes.width) !== null && _a !== void 0 ? _a : 0;
14610
14667
  attributes.height = (_b = attributes.height) !== null && _b !== void 0 ? _b : 0;
14611
- attributes.maxWidth = attributes.maxLineWidth;
14612
14668
  attributes.textConfig = attributes.text.text || attributes.text;
14613
14669
  return attributes;
14614
14670
  }
@@ -14738,6 +14794,8 @@ class Tag extends AbstractComponent {
14738
14794
  const parsedPadding = normalizePadding(padding);
14739
14795
  const group = this.createOrUpdateChild('tag-content', { x: 0, y: 0, zIndex: 1 }, 'group');
14740
14796
  let symbol;
14797
+ let tagX = -parsedPadding[3];
14798
+ let tagY = -parsedPadding[0];
14741
14799
  let tagWidth = parsedPadding[1] + parsedPadding[3];
14742
14800
  let tagHeight = parsedPadding[0] + parsedPadding[2];
14743
14801
  let textX = 0;
@@ -14761,20 +14819,10 @@ class Tag extends AbstractComponent {
14761
14819
  if (isRich) {
14762
14820
  const richTextAttrs = Object.assign(Object.assign(Object.assign({}, richTextAttributeTransform(Object.assign({ type, text }, textStyle))), textStyle), { visible: isValid(text) && visible !== false, x: textX, y: 0 });
14763
14821
  textShape = group.createOrUpdateChild('tag-text', richTextAttrs, 'richtext');
14764
- const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
14765
- if (visible && isBoolean(bgVisible)) {
14766
- const bgRect = this.createOrUpdateChild('tag-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && !!text, x: textShape.AABBBounds.x1 - parsedPadding[1], y: textShape.AABBBounds.y1 - parsedPadding[0], width: textShape.AABBBounds.width() + (parsedPadding[1] + parsedPadding[3]), height: textShape.AABBBounds.height() + (parsedPadding[0] + parsedPadding[2]) }), 'rect');
14767
- if (!isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
14768
- bgRect.states = state.panel;
14769
- }
14770
- if (backgroundStyle.customShape) {
14771
- const customShape = backgroundStyle.customShape;
14772
- bgRect.pathProxy = (attrs) => {
14773
- return customShape(textShape.attribute, attrs, new CustomPath2D());
14774
- };
14775
- }
14776
- this._bgRect = bgRect;
14777
- }
14822
+ tagWidth += textShape.AABBBounds.width();
14823
+ tagHeight += textShape.AABBBounds.height();
14824
+ tagX += textShape.AABBBounds.x1;
14825
+ tagY += textShape.AABBBounds.y1;
14778
14826
  }
14779
14827
  else {
14780
14828
  const textAttrs = Object.assign(Object.assign({ text: isObject(text) && 'type' in text && text.type === 'text' ? text.text : text, visible: isValid(text) && visible !== false, lineHeight: textStyle === null || textStyle === void 0 ? void 0 : textStyle.fontSize }, textStyle), { x: textX, y: 0 });
@@ -14802,8 +14850,8 @@ class Tag extends AbstractComponent {
14802
14850
  textShape.setAttribute('maxLineWidth', maxWidth - parsedPadding[1] - parsedPadding[2]);
14803
14851
  }
14804
14852
  }
14805
- let x = 0;
14806
- let y = 0;
14853
+ tagX = 0;
14854
+ tagY = 0;
14807
14855
  let flag = 0;
14808
14856
  if (textAlign === 'left' || textAlign === 'start') {
14809
14857
  flag = 1;
@@ -14815,14 +14863,14 @@ class Tag extends AbstractComponent {
14815
14863
  flag = 0;
14816
14864
  }
14817
14865
  if (!flag) {
14818
- x -= tagWidth / 2;
14866
+ tagX -= tagWidth / 2;
14819
14867
  if (symbol) {
14820
14868
  symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth / 2);
14821
14869
  }
14822
14870
  group.setAttribute('x', -symbolPlaceWidth / 2);
14823
14871
  }
14824
14872
  else if (flag < 0) {
14825
- x -= tagWidth;
14873
+ tagX -= tagWidth;
14826
14874
  if (symbol) {
14827
14875
  symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth);
14828
14876
  }
@@ -14883,13 +14931,13 @@ class Tag extends AbstractComponent {
14883
14931
  }
14884
14932
  }
14885
14933
  if (textBaseline === 'middle') {
14886
- y -= tagHeight / 2;
14934
+ tagY -= tagHeight / 2;
14887
14935
  if (symbol) {
14888
14936
  symbol.setAttribute('y', 0);
14889
14937
  }
14890
14938
  }
14891
14939
  else if (textBaseline === 'bottom') {
14892
- y -= tagHeight;
14940
+ tagY -= tagHeight;
14893
14941
  if (symbol) {
14894
14942
  symbol.setAttribute('y', -textHeight / 2);
14895
14943
  }
@@ -14901,21 +14949,20 @@ class Tag extends AbstractComponent {
14901
14949
  symbol.setAttribute('y', textHeight / 2);
14902
14950
  }
14903
14951
  }
14904
- const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
14905
- if (visible && isBoolean(bgVisible)) {
14906
- const bgRect = this.createOrUpdateChild('tag-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && !!text, x,
14907
- y, width: tagWidth, height: tagHeight }), 'rect');
14908
- if (!isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
14909
- bgRect.states = state.panel;
14910
- }
14911
- if (backgroundStyle.customShape) {
14912
- const customShape = backgroundStyle.customShape;
14913
- bgRect.pathProxy = (attrs) => {
14914
- return customShape(textShape.attribute, attrs, new CustomPath2D());
14915
- };
14916
- }
14917
- this._bgRect = bgRect;
14952
+ }
14953
+ const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
14954
+ if (visible && isBoolean(bgVisible)) {
14955
+ const bgRect = this.createOrUpdateChild('tag-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && !!text, width: tagWidth, height: tagHeight, x: tagX, y: tagY }), 'rect');
14956
+ if (!isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
14957
+ bgRect.states = state.panel;
14958
+ }
14959
+ if (backgroundStyle.customShape) {
14960
+ const customShape = backgroundStyle.customShape;
14961
+ bgRect.pathProxy = (attrs) => {
14962
+ return customShape(this, attrs, new CustomPath2D());
14963
+ };
14918
14964
  }
14965
+ this._bgRect = bgRect;
14919
14966
  }
14920
14967
  this._textShape = textShape;
14921
14968
  this._symbol = symbol;
@@ -16203,7 +16250,10 @@ class LabelBase extends AbstractComponent {
16203
16250
  if (line.customShape) {
16204
16251
  const customShape = line.customShape;
16205
16252
  lineGraphic.pathProxy = (attrs) => {
16206
- return customShape(text.attribute, attrs, new CustomPath2D());
16253
+ return customShape({
16254
+ text,
16255
+ baseMark: baseMark
16256
+ }, attrs, new CustomPath2D());
16207
16257
  };
16208
16258
  }
16209
16259
  if (baseMark && baseMark.attribute.fill) {
@@ -16718,7 +16768,7 @@ class LabelBase extends AbstractComponent {
16718
16768
  const point = this._idToPoint.get(text.attribute.id);
16719
16769
  if (point &&
16720
16770
  (!text.animates || !text.animates.has('label-animate')) &&
16721
- relatedGraphic.containsPoint(point.x, point.y, IContainPointMode.LOCAL, (_c = this.stage) === null || _c === void 0 ? void 0 : _c.pickerService)) {
16771
+ relatedGraphic.containsPoint(point.x, point.y, IContainPointMode.LOCAL, (_c = this.stage) === null || _c === void 0 ? void 0 : _c.getPickerService())) {
16722
16772
  text.animate({ onStart }).wait(delay).to(to, duration, easing);
16723
16773
  labelLine && labelLine.animate().wait(delay).to(to, duration, easing);
16724
16774
  }
@@ -16965,7 +17015,6 @@ class ArcInfo {
16965
17015
  this.outerRadius = outerRadius;
16966
17016
  this.circleCenter = circleCenter;
16967
17017
  this.labelVisible = true;
16968
- this.labelLimit = 0;
16969
17018
  }
16970
17019
  getLabelBounds() {
16971
17020
  if (!this.labelPosition || !this.labelSize) {
@@ -17000,12 +17049,14 @@ class ArcLabel extends LabelBase {
17000
17049
  return { x: 0, y: 0 };
17001
17050
  }
17002
17051
  _layout(texts) {
17003
- var _a;
17052
+ var _a, _b, _c;
17004
17053
  if (!texts || !texts.length) {
17005
17054
  return;
17006
17055
  }
17007
17056
  const labels = super._layout(texts);
17008
- const textBoundsArray = labels.map(label => this.getGraphicBounds(label));
17057
+ const textBoundsArray = labels.map(label => {
17058
+ return this.getGraphicBounds(label);
17059
+ });
17009
17060
  const ellipsisLabelAttribute = Object.assign(Object.assign({}, this.attribute.textStyle), { text: '…' });
17010
17061
  let ellipsisWidth = Infinity;
17011
17062
  if (ellipsisLabelAttribute.ellipsis !== false) {
@@ -17032,14 +17083,18 @@ class ArcLabel extends LabelBase {
17032
17083
  x: basedArc.labelPosition.x,
17033
17084
  y: basedArc.labelPosition.y,
17034
17085
  angle: basedArc.angle,
17035
- maxLineWidth: basedArc.labelLimit,
17036
17086
  points: basedArc.pointA && basedArc.pointB && basedArc.pointC
17037
17087
  ? [basedArc.pointA, basedArc.pointB, basedArc.pointC]
17038
17088
  : undefined,
17039
17089
  line: basedArc.labelLine
17040
17090
  };
17041
17091
  if (labels[i].type === 'richtext') {
17042
- labelAttribute.width = basedArc.labelLimit;
17092
+ labelAttribute.width =
17093
+ (_b = basedArc.labelLimit) !== null && _b !== void 0 ? _b : labels[i].attribute.width;
17094
+ }
17095
+ else {
17096
+ labelAttribute.maxLineWidth =
17097
+ (_c = basedArc.labelLimit) !== null && _c !== void 0 ? _c : labels[i].attribute.maxLineWidth;
17043
17098
  }
17044
17099
  labels[i].setAttributes(labelAttribute);
17045
17100
  }
@@ -17280,10 +17335,16 @@ class ArcLabel extends LabelBase {
17280
17335
  break;
17281
17336
  }
17282
17337
  labelWidth = Math.max(this._ellipsisWidth, labelWidth);
17283
- arc.labelLimit = labelWidth;
17338
+ const needAdjustLimit = labelWidth < arc.labelSize.width - 1;
17339
+ if (needAdjustLimit) {
17340
+ arc.labelLimit = labelWidth;
17341
+ }
17342
+ else {
17343
+ arc.labelLimit = null;
17344
+ }
17284
17345
  arc.pointC = { x: cx, y: labelPosition.y };
17285
17346
  const align = this._computeAlign(arc, attribute);
17286
- const targetCenterOffset = getAlignOffset(align) * (arc.labelLimit < arc.labelSize.width ? arc.labelLimit : arc.labelSize.width);
17347
+ const targetCenterOffset = getAlignOffset(align) * (needAdjustLimit ? labelWidth : arc.labelSize.width);
17287
17348
  if (labelLayoutAlign === 'edge') {
17288
17349
  labelPosition.x =
17289
17350
  (flag > 0 ? plotLayout.x2 : plotLayout.x1) - flag * targetCenterOffset + flag * this._alignOffset;
@@ -18201,45 +18262,11 @@ const clampRadian = (angle = 0) => {
18201
18262
  function isInRange(a, min, max) {
18202
18263
  return !isLess(a, min, 0, 1e-6) && !isGreater(a, max, 0, 1e-6);
18203
18264
  }
18204
- function getCircleLabelPosition(tickPosition, tickVector, text, style) {
18205
- const labelBounds = getTextBounds(Object.assign({ text }, style));
18206
- const width = labelBounds.width();
18207
- const height = labelBounds.height();
18208
- const angle = clampRadian(Math.atan2(tickVector[1], tickVector[0])) - Math.PI;
18209
- const PI_3_4 = (Math.PI * 3) / 4;
18210
- const PI_1_4 = Math.PI / 4;
18211
- const PI_1_2 = Math.PI / 2;
18212
- const baseX = tickPosition.x;
18213
- let dx = 0;
18214
- if (isInRange(angle, -PI_3_4, -PI_1_4)) {
18215
- dx = ((angle + PI_3_4) / PI_1_2 - 0.5) * width;
18216
- }
18217
- else if (isInRange(angle, PI_1_4, PI_3_4)) {
18218
- dx = (0.5 - (angle - PI_1_4) / PI_1_2) * width;
18219
- }
18220
- else if (Math.cos(angle) >= 0) {
18221
- dx = width * 0.5;
18222
- }
18223
- else {
18224
- dx = -width * 0.5;
18225
- }
18226
- const x = baseX - dx;
18227
- const baseY = tickPosition.y;
18228
- let dy = 0;
18229
- if (isInRange(angle, -PI_3_4, -PI_1_4)) {
18230
- dy = -height * 0.5;
18231
- }
18232
- else if (isInRange(angle, PI_1_4, PI_3_4)) {
18233
- dy = height * 0.5;
18234
- }
18235
- else if (Math.cos(angle) >= 0) {
18236
- dy = (0.5 - (PI_1_4 - angle) / PI_1_2) * height;
18237
- }
18238
- else {
18239
- dy = (0.5 - clampRadian(angle - PI_3_4) / PI_1_2) * height;
18240
- }
18241
- const y = baseY - dy;
18242
- return { x, y };
18265
+ function getCircleLabelPosition(tickPosition, tickVector) {
18266
+ return {
18267
+ x: tickPosition.x + tickVector[0],
18268
+ y: tickPosition.y + tickVector[1]
18269
+ };
18243
18270
  }
18244
18271
  function getAxisBreakSymbolAttrs(props = {}) {
18245
18272
  var _a, _b;
@@ -18291,11 +18318,11 @@ function angleLabelOrientAttribute(angle) {
18291
18318
  }
18292
18319
  return { align, baseline };
18293
18320
  }
18294
- function getPolarAngleLabelPosition(angle, center, radius, labelOffset, inside, text, style) {
18321
+ function getPolarAngleLabelPosition(angle, center, radius, labelOffset, inside) {
18295
18322
  const point = polarToCartesian({ x: 0, y: 0 }, radius, angle);
18296
18323
  const labelPoint = getVerticalCoord(point, getCircleVerticalVector(labelOffset, point, center, inside));
18297
18324
  const vector = getCircleVerticalVector(labelOffset || 1, labelPoint, center, inside);
18298
- return getCircleLabelPosition(labelPoint, vector, text, style);
18325
+ return getCircleLabelPosition(labelPoint, vector);
18299
18326
  }
18300
18327
  function getCirclePoints(center, count, radius, startAngle, endAngle) {
18301
18328
  const points = [];
@@ -18593,29 +18620,6 @@ class AxisBase extends AbstractComponent {
18593
18620
  getVerticalCoord(point, offset, inside) {
18594
18621
  return getVerticalCoord(point, this.getVerticalVector(offset, inside, point));
18595
18622
  }
18596
- getTextAlign(vector) {
18597
- let align = 'center';
18598
- if (isNumberClose(vector[0], 0)) {
18599
- if (isNumberClose(vector[1], 0)) {
18600
- if (Object.is(vector[1], -0)) {
18601
- align = 'start';
18602
- }
18603
- else if (Object.is(vector[0], -0)) {
18604
- align = 'end';
18605
- }
18606
- }
18607
- else {
18608
- align = 'center';
18609
- }
18610
- }
18611
- else if (vector[0] > 0) {
18612
- align = 'start';
18613
- }
18614
- else if (vector[0] < 0) {
18615
- align = 'end';
18616
- }
18617
- return align;
18618
- }
18619
18623
  getTickLineItems() {
18620
18624
  const { tick } = this.attribute;
18621
18625
  const data = this.data;
@@ -19352,6 +19356,29 @@ class LineAxis extends AxisBase {
19352
19356
  axisLineGroup.id = this._getNodeId('line');
19353
19357
  container.add(axisLineGroup);
19354
19358
  }
19359
+ getTextAlign(vector) {
19360
+ let align = 'center';
19361
+ if (isNumberClose(vector[0], 0)) {
19362
+ if (isNumberClose(vector[1], 0)) {
19363
+ if (Object.is(vector[1], -0)) {
19364
+ align = 'start';
19365
+ }
19366
+ else if (Object.is(vector[0], -0)) {
19367
+ align = 'end';
19368
+ }
19369
+ }
19370
+ else {
19371
+ align = 'center';
19372
+ }
19373
+ }
19374
+ else if (vector[0] > 0) {
19375
+ align = 'start';
19376
+ }
19377
+ else if (vector[0] < 0) {
19378
+ align = 'end';
19379
+ }
19380
+ return align;
19381
+ }
19355
19382
  getTitleAttribute() {
19356
19383
  var _a, _b, _c;
19357
19384
  const _d = this.attribute.title, { position = 'middle', space = 4, textStyle = {}, autoRotate = true, shape, background, state = {}, maxWidth } = _d, restAttrs = __rest(_d, ["position", "space", "textStyle", "autoRotate", "shape", "background", "state", "maxWidth"]);
@@ -19764,6 +19791,82 @@ class CircleAxisMixin {
19764
19791
  }
19765
19792
  }
19766
19793
 
19794
+ function findSiblingLabels(labels, selfIndex) {
19795
+ const len = labels.length;
19796
+ const prevLabel = selfIndex >= 1 ? labels[selfIndex - 1] : labels[len - 1];
19797
+ const nextLabel = selfIndex < len - 1 ? labels[selfIndex + 1] : labels[0];
19798
+ return { prevLabel, nextLabel };
19799
+ }
19800
+ function adjustMaxLineWidth(label, maxLineWidth, ellipsis) {
19801
+ var _a;
19802
+ label.setAttributes({
19803
+ maxLineWidth,
19804
+ ellipsis: (_a = label.attribute.ellipsis) !== null && _a !== void 0 ? _a : ellipsis
19805
+ });
19806
+ }
19807
+ function adjustMaxHeight(labels, selfIndex, bounds) {
19808
+ const siblings = [];
19809
+ if (labels.length >= 3) {
19810
+ const { prevLabel, nextLabel } = findSiblingLabels(labels, selfIndex);
19811
+ siblings.push(prevLabel, nextLabel);
19812
+ }
19813
+ else if (labels.length === 2) {
19814
+ siblings.push(labels[selfIndex === 0 ? 1 : 0]);
19815
+ }
19816
+ const label = labels[selfIndex];
19817
+ let heightLimit = Math.min(Math.abs(label.attribute.y - bounds.y1), Math.abs(label.attribute.y - bounds.y2));
19818
+ siblings.forEach(sibling => {
19819
+ heightLimit = Math.min(heightLimit, Math.abs(sibling.attribute.y - label.attribute.y));
19820
+ });
19821
+ if (heightLimit > 0) {
19822
+ label.setAttributes({ whiteSpace: 'normal', heightLimit });
19823
+ }
19824
+ }
19825
+ function circleAutoLimit(labels, config) {
19826
+ const { ellipsis, inside, bounds, autoWrap, center } = config;
19827
+ if (!inside) {
19828
+ labels.forEach((label, index) => {
19829
+ const { x, y } = label.attribute;
19830
+ const b = label.AABBBounds;
19831
+ if (isNumberClose(x, center.x)) {
19832
+ if (y > bounds.y2 || y < bounds.y1) {
19833
+ adjustMaxLineWidth(label, 0, ellipsis);
19834
+ return;
19835
+ }
19836
+ const boxWidth = bounds.x2 - bounds.x1;
19837
+ if (labels.length >= 3) {
19838
+ const { prevLabel, nextLabel } = findSiblingLabels(labels, index);
19839
+ let leftX = prevLabel.attribute.x;
19840
+ let rightX = nextLabel.attribute.x;
19841
+ if (leftX > rightX) {
19842
+ leftX = nextLabel.attribute.x;
19843
+ rightX = prevLabel.attribute.x;
19844
+ }
19845
+ const maxWidth = leftX === rightX
19846
+ ? boxWidth
19847
+ : x >= leftX && x <= rightX
19848
+ ? rightX - leftX
19849
+ : Math.min(Math.abs(leftX - x), Math.abs(rightX - x));
19850
+ if (label.AABBBounds.width() > maxWidth) {
19851
+ adjustMaxLineWidth(label, maxWidth, ellipsis);
19852
+ }
19853
+ }
19854
+ else if (label.AABBBounds.width() > boxWidth) {
19855
+ adjustMaxLineWidth(label, boxWidth, ellipsis);
19856
+ }
19857
+ }
19858
+ else if (x > center.x && b.x2 > bounds.x2) {
19859
+ adjustMaxLineWidth(label, bounds.x2 - x, ellipsis);
19860
+ autoWrap && adjustMaxHeight(labels, index, bounds);
19861
+ }
19862
+ else if (x < center.x && b.x1 < bounds.x1) {
19863
+ adjustMaxLineWidth(label, x - bounds.x1, ellipsis);
19864
+ autoWrap && adjustMaxHeight(labels, index, bounds);
19865
+ }
19866
+ });
19867
+ }
19868
+ }
19869
+
19767
19870
  loadCircleAxisComponent();
19768
19871
  class CircleAxis extends AxisBase {
19769
19872
  constructor(attributes, options) {
@@ -19876,36 +19979,85 @@ class CircleAxis extends AxisBase {
19876
19979
  }
19877
19980
  return subTickLineItems;
19878
19981
  }
19879
- getTextBaseline(vector) {
19880
- let base = 'middle';
19881
- if (isNumberClose(vector[1], 0)) {
19882
- base = 'middle';
19883
- }
19884
- else if (vector[1] > 0 && vector[1] > Math.abs(vector[0])) {
19885
- base = 'top';
19886
- }
19887
- else if (vector[1] < 0 && Math.abs(vector[1]) > Math.abs(vector[0])) {
19888
- base = 'bottom';
19889
- }
19890
- return base;
19891
- }
19892
19982
  beforeLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
19893
19983
  return;
19894
19984
  }
19895
19985
  handleLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
19896
- return;
19986
+ if (isEmpty(labelShapes)) {
19987
+ return;
19988
+ }
19989
+ const { inside, radius, center, width, height, label, orient } = this.attribute;
19990
+ const bounds = width && height
19991
+ ? {
19992
+ x1: 0,
19993
+ y1: 0,
19994
+ x2: width,
19995
+ y2: height
19996
+ }
19997
+ : {
19998
+ x1: center.x - radius,
19999
+ y1: center.y - radius,
20000
+ x2: center.x + radius,
20001
+ y2: center.y + radius
20002
+ };
20003
+ const { layoutFunc, autoLimit, limitEllipsis, autoHide: autoHide$1, autoHideMethod, autoHideSeparation, autoWrap } = label;
20004
+ if (isFunction(layoutFunc)) {
20005
+ layoutFunc(labelShapes, labelData, layer, this);
20006
+ }
20007
+ else {
20008
+ if (autoLimit || autoWrap) {
20009
+ circleAutoLimit(labelShapes, { inside, autoWrap, bounds, ellipsis: limitEllipsis, center });
20010
+ }
20011
+ if (autoHide$1) {
20012
+ autoHide(labelShapes, {
20013
+ orient,
20014
+ method: autoHideMethod,
20015
+ separation: autoHideSeparation
20016
+ });
20017
+ }
20018
+ }
19897
20019
  }
19898
20020
  afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
19899
20021
  return;
19900
20022
  }
20023
+ getTextBaseline(vector) {
20024
+ if (Math.abs(vector[1] / vector[0]) < 0.3) {
20025
+ return 'middle';
20026
+ }
20027
+ else if (vector[1] < 0) {
20028
+ return 'bottom';
20029
+ }
20030
+ else if (vector[1] > 0) {
20031
+ return 'top';
20032
+ }
20033
+ return 'middle';
20034
+ }
19901
20035
  getLabelAlign(vector, inside, angle) {
20036
+ if (isNumberClose(vector[0], 0)) {
20037
+ return {
20038
+ textAlign: 'center',
20039
+ textBaseline: vector[1] > 0 ? 'top' : 'bottom'
20040
+ };
20041
+ }
20042
+ else if (vector[0] < 0) {
20043
+ return {
20044
+ textAlign: 'right',
20045
+ textBaseline: this.getTextBaseline(vector)
20046
+ };
20047
+ }
20048
+ else if (vector[0] > 0) {
20049
+ return {
20050
+ textAlign: 'left',
20051
+ textBaseline: this.getTextBaseline(vector)
20052
+ };
20053
+ }
19902
20054
  return {
19903
20055
  textAlign: 'center',
19904
20056
  textBaseline: 'middle'
19905
20057
  };
19906
20058
  }
19907
20059
  getLabelPosition(point, vector, text, style) {
19908
- return getCircleLabelPosition(point, vector, text, style);
20060
+ return point;
19909
20061
  }
19910
20062
  }
19911
20063
  CircleAxis.defaultAttributes = DEFAULT_AXIS_THEME;
@@ -20401,21 +20553,39 @@ const getPolarAngleLabelBounds = (scale, domain, op) => {
20401
20553
  const labelAngle = (_a = labelStyle.angle) !== null && _a !== void 0 ? _a : 0;
20402
20554
  const textMeasure = initTextMeasure(labelStyle);
20403
20555
  const labelBoundsList = domain.map((v) => {
20404
- var _a, _b;
20405
20556
  const str = labelFormatter ? labelFormatter(v) : `${v}`;
20406
20557
  const { width, height } = textMeasure.quickMeasure(str);
20407
20558
  const textWidth = Math.max(width, MIN_TICK_GAP);
20408
20559
  const textHeight = Math.max(height, MIN_TICK_GAP);
20409
20560
  const angle = scale.scale(v);
20561
+ const center = { x: 0, y: 0 };
20410
20562
  let textX = 0;
20411
20563
  let textY = 0;
20412
20564
  const orient = {
20413
- align: (_a = labelStyle.textAlign) !== null && _a !== void 0 ? _a : 'center',
20414
- baseline: (_b = labelStyle.textBaseline) !== null && _b !== void 0 ? _b : 'middle'
20565
+ align: labelStyle.textAlign,
20566
+ baseline: labelStyle.textBaseline
20415
20567
  };
20416
- const { x, y } = getPolarAngleLabelPosition(angle, { x: 0, y: 0 }, radius, labelOffset, inside, str, labelStyle);
20417
- textX = x + (orient.align === 'right' ? -textWidth : orient.align === 'center' ? -textWidth / 2 : 0);
20418
- textY = y + (orient.baseline === 'bottom' ? -textHeight : orient.baseline === 'middle' ? -textHeight / 2 : 0);
20568
+ const { x, y } = getPolarAngleLabelPosition(angle, center, radius, labelOffset, inside);
20569
+ if (!orient.align) {
20570
+ if (isNumberClose(x, center.x)) {
20571
+ if (!orient.baseline) {
20572
+ if (y > center.y) {
20573
+ orient.baseline = 'top';
20574
+ }
20575
+ else {
20576
+ orient.baseline = 'bottom';
20577
+ }
20578
+ }
20579
+ }
20580
+ else if (x > center.x) {
20581
+ orient.align = 'left';
20582
+ }
20583
+ else if (x < center.x) {
20584
+ orient.align = 'right';
20585
+ }
20586
+ }
20587
+ textX = x + (orient.align === 'right' ? -textWidth : orient.align === 'left' ? 0 : -textWidth / 2);
20588
+ textY = y + (orient.baseline === 'bottom' ? -textHeight : orient.baseline === 'top' ? 0 : -textHeight / 2);
20419
20589
  const bounds = new AABBBounds()
20420
20590
  .set(textX, textY, textX + textWidth, textY + textHeight)
20421
20591
  .rotate(labelAngle, textX + textWidth / 2, textY + textHeight / 2);
@@ -20439,7 +20609,9 @@ const polarAngleAxisDiscreteTicks = (scale, op) => {
20439
20609
  else if (isValid(tickCount)) {
20440
20610
  const range = scale.range();
20441
20611
  const rangeSize = Math.abs(range[range.length - 1] - range[0]);
20442
- const count = isFunction(tickCount) ? tickCount({ axisLength: rangeSize, labelStyle }) : tickCount;
20612
+ const count = isFunction(tickCount)
20613
+ ? tickCount({ axisLength: rangeSize, labelStyle })
20614
+ : tickCount;
20443
20615
  scaleTicks = scale.ticks(count);
20444
20616
  }
20445
20617
  else if (op.sampling) {
@@ -21359,6 +21531,7 @@ class DataZoom extends AbstractComponent {
21359
21531
  return false;
21360
21532
  }
21361
21533
  setTextAttr(startTextBounds, endTextBounds) {
21534
+ var _a, _b, _c, _d, _e, _f, _g, _h;
21362
21535
  const { startTextStyle, endTextStyle } = this.attribute;
21363
21536
  const { formatMethod: startTextFormat } = startTextStyle, restStartTextStyle = __rest(startTextStyle, ["formatMethod"]);
21364
21537
  const { formatMethod: endTextFormat } = endTextStyle, restEndTextStyle = __rest(endTextStyle, ["formatMethod"]);
@@ -21389,11 +21562,11 @@ class DataZoom extends AbstractComponent {
21389
21562
  };
21390
21563
  startTextAlignStyle = {
21391
21564
  textAlign: this.isTextOverflow(componentBoundsLike, startTextBounds, 'start') ? 'left' : 'right',
21392
- textBaseline: 'middle'
21565
+ textBaseline: (_b = (_a = restStartTextStyle === null || restStartTextStyle === void 0 ? void 0 : restStartTextStyle.textStyle) === null || _a === void 0 ? void 0 : _a.textBaseline) !== null && _b !== void 0 ? _b : 'middle'
21393
21566
  };
21394
21567
  endTextAlignStyle = {
21395
21568
  textAlign: this.isTextOverflow(componentBoundsLike, endTextBounds, 'end') ? 'right' : 'left',
21396
- textBaseline: 'middle'
21569
+ textBaseline: (_d = (_c = restEndTextStyle === null || restEndTextStyle === void 0 ? void 0 : restEndTextStyle.textStyle) === null || _c === void 0 ? void 0 : _c.textBaseline) !== null && _d !== void 0 ? _d : 'middle'
21397
21570
  };
21398
21571
  }
21399
21572
  else {
@@ -21406,11 +21579,11 @@ class DataZoom extends AbstractComponent {
21406
21579
  y: position.y + end * height
21407
21580
  };
21408
21581
  startTextAlignStyle = {
21409
- textAlign: 'center',
21582
+ textAlign: (_f = (_e = restStartTextStyle === null || restStartTextStyle === void 0 ? void 0 : restStartTextStyle.textStyle) === null || _e === void 0 ? void 0 : _e.textAlign) !== null && _f !== void 0 ? _f : 'center',
21410
21583
  textBaseline: this.isTextOverflow(componentBoundsLike, startTextBounds, 'start') ? 'top' : 'bottom'
21411
21584
  };
21412
21585
  endTextAlignStyle = {
21413
- textAlign: 'center',
21586
+ textAlign: (_h = (_g = restEndTextStyle === null || restEndTextStyle === void 0 ? void 0 : restEndTextStyle.textStyle) === null || _g === void 0 ? void 0 : _g.textAlign) !== null && _h !== void 0 ? _h : 'center',
21414
21587
  textBaseline: this.isTextOverflow(componentBoundsLike, endTextBounds, 'end') ? 'bottom' : 'top'
21415
21588
  };
21416
21589
  }
@@ -28521,6 +28694,11 @@ class CheckBox extends AbstractComponent {
28521
28694
  stroke: this.attribute.box.checkedStroke
28522
28695
  });
28523
28696
  }
28697
+ else if (this.attribute.disabled) {
28698
+ this._box.setAttributes({
28699
+ fill: this.attribute.box.disableFill
28700
+ });
28701
+ }
28524
28702
  this.appendChild(this._box);
28525
28703
  }
28526
28704
  renderIcon() {
@@ -28689,6 +28867,11 @@ class Radio extends AbstractComponent {
28689
28867
  stroke: this.attribute.circle.checkedStroke
28690
28868
  });
28691
28869
  }
28870
+ else if (this.attribute.disabled) {
28871
+ this._circle.setAttributes({
28872
+ fill: this.attribute.circle.disableFill
28873
+ });
28874
+ }
28692
28875
  this.appendChild(this._circle);
28693
28876
  }
28694
28877
  renderText() {
@@ -28819,6 +29002,6 @@ EmptyTip.defaultAttributes = {
28819
29002
  }
28820
29003
  };
28821
29004
 
28822
- const version = "0.20.3";
29005
+ const version = "0.20.5";
28823
29006
 
28824
29007
  export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, ticks, traverseGroup, version };