@visactor/vrender-components 0.20.3-alpha.0 → 0.20.4

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 (50) hide show
  1. package/cjs/axis/line.js +3 -2
  2. package/cjs/axis/line.js.map +1 -1
  3. package/cjs/axis/overlap/auto-limit.d.ts +2 -0
  4. package/cjs/axis/overlap/auto-limit.js +23 -3
  5. package/cjs/axis/overlap/auto-limit.js.map +1 -1
  6. package/cjs/axis/type.d.ts +4 -0
  7. package/cjs/axis/type.js.map +1 -1
  8. package/cjs/brush/brush.js +2 -1
  9. package/cjs/brush/type.js +1 -2
  10. package/cjs/index.d.ts +1 -1
  11. package/cjs/index.js +1 -1
  12. package/cjs/index.js.map +1 -1
  13. package/cjs/label/arc.d.ts +2 -0
  14. package/cjs/label/arc.js +28 -27
  15. package/cjs/label/arc.js.map +1 -1
  16. package/cjs/label/base.js +1 -1
  17. package/cjs/label/base.js.map +1 -1
  18. package/cjs/label/dataLabel.js +1 -0
  19. package/cjs/label/dataLabel.js.map +1 -1
  20. package/cjs/label/type.d.ts +3 -2
  21. package/cjs/label/type.js.map +1 -1
  22. package/cjs/label/util.d.ts +1 -0
  23. package/cjs/label/util.js +6 -2
  24. package/cjs/label/util.js.map +1 -1
  25. package/dist/index.es.js +93 -48
  26. package/es/axis/line.js +3 -2
  27. package/es/axis/line.js.map +1 -1
  28. package/es/axis/overlap/auto-limit.d.ts +2 -0
  29. package/es/axis/overlap/auto-limit.js +24 -4
  30. package/es/axis/overlap/auto-limit.js.map +1 -1
  31. package/es/axis/type.d.ts +4 -0
  32. package/es/axis/type.js.map +1 -1
  33. package/es/brush/brush.js +2 -1
  34. package/es/brush/type.js +1 -2
  35. package/es/index.d.ts +1 -1
  36. package/es/index.js +1 -1
  37. package/es/index.js.map +1 -1
  38. package/es/label/arc.d.ts +2 -0
  39. package/es/label/arc.js +29 -26
  40. package/es/label/arc.js.map +1 -1
  41. package/es/label/base.js +1 -1
  42. package/es/label/base.js.map +1 -1
  43. package/es/label/dataLabel.js +1 -0
  44. package/es/label/dataLabel.js.map +1 -1
  45. package/es/label/type.d.ts +3 -2
  46. package/es/label/type.js.map +1 -1
  47. package/es/label/util.d.ts +1 -0
  48. package/es/label/util.js +4 -0
  49. package/es/label/util.js.map +1 -1
  50. package/package.json +5 -5
package/dist/index.es.js CHANGED
@@ -4550,7 +4550,7 @@ class Graphic extends Node {
4550
4550
  return this._transMatrix || (this._transMatrix = new Matrix()), this.shouldUpdateLocalMatrix() && (this.doUpdateLocalMatrix(), clearTag && this.clearUpdateLocalPositionTag()), this._transMatrix;
4551
4551
  }
4552
4552
  shouldUpdateAABBBounds() {
4553
- return this.shadowRoot ? !!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds() : !!(this._updateTag & UpdateTag.UPDATE_BOUNDS);
4553
+ return this.shadowRoot ? (!!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds()) && application.graphicService.validCheck(this.attribute, this.getGraphicTheme(), this._AABBBounds, this) : !!(this._updateTag & UpdateTag.UPDATE_BOUNDS) && application.graphicService.validCheck(this.attribute, this.getGraphicTheme(), this._AABBBounds, this);
4554
4554
  }
4555
4555
  shouldSelfChangeUpdateAABBBounds() {
4556
4556
  return this.shadowRoot ? !!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds() : !!(this._updateTag & UpdateTag.UPDATE_BOUNDS);
@@ -9293,7 +9293,6 @@ class Circle extends Graphic {
9293
9293
  return getTheme(this).circle;
9294
9294
  }
9295
9295
  updateAABBBounds(attribute, circleTheme, aabbBounds, full) {
9296
- if (!application.graphicService.validCheck(attribute, circleTheme, aabbBounds, this)) return aabbBounds;
9297
9296
  this.updatePathProxyAABBBounds(aabbBounds) || (full ? this.updateCircleAABBBoundsImprecise(attribute, circleTheme, aabbBounds) : this.updateCircleAABBBoundsAccurate(attribute, circleTheme, aabbBounds));
9298
9297
  const {
9299
9298
  tb1: tb1,
@@ -9486,7 +9485,6 @@ class Text extends Graphic {
9486
9485
  return getTheme(this).text;
9487
9486
  }
9488
9487
  updateAABBBounds(attribute, textTheme, aabbBounds) {
9489
- if (!application.graphicService.validCheck(attribute, textTheme, aabbBounds, this)) return aabbBounds;
9490
9488
  const {
9491
9489
  text = textTheme.text
9492
9490
  } = this.attribute;
@@ -10595,7 +10593,6 @@ let Symbol$1 = class Symbol extends Graphic {
10595
10593
  return getTheme(this).symbol;
10596
10594
  }
10597
10595
  updateAABBBounds(attribute, symbolTheme, aabbBounds, full) {
10598
- if (!application.graphicService.validCheck(attribute, symbolTheme, aabbBounds, this)) return aabbBounds;
10599
10596
  this.updatePathProxyAABBBounds(aabbBounds) || (full ? this.updateSymbolAABBBoundsImprecise(attribute, symbolTheme, aabbBounds) : this.updateSymbolAABBBoundsAccurate(attribute, symbolTheme, aabbBounds));
10600
10597
  const {
10601
10598
  tb1: tb1,
@@ -10673,7 +10670,6 @@ let Line$1 = class Line extends Graphic {
10673
10670
  return getTheme(this).line;
10674
10671
  }
10675
10672
  updateAABBBounds(attribute, lineTheme, aabbBounds) {
10676
- if (!application.graphicService.validCheck(attribute, lineTheme, aabbBounds, this)) return aabbBounds;
10677
10673
  this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds) : this.updateLineAABBBoundsByPoints(attribute, lineTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds);
10678
10674
  const {
10679
10675
  lineJoin = lineTheme.lineJoin
@@ -10754,7 +10750,6 @@ class Rect extends Graphic {
10754
10750
  return getTheme(this).rect;
10755
10751
  }
10756
10752
  updateAABBBounds(attribute, rectTheme, aabbBounds) {
10757
- if (!application.graphicService.validCheck(attribute, rectTheme, aabbBounds, this)) return aabbBounds;
10758
10753
  if (!this.updatePathProxyAABBBounds(aabbBounds)) {
10759
10754
  let {
10760
10755
  width: width,
@@ -11079,7 +11074,6 @@ class Image extends Graphic {
11079
11074
  return getTheme(this).image;
11080
11075
  }
11081
11076
  updateAABBBounds(attribute, imageTheme, aabbBounds) {
11082
- if (!application.graphicService.validCheck(attribute, imageTheme, aabbBounds, this)) return aabbBounds;
11083
11077
  if (!this.updatePathProxyAABBBounds(aabbBounds)) {
11084
11078
  const {
11085
11079
  width = imageTheme.width,
@@ -11279,7 +11273,13 @@ class Wrapper {
11279
11273
  const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", "fill", "stroke", "fontSize", ...GRAPHIC_UPDATE_TAG_KEY];
11280
11274
  class RichText extends Graphic {
11281
11275
  constructor(params) {
11282
- super(params), this.type = "richtext", this._currentHoverIcon = null, this.numberType = RICHTEXT_NUMBER_TYPE;
11276
+ super(params), this.type = "richtext", this._currentHoverIcon = null, this.numberType = RICHTEXT_NUMBER_TYPE, this.onBeforeAttributeUpdate = (val, attributes, key) => {
11277
+ for (const key in val) if ("hoverIconId" === key) {
11278
+ if (val[key] === attributes[key]) continue;
11279
+ const icon = this._frameCache.icons.get(val[key]);
11280
+ this.updateHoverIconState(icon);
11281
+ }
11282
+ };
11283
11283
  }
11284
11284
  get width() {
11285
11285
  var _a;
@@ -11353,7 +11353,6 @@ class RichText extends Graphic {
11353
11353
  return getTheme(this).richtext;
11354
11354
  }
11355
11355
  updateAABBBounds(attribute, richtextTheme, aabbBounds) {
11356
- if (!application.graphicService.validCheck(attribute, richtextTheme, aabbBounds, this)) return aabbBounds;
11357
11356
  const {
11358
11357
  width = richtextTheme.width,
11359
11358
  height = richtextTheme.height,
@@ -11451,8 +11450,9 @@ class RichText extends Graphic {
11451
11450
  paragraphs = [],
11452
11451
  textConfig = null != tc ? tc : _tc;
11453
11452
  for (let i = 0; i < textConfig.length; i++) if ("image" in textConfig[i]) {
11454
- const config = this.combinedStyleToCharacter(textConfig[i]),
11455
- iconCache = config.id && this._frameCache && this._frameCache.icons && this._frameCache.icons.get(config.id);
11453
+ const config = this.combinedStyleToCharacter(textConfig[i]);
11454
+ config.lineWidth = void 0;
11455
+ const iconCache = config.id && this._frameCache && this._frameCache.icons && this._frameCache.icons.get(config.id);
11456
11456
  if (iconCache) paragraphs.push(iconCache);else {
11457
11457
  const icon = new RichTextIcon(config);
11458
11458
  icon.successCallback = () => {
@@ -11502,14 +11502,16 @@ class RichText extends Graphic {
11502
11502
  }
11503
11503
  bindIconEvent() {
11504
11504
  this.addEventListener("pointermove", e => {
11505
- var _a, _b, _c, _d, _e;
11506
11505
  const pickedIcon = this.pickIcon(e.global);
11507
- 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()));
11506
+ pickedIcon && pickedIcon === this._currentHoverIcon || (pickedIcon ? this.setAttribute("hoverIconId", pickedIcon.richtextId) : !pickedIcon && this._currentHoverIcon && this.setAttribute("hoverIconId", void 0));
11508
11507
  }), this.addEventListener("pointerleave", e => {
11509
- var _a, _b;
11510
- 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());
11508
+ this._currentHoverIcon && this.setAttribute("hoverIconId", void 0);
11511
11509
  });
11512
11510
  }
11511
+ updateHoverIconState(pickedIcon) {
11512
+ var _a, _b, _c, _d, _e;
11513
+ 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());
11514
+ }
11513
11515
  pickIcon(point) {
11514
11516
  const frameCache = this.getFrameCache(),
11515
11517
  {
@@ -11517,7 +11519,7 @@ class RichText extends Graphic {
11517
11519
  f: y
11518
11520
  } = this.globalTransMatrix;
11519
11521
  let pickIcon;
11520
- return frameCache.icons.forEach(icon => {
11522
+ return frameCache.icons.forEach((icon, key) => {
11521
11523
  var _a, _b;
11522
11524
  const bounds = icon.AABBBounds.clone();
11523
11525
  bounds.translate(icon._marginArray[3], icon._marginArray[0]), bounds.containsPoint({
@@ -11570,7 +11572,6 @@ class Path extends Graphic {
11570
11572
  return getTheme(this).path;
11571
11573
  }
11572
11574
  updateAABBBounds(attribute, pathTheme, aabbBounds) {
11573
- if (!application.graphicService.validCheck(attribute, pathTheme, aabbBounds, this)) return aabbBounds;
11574
11575
  if (!this.updatePathProxyAABBBounds(aabbBounds)) {
11575
11576
  const pathShape = this.getParsedPathShape();
11576
11577
  aabbBounds.union(pathShape.getBounds());
@@ -11636,7 +11637,6 @@ class Area extends Graphic {
11636
11637
  return getTheme(this).area;
11637
11638
  }
11638
11639
  updateAABBBounds(attribute, areaTheme, aabbBounds) {
11639
- if (!application.graphicService.validCheck(attribute, areaTheme, aabbBounds, this)) return aabbBounds;
11640
11640
  this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateAreaAABBBoundsBySegments(attribute, areaTheme, aabbBounds) : this.updateAreaAABBBoundsByPoints(attribute, areaTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds);
11641
11641
  const {
11642
11642
  lineJoin = areaTheme.lineJoin
@@ -11837,7 +11837,6 @@ class Arc extends Graphic {
11837
11837
  return getTheme(this).arc;
11838
11838
  }
11839
11839
  updateAABBBounds(attribute, arcTheme, aabbBounds, full) {
11840
- if (!application.graphicService.validCheck(attribute, arcTheme, aabbBounds, this)) return aabbBounds;
11841
11840
  this.updatePathProxyAABBBounds(aabbBounds) || (full ? this.updateArcAABBBoundsImprecise(attribute, arcTheme, aabbBounds) : this.updateArcAABBBoundsAccurate(attribute, arcTheme, aabbBounds));
11842
11841
  const {
11843
11842
  tb1: tb1,
@@ -11945,7 +11944,6 @@ class Polygon extends Graphic {
11945
11944
  return getTheme(this).polygon;
11946
11945
  }
11947
11946
  updateAABBBounds(attribute, polygonTheme, aabbBounds) {
11948
- if (!application.graphicService.validCheck(attribute, polygonTheme, aabbBounds, this)) return aabbBounds;
11949
11947
  this.updatePathProxyAABBBounds(aabbBounds) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds), application.graphicService.updateTempAABBBounds(aabbBounds);
11950
11948
  const {
11951
11949
  lineJoin = polygonTheme.lineJoin
@@ -16114,6 +16112,15 @@ function getIntersection(dx, dy, cx, cy, w, h) {
16114
16112
  }
16115
16113
  return { x: cx + (dx * h) / Math.abs(dy), y: cy + (dy > 0 ? h : -h) };
16116
16114
  }
16115
+ function getAlignOffset(align) {
16116
+ if (align === 'left') {
16117
+ return 0;
16118
+ }
16119
+ else if (align === 'right') {
16120
+ return 1;
16121
+ }
16122
+ return 0.5;
16123
+ }
16117
16124
 
16118
16125
  function loadLabelComponent() {
16119
16126
  registerGroup();
@@ -16720,7 +16727,7 @@ class LabelBase extends AbstractComponent {
16720
16727
  const point = this._idToPoint.get(text.attribute.id);
16721
16728
  if (point &&
16722
16729
  (!text.animates || !text.animates.has('label-animate')) &&
16723
- relatedGraphic.containsPoint(point.x, point.y, IContainPointMode.LOCAL, (_c = this.stage) === null || _c === void 0 ? void 0 : _c.pickerService)) {
16730
+ relatedGraphic.containsPoint(point.x, point.y, IContainPointMode.LOCAL, (_c = this.stage) === null || _c === void 0 ? void 0 : _c.getPickerService())) {
16724
16731
  text.animate({ onStart }).wait(delay).to(to, duration, easing);
16725
16732
  labelLine && labelLine.animate().wait(delay).to(to, duration, easing);
16726
16733
  }
@@ -16989,6 +16996,8 @@ class ArcLabel extends LabelBase {
16989
16996
  this._ellipsisWidth = 0;
16990
16997
  this._arcLeft = new Map();
16991
16998
  this._arcRight = new Map();
16999
+ this._line2MinLength = 0;
17000
+ this._alignOffset = 0;
16992
17001
  }
16993
17002
  _overlapping(labels) {
16994
17003
  return labels;
@@ -17000,6 +17009,7 @@ class ArcLabel extends LabelBase {
17000
17009
  return { x: 0, y: 0 };
17001
17010
  }
17002
17011
  _layout(texts) {
17012
+ var _a;
17003
17013
  if (!texts || !texts.length) {
17004
17014
  return;
17005
17015
  }
@@ -17013,7 +17023,15 @@ class ArcLabel extends LabelBase {
17013
17023
  ellipsisWidth = ellipsisTextBounds.x2 - ellipsisTextBounds.x1;
17014
17024
  }
17015
17025
  const data = labels.map(label => label.attribute);
17016
- const arcs = this.layoutArcLabels(this.attribute.position, this.attribute, Array.from(this._idToGraphic.values()), data, textBoundsArray, ellipsisWidth);
17026
+ const currentMarks = Array.from(this._idToGraphic.values());
17027
+ this._line2MinLength = isFunction(this.attribute.line.line2MinLength)
17028
+ ? this.attribute.line.line2MinLength(texts, currentMarks, this.attribute)
17029
+ : this.attribute.line.line2MinLength;
17030
+ this._alignOffset =
17031
+ (_a = (isFunction(this.attribute.layout.alignOffset)
17032
+ ? this.attribute.layout.alignOffset(texts, currentMarks, this.attribute)
17033
+ : this.attribute.layout.alignOffset)) !== null && _a !== void 0 ? _a : 0;
17034
+ const arcs = this.layoutArcLabels(this.attribute.position, this.attribute, currentMarks, data, textBoundsArray, ellipsisWidth);
17017
17035
  for (let i = 0; i < data.length; i++) {
17018
17036
  const textData = data[i];
17019
17037
  const basedArc = arcs.find(arc => { var _a; return ((_a = arc.refDatum) === null || _a === void 0 ? void 0 : _a.id) === textData.id; });
@@ -17160,13 +17178,12 @@ class ArcLabel extends LabelBase {
17160
17178
  var _a, _b, _c;
17161
17179
  const center = { x: (_a = currentMarks[0].attribute.x) !== null && _a !== void 0 ? _a : 0, y: (_b = currentMarks[0].attribute.y) !== null && _b !== void 0 ? _b : 0 };
17162
17180
  const height = center.y * 2;
17163
- const line2MinLength = attribute.line.line2MinLength;
17164
17181
  const labelLayout = attribute.layout;
17165
17182
  const spaceWidth = attribute.spaceWidth;
17166
17183
  arcs.forEach(arc => {
17167
17184
  const direction = isQuadrantLeft(arc.quadrant) ? -1 : 1;
17168
17185
  arc.labelPosition = {
17169
- x: arc.outerCenter.x + direction * (arc.labelSize.width / 2 + line2MinLength + spaceWidth),
17186
+ x: arc.outerCenter.x + direction * (arc.labelSize.width / 2 + this._line2MinLength + spaceWidth),
17170
17187
  y: arc.outerCenter.y
17171
17188
  };
17172
17189
  });
@@ -17179,11 +17196,11 @@ class ArcLabel extends LabelBase {
17179
17196
  arc.labelLimit = labelSize.width;
17180
17197
  arc.pointB = isQuadrantLeft(arc.quadrant)
17181
17198
  ? {
17182
- x: labelPosition.x + labelSize.width / 2 + line2MinLength + spaceWidth,
17199
+ x: labelPosition.x + labelSize.width / 2 + this._line2MinLength + spaceWidth,
17183
17200
  y: labelPosition.y
17184
17201
  }
17185
17202
  : {
17186
- x: labelPosition.x - labelSize.width / 2 - line2MinLength - spaceWidth,
17203
+ x: labelPosition.x - labelSize.width / 2 - this._line2MinLength - spaceWidth,
17187
17204
  y: labelPosition.y
17188
17205
  };
17189
17206
  this._computeX(arc, attribute, currentMarks);
@@ -17212,22 +17229,27 @@ class ArcLabel extends LabelBase {
17212
17229
  arcs.forEach(arc => {
17213
17230
  var _a, _b;
17214
17231
  if (arc.labelVisible &&
17215
- (isLess(arc.pointB.x, line2MinLength + spaceWidth) ||
17216
- isGreater(arc.pointB.x, width - line2MinLength - spaceWidth))) {
17232
+ (isLess(arc.pointB.x, this._line2MinLength + spaceWidth) ||
17233
+ isGreater(arc.pointB.x, width - this._line2MinLength - spaceWidth))) {
17217
17234
  arc.labelVisible = false;
17218
17235
  }
17219
17236
  arc.angle = (_b = (_a = attribute.textStyle) === null || _a === void 0 ? void 0 : _a.angle) !== null && _b !== void 0 ? _b : 0;
17220
17237
  if (attribute.offsetAngle) {
17221
17238
  arc.angle += attribute.offsetAngle;
17222
17239
  }
17223
- arc.labelLine = Object.assign({}, attribute.line);
17240
+ arc.labelLine = Object.assign(Object.assign({}, attribute.line), { visible: arc.labelVisible });
17224
17241
  });
17225
17242
  return arcs;
17226
17243
  }
17227
17244
  _computeX(arc, attribute, currentMarks) {
17228
17245
  var _a;
17229
17246
  const center = arc.circleCenter;
17230
- const plotLayout = { width: center.x * 2, height: center.y * 2 };
17247
+ const plotLayout = {
17248
+ x1: 0,
17249
+ x2: this.attribute.width,
17250
+ y1: 0,
17251
+ y2: this.attribute.height
17252
+ };
17231
17253
  let maxRadius = 0;
17232
17254
  currentMarks.forEach((currentMark) => {
17233
17255
  if (currentMark.attribute.outerRadius > maxRadius) {
@@ -17236,7 +17258,6 @@ class ArcLabel extends LabelBase {
17236
17258
  });
17237
17259
  const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
17238
17260
  const line1MinLength = attribute.line.line1MinLength;
17239
- const line2MinLength = attribute.line.line2MinLength;
17240
17261
  const labelLayoutAlign = (_a = attribute.layout) === null || _a === void 0 ? void 0 : _a.align;
17241
17262
  const spaceWidth = attribute.spaceWidth;
17242
17263
  const { labelPosition, quadrant, pointB } = arc;
@@ -17248,11 +17269,10 @@ class ArcLabel extends LabelBase {
17248
17269
  const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height);
17249
17270
  const flag = isQuadrantLeft(quadrant) ? -1 : 1;
17250
17271
  let cx = 0;
17251
- const restWidth = flag > 0 ? plotLayout.width - pointB.x : pointB.x;
17252
- let limit = restWidth - line2MinLength - spaceWidth;
17272
+ let limit = (flag > 0 ? plotLayout.x2 - pointB.x : pointB.x - plotLayout.x1) - this._line2MinLength - spaceWidth;
17253
17273
  if (labelLayoutAlign === 'labelLine') {
17254
- cx = (radius + line1MinLength + line2MinLength) * flag + center.x;
17255
- limit = (flag > 0 ? plotLayout.width - cx : cx) - spaceWidth;
17274
+ cx = (radius + line1MinLength + this._line2MinLength) * flag + center.x;
17275
+ limit = (flag > 0 ? plotLayout.x2 - cx : cx - plotLayout.x1) - spaceWidth;
17256
17276
  }
17257
17277
  const text = this._getFormatLabelText(arc.refDatum, limit);
17258
17278
  arc.labelText = text;
@@ -17261,24 +17281,25 @@ class ArcLabel extends LabelBase {
17261
17281
  case 'labelLine':
17262
17282
  break;
17263
17283
  case 'edge':
17264
- cx = flag > 0 ? plotLayout.width - labelWidth - spaceWidth : labelWidth + spaceWidth;
17284
+ cx = flag > 0 ? plotLayout.x2 - labelWidth - spaceWidth : plotLayout.x1 + labelWidth + spaceWidth;
17265
17285
  break;
17266
17286
  case 'arc':
17267
17287
  default:
17268
- cx = pointB.x + flag * line2MinLength;
17288
+ cx = pointB.x + flag * this._line2MinLength;
17269
17289
  break;
17270
17290
  }
17271
17291
  labelWidth = Math.max(this._ellipsisWidth, labelWidth);
17272
17292
  arc.labelLimit = labelWidth;
17273
17293
  arc.pointC = { x: cx, y: labelPosition.y };
17274
- const targetCenterOffset = 0.5 * (arc.labelLimit < arc.labelSize.width ? arc.labelLimit : arc.labelSize.width);
17294
+ const align = this._computeAlign(arc, attribute);
17295
+ const targetCenterOffset = getAlignOffset(align) * (arc.labelLimit < arc.labelSize.width ? arc.labelLimit : arc.labelSize.width);
17275
17296
  if (labelLayoutAlign === 'edge') {
17276
- const alignOffset = 0;
17277
- labelPosition.x = (flag > 0 ? plotLayout.width + alignOffset : alignOffset) - flag * targetCenterOffset;
17297
+ labelPosition.x =
17298
+ (flag > 0 ? plotLayout.x2 : plotLayout.x1) - flag * targetCenterOffset + flag * this._alignOffset;
17299
+ arc.pointC.x += flag * this._alignOffset;
17278
17300
  }
17279
17301
  else {
17280
- const alignOffset = 0;
17281
- labelPosition.x = cx + alignOffset + flag * (spaceWidth + targetCenterOffset);
17302
+ labelPosition.x = cx + flag * (this._alignOffset + spaceWidth + targetCenterOffset);
17282
17303
  }
17283
17304
  }
17284
17305
  _computeAlign(arc, attribute) {
@@ -17736,6 +17757,10 @@ class DataLabel extends AbstractComponent {
17736
17757
  if (labelComponent) {
17737
17758
  const { baseMarkGroupName, type } = dataLabel;
17738
17759
  const id = (_a = dataLabel.id) !== null && _a !== void 0 ? _a : `${baseMarkGroupName}-${type}-${i}`;
17760
+ if (dataLabel.type === 'arc') {
17761
+ dataLabel.width = size.width;
17762
+ dataLabel.height = size.height;
17763
+ }
17739
17764
  let component = this._componentMap.get(id);
17740
17765
  if (component) {
17741
17766
  component.setBitmapTool(tool);
@@ -18995,11 +19020,27 @@ function getYAxisLabelAlign(orient, angle = 0) {
18995
19020
  };
18996
19021
  }
18997
19022
 
19023
+ function normalizeOverflowLimitLength(overflowLimitLength) {
19024
+ if (isValidNumber(overflowLimitLength)) {
19025
+ return {
19026
+ left: overflowLimitLength,
19027
+ right: overflowLimitLength
19028
+ };
19029
+ }
19030
+ else if (isObject(overflowLimitLength)) {
19031
+ return {
19032
+ left: overflowLimitLength.left || 0,
19033
+ right: overflowLimitLength.right || 0
19034
+ };
19035
+ }
19036
+ return { left: 0, right: 0 };
19037
+ }
18998
19038
  function autoLimit(labels, config) {
18999
19039
  const { limitLength, verticalLimitLength, ellipsis = '...', orient, axisLength } = config;
19000
19040
  if (isEmpty(labels) || !isValidNumber(limitLength)) {
19001
19041
  return;
19002
19042
  }
19043
+ const overflowLimitLength = normalizeOverflowLimitLength(config.overflowLimitLength);
19003
19044
  labels.forEach(label => {
19004
19045
  var _a;
19005
19046
  const angle = label.attribute.angle;
@@ -19036,14 +19077,17 @@ function autoLimit(labels, config) {
19036
19077
  if (isX) {
19037
19078
  const { x1, x2 } = label.AABBBounds;
19038
19079
  const tan = sin / cos;
19080
+ const verticalSizeLimit = Math.abs(limitLength / sin);
19039
19081
  if (tan > 0 && x1 <= axisLength && limitLength / tan + x1 > axisLength) {
19040
- limitLabelLength = (axisLength - x1) / Math.abs(cos);
19082
+ const lengthLimit = (axisLength - x1) / Math.abs(cos) + overflowLimitLength.right;
19083
+ limitLabelLength = Math.min(lengthLimit, verticalSizeLimit);
19041
19084
  }
19042
19085
  else if (tan < 0 && x2 >= 0 && limitLength / tan + x2 < 0) {
19043
- limitLabelLength = x2 / Math.abs(cos);
19086
+ const lengthLimit = x2 / Math.abs(cos) + overflowLimitLength.left;
19087
+ limitLabelLength = Math.min(lengthLimit, verticalSizeLimit);
19044
19088
  }
19045
19089
  else {
19046
- limitLabelLength = Math.abs(limitLength / sin);
19090
+ limitLabelLength = verticalSizeLimit;
19047
19091
  }
19048
19092
  }
19049
19093
  else {
@@ -19578,7 +19622,7 @@ class LineAxis extends AxisBase {
19578
19622
  }
19579
19623
  const { verticalLimitSize, label, orient } = this.attribute;
19580
19624
  const limitLength = this._getAxisLabelLimitLength(verticalLimitSize, layerCount);
19581
- const { layoutFunc, autoRotate: autoRotate$1, autoRotateAngle, autoLimit: autoLimit$1, limitEllipsis, autoHide: autoHide$1, autoHideMethod, autoHideSeparation, lastVisible, autoWrap: autoWrap$1 } = label;
19625
+ const { layoutFunc, autoRotate: autoRotate$1, autoRotateAngle, autoLimit: autoLimit$1, limitEllipsis, autoHide: autoHide$1, autoHideMethod, autoHideSeparation, lastVisible, autoWrap: autoWrap$1, overflowLimitLength } = label;
19582
19626
  if (isFunction(layoutFunc)) {
19583
19627
  layoutFunc(labelShapes, labelData, layer, this);
19584
19628
  }
@@ -19611,7 +19655,8 @@ class LineAxis extends AxisBase {
19611
19655
  verticalLimitLength,
19612
19656
  ellipsis: limitEllipsis,
19613
19657
  orient,
19614
- axisLength
19658
+ axisLength,
19659
+ overflowLimitLength
19615
19660
  });
19616
19661
  }
19617
19662
  if (autoHide$1) {
@@ -28783,6 +28828,6 @@ EmptyTip.defaultAttributes = {
28783
28828
  }
28784
28829
  };
28785
28830
 
28786
- const version = "0.20.3-alpha.0";
28831
+ const version = "0.20.4";
28787
28832
 
28788
28833
  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 };
package/es/axis/line.js CHANGED
@@ -247,7 +247,7 @@ export class LineAxis extends AxisBase {
247
247
  }
248
248
  handleLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
249
249
  if (isEmpty(labelShapes)) return;
250
- const {verticalLimitSize: verticalLimitSize, label: label, orient: orient} = this.attribute, limitLength = this._getAxisLabelLimitLength(verticalLimitSize, layerCount), {layoutFunc: layoutFunc, autoRotate: autoRotate, autoRotateAngle: autoRotateAngle, autoLimit: autoLimit, limitEllipsis: limitEllipsis, autoHide: autoHide, autoHideMethod: autoHideMethod, autoHideSeparation: autoHideSeparation, lastVisible: lastVisible, autoWrap: autoWrap} = label;
250
+ const {verticalLimitSize: verticalLimitSize, label: label, orient: orient} = this.attribute, limitLength = this._getAxisLabelLimitLength(verticalLimitSize, layerCount), {layoutFunc: layoutFunc, autoRotate: autoRotate, autoRotateAngle: autoRotateAngle, autoLimit: autoLimit, limitEllipsis: limitEllipsis, autoHide: autoHide, autoHideMethod: autoHideMethod, autoHideSeparation: autoHideSeparation, lastVisible: lastVisible, autoWrap: autoWrap, overflowLimitLength: overflowLimitLength} = label;
251
251
  if (isFunction(layoutFunc)) layoutFunc(labelShapes, labelData, layer, this); else {
252
252
  if (autoRotate) autoRotateFunc(labelShapes, {
253
253
  labelRotateAngle: autoRotateAngle,
@@ -268,7 +268,8 @@ export class LineAxis extends AxisBase {
268
268
  verticalLimitLength: verticalLimitLength,
269
269
  ellipsis: limitEllipsis,
270
270
  orient: orient,
271
- axisLength: axisLength
271
+ axisLength: axisLength,
272
+ overflowLimitLength: overflowLimitLength
272
273
  });
273
274
  }
274
275
  autoHide && autoHideFunc(labelShapes, {