@visactor/vrender-components 0.17.8 → 0.17.10

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 (67) hide show
  1. package/cjs/axis/base.js +20 -16
  2. package/cjs/axis/base.js.map +1 -1
  3. package/cjs/axis/line.js +21 -15
  4. package/cjs/axis/line.js.map +1 -1
  5. package/cjs/axis/overlap/auto-hide.d.ts +1 -0
  6. package/cjs/axis/overlap/auto-hide.js +10 -2
  7. package/cjs/axis/overlap/auto-hide.js.map +1 -1
  8. package/cjs/axis/overlap/auto-limit.d.ts +1 -0
  9. package/cjs/axis/overlap/auto-limit.js +5 -3
  10. package/cjs/axis/overlap/auto-limit.js.map +1 -1
  11. package/cjs/axis/type.d.ts +1 -0
  12. package/cjs/axis/type.js.map +1 -1
  13. package/cjs/index.d.ts +1 -1
  14. package/cjs/index.js +1 -1
  15. package/cjs/index.js.map +1 -1
  16. package/cjs/label/arc.d.ts +1 -1
  17. package/cjs/label/arc.js +34 -31
  18. package/cjs/label/arc.js.map +1 -1
  19. package/cjs/label/base.d.ts +4 -7
  20. package/cjs/label/base.js +37 -24
  21. package/cjs/label/base.js.map +1 -1
  22. package/cjs/label/type.d.ts +10 -3
  23. package/cjs/label/type.js.map +1 -1
  24. package/cjs/label/util.d.ts +4 -0
  25. package/cjs/label/util.js +20 -2
  26. package/cjs/label/util.js.map +1 -1
  27. package/cjs/legend/discrete/discrete.js +2 -2
  28. package/cjs/legend/discrete/discrete.js.map +1 -1
  29. package/cjs/tag/tag.js +5 -2
  30. package/cjs/tag/tag.js.map +1 -1
  31. package/cjs/tag/type.d.ts +1 -0
  32. package/cjs/tag/type.js.map +1 -1
  33. package/dist/index.js +308 -257
  34. package/dist/index.min.js +1 -1
  35. package/es/axis/base.js +19 -16
  36. package/es/axis/base.js.map +1 -1
  37. package/es/axis/line.js +21 -13
  38. package/es/axis/line.js.map +1 -1
  39. package/es/axis/overlap/auto-hide.d.ts +1 -0
  40. package/es/axis/overlap/auto-hide.js +10 -2
  41. package/es/axis/overlap/auto-hide.js.map +1 -1
  42. package/es/axis/overlap/auto-limit.d.ts +1 -0
  43. package/es/axis/overlap/auto-limit.js +5 -3
  44. package/es/axis/overlap/auto-limit.js.map +1 -1
  45. package/es/axis/type.d.ts +1 -0
  46. package/es/axis/type.js.map +1 -1
  47. package/es/index.d.ts +1 -1
  48. package/es/index.js +1 -1
  49. package/es/index.js.map +1 -1
  50. package/es/label/arc.d.ts +1 -1
  51. package/es/label/arc.js +34 -31
  52. package/es/label/arc.js.map +1 -1
  53. package/es/label/base.d.ts +4 -7
  54. package/es/label/base.js +38 -25
  55. package/es/label/base.js.map +1 -1
  56. package/es/label/type.d.ts +10 -3
  57. package/es/label/type.js.map +1 -1
  58. package/es/label/util.d.ts +4 -0
  59. package/es/label/util.js +18 -1
  60. package/es/label/util.js.map +1 -1
  61. package/es/legend/discrete/discrete.js +3 -2
  62. package/es/legend/discrete/discrete.js.map +1 -1
  63. package/es/tag/tag.js +5 -2
  64. package/es/tag/tag.js.map +1 -1
  65. package/es/tag/type.d.ts +1 -0
  66. package/es/tag/type.js.map +1 -1
  67. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -2327,6 +2327,10 @@
2327
2327
  var defined0 = !1;
2328
2328
  for (var i = 0, n = points.length; i <= n; i++) i >= n === defined0 && ((defined0 = !defined0) ? path.lineStart() : path.lineEnd()), defined0 && path.point(points[i]);
2329
2329
  }
2330
+ function genSegContext(curveType, direction, points) {
2331
+ var curveDirection = null != direction ? direction : vutils.abs(points[points.length - 1].x - points[0].x) > vutils.abs(points[points.length - 1].y - points[0].y) ? Direction$1.ROW : Direction$1.COLUMN;
2332
+ return "monotoneY" === curveType ? new ReflectSegContext(curveType, curveDirection) : new SegContext(curveType, curveDirection);
2333
+ }
2330
2334
 
2331
2335
  var Linear = /*#__PURE__*/function () {
2332
2336
  function Linear(context, startPoint) {
@@ -2382,7 +2386,7 @@
2382
2386
  var direction = params.direction,
2383
2387
  startPoint = params.startPoint;
2384
2388
  if (points.length < 2 - Number(!!startPoint)) return null;
2385
- var segContext = new SegContext("linear", null != direction ? direction : vutils.abs(points[points.length - 1].x - points[0].x) > vutils.abs(points[points.length - 1].y - points[0].y) ? Direction$1.ROW : Direction$1.COLUMN);
2389
+ var segContext = genSegContext("linear", direction, points);
2386
2390
  return genLinearTypeSegments(new Linear(segContext, startPoint), points), segContext;
2387
2391
  }
2388
2392
  function genLinearTypeSegments(path, points) {
@@ -2452,7 +2456,7 @@
2452
2456
  startPoint = params.startPoint;
2453
2457
  if (points.length < 2 - Number(!!startPoint)) return null;
2454
2458
  if (points.length < 3 - Number(!!startPoint)) return genLinearSegments(points, params);
2455
- var segContext = new SegContext("basis", null != direction ? direction : vutils.abs(points[points.length - 1].x - points[0].x) > vutils.abs(points[points.length - 1].y - points[0].y) ? Direction$1.ROW : Direction$1.COLUMN);
2459
+ var segContext = genSegContext("basis", direction, points);
2456
2460
  return genBasisTypeSegments(new Basis(segContext, startPoint), points), segContext;
2457
2461
  }
2458
2462
 
@@ -2559,7 +2563,7 @@
2559
2563
  }]);
2560
2564
  return MonotoneY;
2561
2565
  }(MonotoneX);
2562
- function genMonotpneXTypeSegments(path, points) {
2566
+ function genMonotoneXTypeSegments(path, points) {
2563
2567
  return genCurveSegments(path, points);
2564
2568
  }
2565
2569
  function genMonotoneXSegments(points) {
@@ -2568,10 +2572,10 @@
2568
2572
  startPoint = params.startPoint;
2569
2573
  if (points.length < 2 - Number(!!startPoint)) return null;
2570
2574
  if (points.length < 3 - Number(!!startPoint)) return genLinearSegments(points, params);
2571
- var segContext = new SegContext("monotoneX", null != direction ? direction : vutils.abs(points[points.length - 1].x - points[0].x) > vutils.abs(points[points.length - 1].y - points[0].y) ? Direction$1.ROW : Direction$1.COLUMN);
2572
- return genMonotpneXTypeSegments(new MonotoneX(segContext, startPoint), points), segContext;
2575
+ var segContext = genSegContext("monotoneX", direction, points);
2576
+ return genMonotoneXTypeSegments(new MonotoneX(segContext, startPoint), points), segContext;
2573
2577
  }
2574
- function genMonotpneYTypeSegments(path, points) {
2578
+ function genMonotoneYTypeSegments(path, points) {
2575
2579
  return genCurveSegments(path, points);
2576
2580
  }
2577
2581
  function genMonotoneYSegments(points) {
@@ -2580,8 +2584,8 @@
2580
2584
  startPoint = params.startPoint;
2581
2585
  if (points.length < 2 - Number(!!startPoint)) return null;
2582
2586
  if (points.length < 3 - Number(!!startPoint)) return genLinearSegments(points, params);
2583
- var segContext = new ReflectSegContext("monotoneY", null != direction ? direction : vutils.abs(points[points.length - 1].x - points[0].x) > vutils.abs(points[points.length - 1].y - points[0].y) ? Direction$1.ROW : Direction$1.COLUMN);
2584
- return genMonotpneYTypeSegments(new MonotoneY(segContext, startPoint), points), segContext;
2587
+ var segContext = genSegContext("monotoneY", direction, points);
2588
+ return genMonotoneYTypeSegments(new MonotoneY(segContext, startPoint), points), segContext;
2585
2589
  }
2586
2590
 
2587
2591
  var Step$1 = /*#__PURE__*/function () {
@@ -2650,61 +2654,27 @@
2650
2654
  return genCurveSegments(path, points);
2651
2655
  }
2652
2656
 
2653
- var LinearClosed = /*#__PURE__*/function () {
2654
- function LinearClosed(context, startPoint) {
2657
+ var LinearClosed = /*#__PURE__*/function (_Linear) {
2658
+ _inherits(LinearClosed, _Linear);
2659
+ var _super = _createSuper(LinearClosed);
2660
+ function LinearClosed() {
2655
2661
  _classCallCheck(this, LinearClosed);
2656
- this.context = context, startPoint && (this.startPoint = startPoint);
2662
+ return _super.apply(this, arguments);
2657
2663
  }
2658
2664
  _createClass(LinearClosed, [{
2659
- key: "areaStart",
2660
- value: function areaStart() {
2661
- this._line = 0;
2662
- }
2663
- }, {
2664
- key: "areaEnd",
2665
- value: function areaEnd() {
2666
- this._line = NaN;
2667
- }
2668
- }, {
2669
- key: "lineStart",
2670
- value: function lineStart() {
2671
- this._point = 0, this.startPoint && this.point(this.startPoint);
2672
- }
2673
- }, {
2674
2665
  key: "lineEnd",
2675
2666
  value: function lineEnd() {
2676
2667
  this.context.closePath();
2677
2668
  }
2678
- }, {
2679
- key: "point",
2680
- value: function point(p) {
2681
- var x = p.x,
2682
- y = p.y;
2683
- switch (this._point) {
2684
- case 0:
2685
- this._point = 1, this._line ? this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined, p) : this.context.moveTo(x, y, p);
2686
- break;
2687
- case 1:
2688
- this._point = 2;
2689
- default:
2690
- this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined, p);
2691
- }
2692
- this._lastDefined = p.defined;
2693
- }
2694
- }, {
2695
- key: "tryUpdateLength",
2696
- value: function tryUpdateLength() {
2697
- return this.context.tryUpdateLength();
2698
- }
2699
2669
  }]);
2700
2670
  return LinearClosed;
2701
- }();
2671
+ }(Linear);
2702
2672
  function genLinearClosedSegments(points) {
2703
2673
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2704
2674
  var direction = params.direction,
2705
2675
  startPoint = params.startPoint;
2706
2676
  if (points.length < 2 - Number(!!startPoint)) return null;
2707
- var segContext = new SegContext("linear", null != direction ? direction : vutils.abs(points[points.length - 1].x - points[0].x) > vutils.abs(points[points.length - 1].y - points[0].y) ? Direction$1.ROW : Direction$1.COLUMN);
2677
+ var segContext = genSegContext("linear", direction, points);
2708
2678
  return genLinearClosedTypeSegments(new LinearClosed(segContext, startPoint), points), segContext;
2709
2679
  }
2710
2680
  function genLinearClosedTypeSegments(path, points) {
@@ -3198,6 +3168,8 @@
3198
3168
  strokeSeg: null,
3199
3169
  pickable: !0,
3200
3170
  childrenPickable: !0,
3171
+ fillPickable: !0,
3172
+ strokePickable: !0,
3201
3173
  visible: !0,
3202
3174
  zIndex: 0,
3203
3175
  layout: null,
@@ -12511,6 +12483,7 @@
12511
12483
  return DefaultBaseInteractiveRenderContribution;
12512
12484
  }();
12513
12485
  DefaultBaseInteractiveRenderContribution = __decorate$L([injectable(), __param$w(0, inject(ContributionProvider)), __param$w(0, named(InteractiveSubRenderContribution)), __metadata$B("design:paramtypes", [Object])], DefaultBaseInteractiveRenderContribution);
12486
+
12514
12487
  var DefaultBaseTextureRenderContribution = /*#__PURE__*/function () {
12515
12488
  function DefaultBaseTextureRenderContribution() {
12516
12489
  _classCallCheck(this, DefaultBaseTextureRenderContribution);
@@ -12611,16 +12584,20 @@
12611
12584
  key: "drawShape",
12612
12585
  value: function drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
12613
12586
  this.textureMap || this.initTextureMap(context, graphic.stage);
12614
- var _graphic$attribute2 = graphic.attribute,
12615
- _graphic$attribute2$t = _graphic$attribute2.texture,
12616
- texture = _graphic$attribute2$t === void 0 ? graphicAttribute.texture : _graphic$attribute2$t,
12617
- _graphic$attribute2$t2 = _graphic$attribute2.textureColor,
12618
- textureColor = _graphic$attribute2$t2 === void 0 ? graphicAttribute.textureColor : _graphic$attribute2$t2,
12619
- _graphic$attribute2$t3 = _graphic$attribute2.textureSize,
12620
- textureSize = _graphic$attribute2$t3 === void 0 ? graphicAttribute.textureSize : _graphic$attribute2$t3,
12621
- _graphic$attribute2$t4 = _graphic$attribute2.texturePadding,
12622
- texturePadding = _graphic$attribute2$t4 === void 0 ? graphicAttribute.texturePadding : _graphic$attribute2$t4;
12623
- if (!texture) return;
12587
+ var _graphic$attribute = graphic.attribute,
12588
+ _graphic$attribute$te = _graphic$attribute.texture,
12589
+ texture = _graphic$attribute$te === void 0 ? graphicAttribute.texture : _graphic$attribute$te,
12590
+ _graphic$attribute$te2 = _graphic$attribute.textureColor,
12591
+ textureColor = _graphic$attribute$te2 === void 0 ? graphicAttribute.textureColor : _graphic$attribute$te2,
12592
+ _graphic$attribute$te3 = _graphic$attribute.textureSize,
12593
+ textureSize = _graphic$attribute$te3 === void 0 ? graphicAttribute.textureSize : _graphic$attribute$te3,
12594
+ _graphic$attribute$te4 = _graphic$attribute.texturePadding,
12595
+ texturePadding = _graphic$attribute$te4 === void 0 ? graphicAttribute.texturePadding : _graphic$attribute$te4;
12596
+ texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
12597
+ }
12598
+ }, {
12599
+ key: "drawTexture",
12600
+ value: function drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
12624
12601
  var pattern = this.textureMap.get(texture);
12625
12602
  if (!pattern) switch (texture) {
12626
12603
  case "circle":
@@ -13136,6 +13113,37 @@
13136
13113
  var defaultSymbolTextureRenderContribution = defaultBaseTextureRenderContribution;
13137
13114
  var defaultSymbolBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
13138
13115
 
13116
+ var DefaultAreaTextureRenderContribution = /*#__PURE__*/function (_DefaultBaseTextureRe) {
13117
+ _inherits(DefaultAreaTextureRenderContribution, _DefaultBaseTextureRe);
13118
+ var _super = _createSuper(DefaultAreaTextureRenderContribution);
13119
+ function DefaultAreaTextureRenderContribution() {
13120
+ var _this;
13121
+ _classCallCheck(this, DefaultAreaTextureRenderContribution);
13122
+ _this = _super.apply(this, arguments), _this.time = BaseRenderContributionTime.afterFillStroke;
13123
+ return _this;
13124
+ }
13125
+ _createClass(DefaultAreaTextureRenderContribution, [{
13126
+ key: "drawShape",
13127
+ value: function drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
13128
+ var _a, _b, _c, _d;
13129
+ this.textureMap || this.initTextureMap(context, graphic.stage);
13130
+ var _ref = options || {},
13131
+ _ref$attribute = _ref.attribute,
13132
+ attribute = _ref$attribute === void 0 ? graphic.attribute : _ref$attribute,
13133
+ _attribute$texture = attribute.texture,
13134
+ texture = _attribute$texture === void 0 ? null !== (_a = graphic.attribute.texture) && void 0 !== _a ? _a : getAttributeFromDefaultAttrList(graphicAttribute, "texture") : _attribute$texture,
13135
+ _attribute$textureCol = attribute.textureColor,
13136
+ textureColor = _attribute$textureCol === void 0 ? null !== (_b = graphic.attribute.textureColor) && void 0 !== _b ? _b : getAttributeFromDefaultAttrList(graphicAttribute, "textureColor") : _attribute$textureCol,
13137
+ _attribute$textureSiz = attribute.textureSize,
13138
+ textureSize = _attribute$textureSiz === void 0 ? null !== (_c = graphic.attribute.textureSize) && void 0 !== _c ? _c : getAttributeFromDefaultAttrList(graphicAttribute, "textureSize") : _attribute$textureSiz,
13139
+ _attribute$texturePad = attribute.texturePadding,
13140
+ texturePadding = _attribute$texturePad === void 0 ? null !== (_d = graphic.attribute.texturePadding) && void 0 !== _d ? _d : getAttributeFromDefaultAttrList(graphicAttribute, "texturePadding") : _attribute$texturePad;
13141
+ texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
13142
+ }
13143
+ }]);
13144
+ return DefaultAreaTextureRenderContribution;
13145
+ }(DefaultBaseTextureRenderContribution);
13146
+
13139
13147
  var __decorate$J = undefined && undefined.__decorate || function (decorators, target, key, desc) {
13140
13148
  var d,
13141
13149
  c = arguments.length,
@@ -13376,6 +13384,26 @@
13376
13384
  }(BaseRender);
13377
13385
  DefaultCanvasCircleRender = __decorate$I([injectable(), __param$u(0, inject(ContributionProvider)), __param$u(0, named(CircleRenderContribution)), __metadata$z("design:paramtypes", [Object])], DefaultCanvasCircleRender);
13378
13386
 
13387
+ function drawSegItem(ctx, curve, endPercent, params) {
13388
+ if (!curve.p1) return;
13389
+ var _ref = params || {},
13390
+ _ref$offsetX = _ref.offsetX,
13391
+ offsetX = _ref$offsetX === void 0 ? 0 : _ref$offsetX,
13392
+ _ref$offsetY = _ref.offsetY,
13393
+ offsetY = _ref$offsetY === void 0 ? 0 : _ref$offsetY,
13394
+ _ref$offsetZ = _ref.offsetZ,
13395
+ offsetZ = _ref$offsetZ === void 0 ? 0 : _ref$offsetZ;
13396
+ if (1 === endPercent) curve.p2 && curve.p3 ? ctx.bezierCurveTo(offsetX + curve.p1.x, offsetY + curve.p1.y, offsetX + curve.p2.x, offsetY + curve.p2.y, offsetX + curve.p3.x, offsetY + curve.p3.y, offsetZ) : ctx.lineTo(offsetX + curve.p1.x, offsetY + curve.p1.y, offsetZ);else if (curve.p2 && curve.p3) {
13397
+ var _divideCubic = divideCubic(curve, endPercent),
13398
+ _divideCubic2 = _slicedToArray(_divideCubic, 1),
13399
+ curve1 = _divideCubic2[0];
13400
+ ctx.bezierCurveTo(offsetX + curve1.p1.x, offsetY + curve1.p1.y, offsetX + curve1.p2.x, offsetY + curve1.p2.y, offsetX + curve1.p3.x, offsetY + curve1.p3.y, offsetZ);
13401
+ } else {
13402
+ var p = curve.getPointAt(endPercent);
13403
+ ctx.lineTo(offsetX + p.x, offsetY + p.y, offsetZ);
13404
+ }
13405
+ }
13406
+
13379
13407
  function drawSegments(path, segPath, percent, clipRangeByDimension, params) {
13380
13408
  var _a;
13381
13409
  var _ref = params || {},
@@ -13418,7 +13446,7 @@
13418
13446
  } else _lastCurve = curve;
13419
13447
  });
13420
13448
  } else curves.forEach(function (curve) {
13421
- curve.defined ? (needMoveTo && path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), drawSegItem$1(path, curve, 1, params), needMoveTo = !1) : needMoveTo = !0;
13449
+ curve.defined ? (needMoveTo && path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), drawSegItem(path, curve, 1, params), needMoveTo = !1) : needMoveTo = !0;
13422
13450
  });
13423
13451
  return;
13424
13452
  }
@@ -13457,7 +13485,7 @@
13457
13485
  needMoveTo = !0;
13458
13486
  continue;
13459
13487
  }
13460
- needMoveTo && path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), drawSegItem$1(path, curve, vutils.min(_p, 1), params), needMoveTo = !1;
13488
+ needMoveTo && path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), drawSegItem(path, curve, vutils.min(_p, 1), params), needMoveTo = !1;
13461
13489
  }
13462
13490
  }
13463
13491
  }
@@ -13494,25 +13522,6 @@
13494
13522
  path.lineTo(null !== (_c = startP.x1) && void 0 !== _c ? _c : startP.x, null !== (_d = startP.y1) && void 0 !== _d ? _d : startP.y), path.closePath();
13495
13523
  });
13496
13524
  }
13497
- function drawSegItem$1(ctx, curve, endPercent, params) {
13498
- if (!curve.p1) return;
13499
- var _ref4 = params || {},
13500
- _ref4$offsetX = _ref4.offsetX,
13501
- offsetX = _ref4$offsetX === void 0 ? 0 : _ref4$offsetX,
13502
- _ref4$offsetY = _ref4.offsetY,
13503
- offsetY = _ref4$offsetY === void 0 ? 0 : _ref4$offsetY,
13504
- _ref4$offsetZ = _ref4.offsetZ,
13505
- offsetZ = _ref4$offsetZ === void 0 ? 0 : _ref4$offsetZ;
13506
- if (1 === endPercent) curve.p2 && curve.p3 ? ctx.bezierCurveTo(offsetX + curve.p1.x, offsetY + curve.p1.y, offsetX + curve.p2.x, offsetY + curve.p2.y, offsetX + curve.p3.x, offsetY + curve.p3.y, offsetZ) : ctx.lineTo(offsetX + curve.p1.x, offsetY + curve.p1.y, offsetZ);else if (curve.p2 && curve.p3) {
13507
- var _divideCubic = divideCubic(curve, endPercent),
13508
- _divideCubic2 = _slicedToArray(_divideCubic, 1),
13509
- curve1 = _divideCubic2[0];
13510
- ctx.bezierCurveTo(offsetX + curve1.p1.x, offsetY + curve1.p1.y, offsetX + curve1.p2.x, offsetY + curve1.p2.y, offsetX + curve1.p3.x, offsetY + curve1.p3.y, offsetZ);
13511
- } else {
13512
- var p = curve.getPointAt(endPercent);
13513
- ctx.lineTo(offsetX + p.x, offsetY + p.y, offsetZ);
13514
- }
13515
- }
13516
13525
 
13517
13526
  var __decorate$H = undefined && undefined.__decorate || function (decorators, target, key, desc) {
13518
13527
  var d,
@@ -13584,10 +13593,10 @@
13584
13593
  var z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
13585
13594
  points = line.attribute.points,
13586
13595
  startP = points[0];
13587
- context.moveTo(startP.x, startP.y, z);
13596
+ context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
13588
13597
  for (var i = 1; i < points.length; i++) {
13589
13598
  var p = points[i];
13590
- context.lineTo(p.x, p.y, z);
13599
+ context.lineTo(p.x + offsetX, p.y + offsetY, z);
13591
13600
  }
13592
13601
  context.setShadowBlendStyle && context.setShadowBlendStyle(line, line.attribute, lineAttribute);
13593
13602
  var _line$attribute = line.attribute,
@@ -13820,83 +13829,7 @@
13820
13829
  }
13821
13830
  path.closePath();
13822
13831
  }
13823
- function drawSegItem(ctx, curve, endPercent, params) {
13824
- if (!curve.p1) return;
13825
- var _ref5 = params || {},
13826
- _ref5$offsetX = _ref5.offsetX,
13827
- offsetX = _ref5$offsetX === void 0 ? 0 : _ref5$offsetX,
13828
- _ref5$offsetY = _ref5.offsetY,
13829
- offsetY = _ref5$offsetY === void 0 ? 0 : _ref5$offsetY,
13830
- _ref5$offsetZ = _ref5.offsetZ,
13831
- offsetZ = _ref5$offsetZ === void 0 ? 0 : _ref5$offsetZ;
13832
- if (1 === endPercent) curve.p2 && curve.p3 ? ctx.bezierCurveTo(offsetX + curve.p1.x, offsetY + curve.p1.y, offsetX + curve.p2.x, offsetY + curve.p2.y, offsetX + curve.p3.x, offsetY + curve.p3.y, offsetZ) : ctx.lineTo(offsetX + curve.p1.x, offsetY + curve.p1.y, offsetZ);else if (curve.p2 && curve.p3) {
13833
- var _divideCubic = divideCubic(curve, endPercent),
13834
- _divideCubic2 = _slicedToArray(_divideCubic, 1),
13835
- curve1 = _divideCubic2[0];
13836
- ctx.bezierCurveTo(offsetX + curve1.p1.x, offsetY + curve1.p1.y, offsetX + curve1.p2.x, offsetY + curve1.p2.y, offsetX + curve1.p3.x, offsetY + curve1.p3.y, offsetZ);
13837
- } else {
13838
- var p = curve.getPointAt(endPercent);
13839
- ctx.lineTo(offsetX + p.x, offsetY + p.y, offsetZ);
13840
- }
13841
- }
13842
13832
 
13843
- var DefaultAreaTextureRenderContribution = /*#__PURE__*/function (_DefaultBaseTextureRe) {
13844
- _inherits(DefaultAreaTextureRenderContribution, _DefaultBaseTextureRe);
13845
- var _super = _createSuper(DefaultAreaTextureRenderContribution);
13846
- function DefaultAreaTextureRenderContribution() {
13847
- var _this;
13848
- _classCallCheck(this, DefaultAreaTextureRenderContribution);
13849
- _this = _super.apply(this, arguments), _this.time = BaseRenderContributionTime.afterFillStroke;
13850
- return _this;
13851
- }
13852
- _createClass(DefaultAreaTextureRenderContribution, [{
13853
- key: "drawShape",
13854
- value: function drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
13855
- var _a, _b, _c, _d;
13856
- this.textureMap || this.initTextureMap(context, graphic.stage);
13857
- var _ref = options || {},
13858
- _ref$attribute = _ref.attribute,
13859
- attribute = _ref$attribute === void 0 ? graphic.attribute : _ref$attribute,
13860
- _attribute$texture = attribute.texture,
13861
- texture = _attribute$texture === void 0 ? null !== (_a = graphic.attribute.texture) && void 0 !== _a ? _a : getAttributeFromDefaultAttrList(graphicAttribute, "texture") : _attribute$texture,
13862
- _attribute$textureCol = attribute.textureColor,
13863
- textureColor = _attribute$textureCol === void 0 ? null !== (_b = graphic.attribute.textureColor) && void 0 !== _b ? _b : getAttributeFromDefaultAttrList(graphicAttribute, "textureColor") : _attribute$textureCol,
13864
- _attribute$textureSiz = attribute.textureSize,
13865
- textureSize = _attribute$textureSiz === void 0 ? null !== (_c = graphic.attribute.textureSize) && void 0 !== _c ? _c : getAttributeFromDefaultAttrList(graphicAttribute, "textureSize") : _attribute$textureSiz,
13866
- _attribute$texturePad = attribute.texturePadding,
13867
- texturePadding = _attribute$texturePad === void 0 ? null !== (_d = graphic.attribute.texturePadding) && void 0 !== _d ? _d : getAttributeFromDefaultAttrList(graphicAttribute, "texturePadding") : _attribute$texturePad;
13868
- if (!texture) return;
13869
- var pattern = this.textureMap.get(texture);
13870
- if (!pattern) switch (texture) {
13871
- case "circle":
13872
- pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
13873
- break;
13874
- case "diamond":
13875
- pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
13876
- break;
13877
- case "rect":
13878
- pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
13879
- break;
13880
- case "vertical-line":
13881
- pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
13882
- break;
13883
- case "horizontal-line":
13884
- pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
13885
- break;
13886
- case "bias-lr":
13887
- pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
13888
- break;
13889
- case "bias-rl":
13890
- pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
13891
- break;
13892
- case "grid":
13893
- pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
13894
- }
13895
- pattern && (context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore());
13896
- }
13897
- }]);
13898
- return DefaultAreaTextureRenderContribution;
13899
- }(DefaultBaseTextureRenderContribution);
13900
13833
  var defaultAreaTextureRenderContribution = new DefaultAreaTextureRenderContribution();
13901
13834
  var defaultAreaBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
13902
13835
 
@@ -13953,39 +13886,43 @@
13953
13886
  var z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
13954
13887
  points = area.attribute.points,
13955
13888
  startP = points[0];
13956
- context.moveTo(startP.x, startP.y, z);
13889
+ context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
13957
13890
  for (var i = 1; i < points.length; i++) {
13958
13891
  var p = points[i];
13959
- context.lineTo(p.x, p.y, z);
13892
+ context.lineTo(p.x + offsetX, p.y + offsetY, z);
13960
13893
  }
13961
13894
  for (var _i = points.length - 1; _i >= 0; _i--) {
13962
13895
  var _p = points[_i];
13963
- context.lineTo(null !== (_b = _p.x1) && void 0 !== _b ? _b : _p.x, null !== (_c = _p.y1) && void 0 !== _c ? _c : _p.y, z);
13896
+ context.lineTo((null !== (_b = _p.x1) && void 0 !== _b ? _b : _p.x) + offsetX, (null !== (_c = _p.y1) && void 0 !== _c ? _c : _p.y) + offsetY, z);
13964
13897
  }
13965
- context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(area, area.attribute, areaAttribute);
13898
+ context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(area, area.attribute, areaAttribute), this.beforeRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, areaAttribute, drawContext, fillCb, null, {
13899
+ attribute: area.attribute
13900
+ });
13966
13901
  var _area$attribute = area.attribute,
13967
13902
  _area$attribute$x = _area$attribute.x,
13968
13903
  originX = _area$attribute$x === void 0 ? 0 : _area$attribute$x,
13969
13904
  _area$attribute$x2 = _area$attribute.x,
13970
13905
  originY = _area$attribute$x2 === void 0 ? 0 : _area$attribute$x2;
13971
- if (!1 !== fill && (fillCb ? fillCb(context, area.attribute, areaAttribute) : fillOpacity && (context.setCommonStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.fill())), stroke) {
13906
+ if (!1 !== fill && (fillCb ? fillCb(context, area.attribute, areaAttribute) : fillOpacity && (context.setCommonStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.fill())), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, areaAttribute, drawContext, fillCb, null, {
13907
+ attribute: area.attribute
13908
+ }), stroke) {
13972
13909
  var _area$attribute$strok = area.attribute.stroke,
13973
13910
  _stroke = _area$attribute$strok === void 0 ? areaAttribute && areaAttribute.stroke : _area$attribute$strok;
13974
13911
  if (vutils.isArray(_stroke) && (_stroke[0] || _stroke[2]) && !1 === _stroke[1]) if (context.beginPath(), _stroke[0]) {
13975
- context.moveTo(startP.x, startP.y, z);
13912
+ context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
13976
13913
  for (var _i2 = 1; _i2 < points.length; _i2++) {
13977
13914
  var _p2 = points[_i2];
13978
- context.lineTo(_p2.x, _p2.y, z);
13915
+ context.lineTo(_p2.x + offsetX, _p2.y + offsetY, z);
13979
13916
  }
13980
13917
  } else if (_stroke[2]) {
13981
13918
  var endP = points[points.length - 1];
13982
- context.moveTo(endP.x, endP.y, z);
13919
+ context.moveTo(endP.x + offsetX, endP.y + offsetY, z);
13983
13920
  for (var _i3 = points.length - 2; _i3 >= 0; _i3--) {
13984
13921
  var _p3 = points[_i3];
13985
- context.lineTo(null !== (_d = _p3.x1) && void 0 !== _d ? _d : _p3.x, null !== (_e = _p3.y1) && void 0 !== _e ? _e : _p3.y, z);
13922
+ context.lineTo((null !== (_d = _p3.x1) && void 0 !== _d ? _d : _p3.x) + offsetX, (null !== (_e = _p3.y1) && void 0 !== _e ? _e : _p3.y) + offsetY, z);
13986
13923
  }
13987
13924
  }
13988
- context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke();
13925
+ strokeCb ? strokeCb(context, area.attribute, areaAttribute) : (context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke());
13989
13926
  }
13990
13927
  }
13991
13928
  }, {
@@ -17506,13 +17443,24 @@
17506
17443
  x = _area$attribute$x === void 0 ? areaAttribute.x : _area$attribute$x,
17507
17444
  _area$attribute$y = _area$attribute.y,
17508
17445
  y = _area$attribute$y === void 0 ? areaAttribute.y : _area$attribute$y;
17446
+ var _area$attribute2 = area.attribute,
17447
+ _area$attribute2$fill = _area$attribute2.fillPickable,
17448
+ fillPickable = _area$attribute2$fill === void 0 ? areaAttribute.fillPickable : _area$attribute2$fill,
17449
+ _area$attribute2$stro = _area$attribute2.strokePickable,
17450
+ strokePickable = _area$attribute2$stro === void 0 ? areaAttribute.strokePickable : _area$attribute2$stro;
17509
17451
  if (pickContext.highPerformanceSave(), area.transMatrix.onlyTranslate()) {
17510
17452
  var _point = area.getOffsetXY(areaAttribute);
17511
17453
  x += _point.x, y += _point.y, pickContext.setTransformForCurrent();
17512
17454
  } else x = 0, y = 0, pickContext.transformFromMatrix(area.transMatrix, !0);
17513
17455
  var picked = !1;
17514
17456
  return this.canvasRenderer.drawShape(area, pickContext, x, y, {}, null, function (context) {
17515
- return !!picked || (picked = context.isPointInPath(point.x, point.y), picked);
17457
+ return !!picked || !!fillPickable && (picked = context.isPointInPath(point.x, point.y), picked);
17458
+ }, function (context, areaAttribute, themeAttribute) {
17459
+ if (picked) return !0;
17460
+ if (!strokePickable) return !1;
17461
+ var lineWidth = areaAttribute.lineWidth || themeAttribute.lineWidth,
17462
+ pickStrokeBuffer = areaAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
17463
+ return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
17516
17464
  }), pickContext.highPerformanceRestore(), picked;
17517
17465
  }
17518
17466
  }]);
@@ -18890,7 +18838,7 @@
18890
18838
  }
18891
18839
  render() {
18892
18840
  var _a, _b, _c;
18893
- const { text = '', textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type } = this.attribute;
18841
+ const { text = '', textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter } = this.attribute;
18894
18842
  const parsedPadding = vutils.normalizePadding(padding);
18895
18843
  const group = this.createOrUpdateChild('tag-content', { x: 0, y: 0, zIndex: 1 }, 'group');
18896
18844
  let symbol;
@@ -18980,6 +18928,12 @@
18980
18928
  else if (textAlign === 'left' || textAlign === 'start') {
18981
18929
  group.setAttribute('x', parsedPadding[3]);
18982
18930
  }
18931
+ if (textAlwaysCenter && (textAlign === 'left' || textAlign === 'start')) {
18932
+ textShape.setAttributes({
18933
+ x: textX + tagWidth / 2,
18934
+ textAlign: 'center'
18935
+ });
18936
+ }
18983
18937
  if (textBaseline === 'middle') {
18984
18938
  y -= tagHeight / 2;
18985
18939
  if (symbol) {
@@ -20165,6 +20119,37 @@
20165
20119
  }
20166
20120
  return { x, y };
20167
20121
  }
20122
+ function connectLineBetweenBounds(boundA, boundB) {
20123
+ if (!boundA || !boundB) {
20124
+ return;
20125
+ }
20126
+ if (vutils.isRectIntersect(boundA, boundB, true)) {
20127
+ return;
20128
+ }
20129
+ const x1 = Math.min(boundA.x1, boundA.x2);
20130
+ const y1 = Math.min(boundA.y1, boundA.y2);
20131
+ const x2 = Math.min(boundB.x1, boundB.x2);
20132
+ const y2 = Math.min(boundB.y1, boundB.y2);
20133
+ const w1 = Math.abs(boundA.x2 - x1) / 2;
20134
+ const h1 = Math.abs(boundA.y2 - y1) / 2;
20135
+ const w2 = Math.abs(boundB.x2 - x2) / 2;
20136
+ const h2 = Math.abs(boundB.y2 - y2) / 2;
20137
+ const cx1 = x1 + w1;
20138
+ const cy1 = y1 + h1;
20139
+ const cx2 = x2 + w2;
20140
+ const cy2 = y2 + h2;
20141
+ const dx = cx2 - cx1;
20142
+ const dy = cy2 - cy1;
20143
+ const p1 = getIntersection(dx, dy, cx1, cy1, w1, h1);
20144
+ const p2 = getIntersection(-dx, -dy, cx2, cy2, w2, h2);
20145
+ return [p1, p2];
20146
+ }
20147
+ function getIntersection(dx, dy, cx, cy, w, h) {
20148
+ if (Math.abs(dy / dx) < h / w) {
20149
+ return { x: cx + (dx > 0 ? w : -w), y: cy + (dy * w) / Math.abs(dx) };
20150
+ }
20151
+ return { x: cx + (dx * h) / Math.abs(dy), y: cy + (dy > 0 ? h : -h) };
20152
+ }
20168
20153
 
20169
20154
  function loadLabelComponent() {
20170
20155
  registerGroup();
@@ -20230,9 +20215,10 @@
20230
20215
  }
20231
20216
  };
20232
20217
  this._handleRelatedGraphicSetState = (e) => {
20233
- var _a, _b, _c;
20234
- if (((_a = e.detail) === null || _a === void 0 ? void 0 : _a.type) === AttributeUpdateType.STATE) {
20235
- const currentStates = (_c = (_b = e.target) === null || _b === void 0 ? void 0 : _b.currentStates) !== null && _c !== void 0 ? _c : [];
20218
+ var _a, _b, _c, _d, _e;
20219
+ if (((_a = e.detail) === null || _a === void 0 ? void 0 : _a.type) === AttributeUpdateType.STATE ||
20220
+ (((_b = e.detail) === null || _b === void 0 ? void 0 : _b.type) === AttributeUpdateType.ANIMATE_UPDATE && ((_c = e.detail.animationState) === null || _c === void 0 ? void 0 : _c.isFirstFrameOfStep))) {
20221
+ const currentStates = (_e = (_d = e.target) === null || _d === void 0 ? void 0 : _d.currentStates) !== null && _e !== void 0 ? _e : [];
20236
20222
  const labels = this._isCollectionBase ? [...this._graphicToText.values()] : [this._graphicToText.get(e.target)];
20237
20223
  labels.forEach(label => {
20238
20224
  if (label) {
@@ -20250,8 +20236,21 @@
20250
20236
  labeling(textBounds, graphicBounds, position, offset) {
20251
20237
  return;
20252
20238
  }
20253
- _labelLine(text) {
20254
- return;
20239
+ _createLabelLine(text, baseMark) {
20240
+ const points = connectLineBetweenBounds(text.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds);
20241
+ if (points) {
20242
+ const line = graphicCreator.line({
20243
+ points
20244
+ });
20245
+ if (baseMark && baseMark.attribute.fill) {
20246
+ line.setAttribute('stroke', baseMark.attribute.fill);
20247
+ }
20248
+ if (this.attribute.line && !vutils.isEmpty(this.attribute.line.style)) {
20249
+ line.setAttributes(this.attribute.line.style);
20250
+ }
20251
+ this._setStatesOfLabelLine(line);
20252
+ return line;
20253
+ }
20255
20254
  }
20256
20255
  render() {
20257
20256
  this._prepare();
@@ -20380,7 +20379,7 @@
20380
20379
  for (let i = 0; i < currentBaseMarks.length; i++) {
20381
20380
  const baseMark = currentBaseMarks[i];
20382
20381
  const points = getPointsOfLineArea(baseMark);
20383
- if (points === null || points === void 0 ? void 0 : points.length) {
20382
+ if (points && points.length) {
20384
20383
  for (let j = 0; j < points.length; j++) {
20385
20384
  const textData = data[cur];
20386
20385
  if (textData && points[j]) {
@@ -20499,7 +20498,10 @@
20499
20498
  result.push(text);
20500
20499
  continue;
20501
20500
  }
20502
- if (checkBounds && (baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds) && this._canPlaceInside(text.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds)) {
20501
+ if (checkBounds &&
20502
+ baseMark &&
20503
+ baseMark.AABBBounds &&
20504
+ this._canPlaceInside(text.AABBBounds, baseMark.AABBBounds)) {
20503
20505
  bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
20504
20506
  result.push(text);
20505
20507
  continue;
@@ -20570,17 +20572,21 @@
20570
20572
  }
20571
20573
  }
20572
20574
  _renderWithAnimation(labels) {
20575
+ var _a;
20573
20576
  const currentTextMap = new Map();
20574
20577
  const prevTextMap = this._graphicToText || new Map();
20575
20578
  const texts = [];
20576
20579
  const labelLines = [];
20580
+ const { visible: showLabelLine } = (_a = this.attribute.line) !== null && _a !== void 0 ? _a : {};
20577
20581
  labels.forEach((text, index) => {
20578
- var _a, _b, _c, _d, _e, _f, _g;
20579
- const labelLine = this._labelLine(text);
20580
20582
  const relatedGraphic = this.getRelatedGraphic(text.attribute);
20581
20583
  const textId = text.attribute.id;
20582
20584
  const textKey = this._isCollectionBase ? textId : relatedGraphic;
20583
20585
  const state = (prevTextMap === null || prevTextMap === void 0 ? void 0 : prevTextMap.get(textKey)) ? 'update' : 'enter';
20586
+ let labelLine;
20587
+ if (showLabelLine) {
20588
+ labelLine = this._createLabelLine(text, relatedGraphic);
20589
+ }
20584
20590
  if (state === 'enter') {
20585
20591
  texts.push(text);
20586
20592
  currentTextMap.set(textKey, labelLine ? { text, labelLine } : { text });
@@ -20588,7 +20594,6 @@
20588
20594
  const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');
20589
20595
  this.add(text);
20590
20596
  if (labelLine) {
20591
- this._setStatesOfLabelLine(labelLine);
20592
20597
  labelLines.push(labelLine);
20593
20598
  this.add(labelLine);
20594
20599
  }
@@ -20609,10 +20614,9 @@
20609
20614
  const prevText = prevLabel.text;
20610
20615
  const { duration, easing } = this._animationConfig.update;
20611
20616
  updateAnimation(prevText, text, this._animationConfig.update);
20612
- if (prevLabel.labelLine) {
20617
+ if (prevLabel.labelLine && labelLine) {
20613
20618
  prevLabel.labelLine.animate().to(vutils.merge({}, prevLabel.labelLine.attribute, {
20614
- visible: (_f = (_d = (((_b = (_a = text.attribute) === null || _a === void 0 ? void 0 : _a.line) === null || _b === void 0 ? void 0 : _b.visible) && ((_c = text.attribute) === null || _c === void 0 ? void 0 : _c.visible))) !== null && _d !== void 0 ? _d : (_e = text.attribute) === null || _e === void 0 ? void 0 : _e.visible) !== null && _f !== void 0 ? _f : true,
20615
- points: (_g = text.attribute) === null || _g === void 0 ? void 0 : _g.points
20619
+ points: labelLine.attribute.points
20616
20620
  }), duration, easing);
20617
20621
  }
20618
20622
  }
@@ -20621,7 +20625,7 @@
20621
20625
  var _a;
20622
20626
  (_a = label.text) === null || _a === void 0 ? void 0 : _a.animate().to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, this._animationConfig.exit.duration, this._animationConfig.exit.easing).onEnd(() => {
20623
20627
  this.removeChild(label.text);
20624
- if (label === null || label === void 0 ? void 0 : label.labelLine) {
20628
+ if (label.labelLine) {
20625
20629
  this.removeChild(label.labelLine);
20626
20630
  }
20627
20631
  });
@@ -20629,14 +20633,18 @@
20629
20633
  this._graphicToText = currentTextMap;
20630
20634
  }
20631
20635
  _renderWithOutAnimation(labels) {
20636
+ var _a;
20632
20637
  const currentTextMap = new Map();
20633
20638
  const prevTextMap = this._graphicToText || new Map();
20639
+ const { visible: showLabelLine } = (_a = this.attribute.line) !== null && _a !== void 0 ? _a : {};
20634
20640
  labels.forEach(text => {
20635
- var _a;
20636
- const labelLine = this._labelLine(text);
20637
20641
  const relatedGraphic = this.getRelatedGraphic(text.attribute);
20638
20642
  const state = (prevTextMap === null || prevTextMap === void 0 ? void 0 : prevTextMap.get(relatedGraphic)) ? 'update' : 'enter';
20639
20643
  const textKey = this._isCollectionBase ? text.attribute.id : relatedGraphic;
20644
+ let labelLine;
20645
+ if (showLabelLine) {
20646
+ labelLine = this._createLabelLine(text, relatedGraphic);
20647
+ }
20640
20648
  if (state === 'enter') {
20641
20649
  currentTextMap.set(textKey, labelLine ? { text, labelLine } : { text });
20642
20650
  this.add(text);
@@ -20650,14 +20658,14 @@
20650
20658
  prevTextMap.delete(textKey);
20651
20659
  currentTextMap.set(textKey, prevLabel);
20652
20660
  prevLabel.text.setAttributes(text.attribute);
20653
- if (prevLabel === null || prevLabel === void 0 ? void 0 : prevLabel.labelLine) {
20654
- prevLabel.labelLine.setAttributes({ points: (_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points });
20661
+ if (prevLabel.labelLine && labelLine) {
20662
+ prevLabel.labelLine.setAttributes({ points: labelLine.attribute.points });
20655
20663
  }
20656
20664
  }
20657
20665
  });
20658
20666
  prevTextMap.forEach(label => {
20659
20667
  this.removeChild(label.text);
20660
- if (label === null || label === void 0 ? void 0 : label.labelLine) {
20668
+ if (label.labelLine) {
20661
20669
  this.removeChild(label.labelLine);
20662
20670
  }
20663
20671
  });
@@ -20765,7 +20773,7 @@
20765
20773
  stroke && label.setAttributes({ stroke });
20766
20774
  }
20767
20775
  else {
20768
- const isInside = this._canPlaceInside(label.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds);
20776
+ const isInside = this._canPlaceInside(label.AABBBounds, baseMark.AABBBounds);
20769
20777
  if (isInside) {
20770
20778
  const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
20771
20779
  fill && label.setAttributes({ fill });
@@ -21028,18 +21036,20 @@
21028
21036
  for (let i = 0; i < data.length; i++) {
21029
21037
  const textData = data[i];
21030
21038
  const basedArc = arcs.find(arc => { var _a; return ((_a = arc.refDatum) === null || _a === void 0 ? void 0 : _a.id) === textData.id; });
21031
- const labelAttribute = {
21032
- visible: basedArc.labelVisible,
21033
- x: basedArc.labelPosition.x,
21034
- y: basedArc.labelPosition.y,
21035
- angle: basedArc.angle,
21036
- maxLineWidth: basedArc.labelLimit,
21037
- 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)
21038
- ? [basedArc.pointA, basedArc.pointB, basedArc.pointC]
21039
- : undefined,
21040
- line: basedArc === null || basedArc === void 0 ? void 0 : basedArc.labelLine
21041
- };
21042
- labels[i].setAttributes(labelAttribute);
21039
+ if (basedArc) {
21040
+ const labelAttribute = {
21041
+ visible: basedArc.labelVisible,
21042
+ x: basedArc.labelPosition.x,
21043
+ y: basedArc.labelPosition.y,
21044
+ angle: basedArc.angle,
21045
+ maxLineWidth: basedArc.labelLimit,
21046
+ points: basedArc.pointA && basedArc.pointB && basedArc.pointC
21047
+ ? [basedArc.pointA, basedArc.pointB, basedArc.pointC]
21048
+ : undefined,
21049
+ line: basedArc.labelLine
21050
+ };
21051
+ labels[i].setAttributes(labelAttribute);
21052
+ }
21043
21053
  }
21044
21054
  return labels;
21045
21055
  }
@@ -21102,8 +21112,8 @@
21102
21112
  var _a, _b;
21103
21113
  const labelConfig = attribute;
21104
21114
  const spaceWidth = labelConfig.spaceWidth;
21105
- const position = (_a = labelConfig === null || labelConfig === void 0 ? void 0 : labelConfig.position) !== null && _a !== void 0 ? _a : 'inside';
21106
- const offsetRadius = (_b = labelConfig === null || labelConfig === void 0 ? void 0 : labelConfig.offsetRadius) !== null && _b !== void 0 ? _b : -spaceWidth;
21115
+ const position = (_a = labelConfig.position) !== null && _a !== void 0 ? _a : 'inside';
21116
+ const offsetRadius = (_b = labelConfig.offsetRadius) !== null && _b !== void 0 ? _b : -spaceWidth;
21107
21117
  arcs.forEach((arc) => {
21108
21118
  var _a, _b, _c;
21109
21119
  const { labelSize, radian } = arc;
@@ -21124,7 +21134,7 @@
21124
21134
  }
21125
21135
  limit = outerRadius - minRadius - spaceWidth;
21126
21136
  }
21127
- if ((labelConfig === null || labelConfig === void 0 ? void 0 : labelConfig.rotate) !== true) {
21137
+ if (labelConfig.rotate !== true) {
21128
21138
  limit = outerRadius - spaceWidth;
21129
21139
  }
21130
21140
  const text = this._getFormatLabelText(arc.refDatum, limit);
@@ -21147,8 +21157,8 @@
21147
21157
  if (!vutils.isGreater(labelWidth, 0)) {
21148
21158
  arc.labelVisible = false;
21149
21159
  }
21150
- arc.angle = (_b = (_a = attribute === null || attribute === void 0 ? void 0 : attribute.textStyle) === null || _a === void 0 ? void 0 : _a.angle) !== null && _b !== void 0 ? _b : arc.middleAngle;
21151
- let offsetAngle = (_c = labelConfig === null || labelConfig === void 0 ? void 0 : labelConfig.offsetAngle) !== null && _c !== void 0 ? _c : 0;
21160
+ arc.angle = (_b = (_a = attribute.textStyle) === null || _a === void 0 ? void 0 : _a.angle) !== null && _b !== void 0 ? _b : arc.middleAngle;
21161
+ let offsetAngle = (_c = labelConfig.offsetAngle) !== null && _c !== void 0 ? _c : 0;
21152
21162
  if (['inside-inner', 'inside-outer'].includes(position)) {
21153
21163
  offsetAngle += Math.PI / 2;
21154
21164
  }
@@ -21157,8 +21167,8 @@
21157
21167
  return arcs;
21158
21168
  }
21159
21169
  _layoutOutsideLabels(arcs, attribute, currentMarks) {
21160
- var _a, _b, _c, _d, _e;
21161
- const center = { x: (_b = (_a = currentMarks[0].attribute) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0, y: (_d = (_c = currentMarks[0].attribute) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0 };
21170
+ var _a, _b, _c;
21171
+ 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 };
21162
21172
  const height = center.y * 2;
21163
21173
  const line2MinLength = attribute.line.line2MinLength;
21164
21174
  const labelLayout = attribute.layout;
@@ -21193,7 +21203,7 @@
21193
21203
  }
21194
21204
  }
21195
21205
  else {
21196
- const maxLabels = height / (((_e = attribute.textStyle) === null || _e === void 0 ? void 0 : _e.fontSize) || 16);
21206
+ const maxLabels = height / (((_c = attribute.textStyle) === null || _c === void 0 ? void 0 : _c.fontSize) || 16);
21197
21207
  this._adjustY(arcs, maxLabels, attribute, currentMarks);
21198
21208
  const { minY, maxY } = arcs.reduce((yInfo, arc) => {
21199
21209
  const { y1, y2 } = arc.getLabelBounds();
@@ -21216,11 +21226,11 @@
21216
21226
  vutils.isGreater(arc.pointB.x, width - line2MinLength - spaceWidth))) {
21217
21227
  arc.labelVisible = false;
21218
21228
  }
21219
- arc.angle = (_b = (_a = attribute === null || attribute === void 0 ? void 0 : attribute.textStyle) === null || _a === void 0 ? void 0 : _a.angle) !== null && _b !== void 0 ? _b : 0;
21220
- if (attribute === null || attribute === void 0 ? void 0 : attribute.offsetAngle) {
21229
+ arc.angle = (_b = (_a = attribute.textStyle) === null || _a === void 0 ? void 0 : _a.angle) !== null && _b !== void 0 ? _b : 0;
21230
+ if (attribute.offsetAngle) {
21221
21231
  arc.angle += attribute.offsetAngle;
21222
21232
  }
21223
- arc.labelLine = Object.assign({}, attribute === null || attribute === void 0 ? void 0 : attribute.line);
21233
+ arc.labelLine = Object.assign({}, attribute.line);
21224
21234
  });
21225
21235
  return arcs;
21226
21236
  }
@@ -21302,8 +21312,8 @@
21302
21312
  return (_a = value === null || value === void 0 ? void 0 : value.text) !== null && _a !== void 0 ? _a : '';
21303
21313
  }
21304
21314
  _adjustY(arcs, maxLabels, attribute, currentMarks) {
21305
- var _a, _b, _c, _d;
21306
- const center = { x: (_b = (_a = currentMarks[0].attribute) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0, y: (_d = (_c = currentMarks[0].attribute) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0 };
21315
+ var _a, _b;
21316
+ 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 };
21307
21317
  const plotRect = { width: center.x * 2, height: center.y * 2 };
21308
21318
  const labelLayout = attribute.layout;
21309
21319
  if (labelLayout.strategy === 'vertical') {
@@ -21642,17 +21652,21 @@
21642
21652
  }
21643
21653
  }
21644
21654
  }
21645
- _labelLine(text) {
21646
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
21647
- const labelLine = ((_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points)
21655
+ _createLabelLine(text, baseMark) {
21656
+ var _a, _b, _c, _d, _e, _f, _g;
21657
+ const { points, line = {}, visible, fill } = text.attribute;
21658
+ const labelLine = text.attribute.points
21648
21659
  ? graphicCreator.line({
21649
- visible: (_g = (_e = (((_c = (_b = text.attribute) === null || _b === void 0 ? void 0 : _b.line) === null || _c === void 0 ? void 0 : _c.visible) && ((_d = text.attribute) === null || _d === void 0 ? void 0 : _d.visible))) !== null && _e !== void 0 ? _e : (_f = text.attribute) === null || _f === void 0 ? void 0 : _f.visible) !== null && _g !== void 0 ? _g : true,
21650
- stroke: (_l = (_k = (_j = (_h = text.attribute) === null || _h === void 0 ? void 0 : _h.line) === null || _j === void 0 ? void 0 : _j.style) === null || _k === void 0 ? void 0 : _k.stroke) !== null && _l !== void 0 ? _l : (_m = text.attribute) === null || _m === void 0 ? void 0 : _m.fill,
21651
- lineWidth: (_r = (_q = (_p = (_o = text.attribute) === null || _o === void 0 ? void 0 : _o.line) === null || _p === void 0 ? void 0 : _p.style) === null || _q === void 0 ? void 0 : _q.lineWidth) !== null && _r !== void 0 ? _r : 1,
21652
- points: (_s = text.attribute) === null || _s === void 0 ? void 0 : _s.points,
21653
- curveType: ((_u = (_t = text.attribute) === null || _t === void 0 ? void 0 : _t.line) === null || _u === void 0 ? void 0 : _u.smooth) ? 'basis' : null
21660
+ visible: (_c = (_a = (line.visible && visible)) !== null && _a !== void 0 ? _a : (_b = text.attribute) === null || _b === void 0 ? void 0 : _b.visible) !== null && _c !== void 0 ? _c : true,
21661
+ stroke: (_e = (_d = line.style) === null || _d === void 0 ? void 0 : _d.stroke) !== null && _e !== void 0 ? _e : fill,
21662
+ lineWidth: (_g = (_f = line.style) === null || _f === void 0 ? void 0 : _f.lineWidth) !== null && _g !== void 0 ? _g : 1,
21663
+ points: points,
21664
+ curveType: line.smooth ? 'basis' : null
21654
21665
  })
21655
21666
  : undefined;
21667
+ if (labelLine) {
21668
+ this._setStatesOfLabelLine(labelLine);
21669
+ }
21656
21670
  return labelLine;
21657
21671
  }
21658
21672
  computeRadius(r, width, height, k) {
@@ -22250,6 +22264,32 @@
22250
22264
  this.beforeLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);
22251
22265
  this.handleLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);
22252
22266
  this.afterLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);
22267
+ let maxTextWidth = 0;
22268
+ let maxTextHeight = 0;
22269
+ let textAlign = 'center';
22270
+ let textBaseline = 'middle';
22271
+ labels.forEach((label) => {
22272
+ var _a;
22273
+ const labelStyle = label.attribute;
22274
+ const angle = (_a = labelStyle.angle) !== null && _a !== void 0 ? _a : 0;
22275
+ const textBounds = label.AABBBounds;
22276
+ let textWidth = textBounds.width();
22277
+ let textHeight = textBounds.height();
22278
+ if (angle) {
22279
+ textWidth = Math.abs(textWidth * Math.cos(angle));
22280
+ textHeight = Math.abs(textHeight * Math.sin(angle));
22281
+ }
22282
+ maxTextWidth = Math.max(maxTextWidth, textWidth);
22283
+ maxTextHeight = Math.max(maxTextHeight, textHeight);
22284
+ textAlign = labelStyle.textAlign;
22285
+ textBaseline = labelStyle.textBaseline;
22286
+ });
22287
+ this.axisLabelLayerSize[layer] = {
22288
+ width: maxTextWidth,
22289
+ height: maxTextHeight,
22290
+ textAlign,
22291
+ textBaseline
22292
+ };
22253
22293
  });
22254
22294
  }
22255
22295
  }
@@ -22320,12 +22360,8 @@
22320
22360
  labelGroup.name = `${exports.AXIS_ELEMENT_NAME.labelContainer}-layer-${layer}`;
22321
22361
  labelGroup.id = this._getNodeId(`label-container-layer-${layer}`);
22322
22362
  container.add(labelGroup);
22323
- let maxTextWidth = 0;
22324
- let maxTextHeight = 0;
22325
- let textAlign = 'center';
22326
- let textBaseline = 'middle';
22327
22363
  data.forEach((item, index) => {
22328
- var _a, _b, _c, _d;
22364
+ var _a, _b, _c;
22329
22365
  const labelStyle = this._getLabelAttribute(item, index, data, layer);
22330
22366
  let text;
22331
22367
  if (labelStyle.type === 'rich') {
@@ -22357,22 +22393,7 @@
22357
22393
  text.states = labelState;
22358
22394
  }
22359
22395
  labelGroup.add(text);
22360
- const angle = (_d = labelStyle.angle) !== null && _d !== void 0 ? _d : 0;
22361
- maxTextWidth = Math.max(maxTextWidth, text.AABBBounds.width());
22362
- maxTextHeight = Math.max(maxTextHeight, text.AABBBounds.height());
22363
- if (angle) {
22364
- maxTextWidth = Math.abs(maxTextWidth * Math.cos(angle));
22365
- maxTextHeight = Math.abs(maxTextHeight * Math.sin(angle));
22366
- }
22367
- textAlign = labelStyle.textAlign;
22368
- textBaseline = labelStyle.textBaseline;
22369
22396
  });
22370
- this.axisLabelLayerSize[layer] = {
22371
- width: maxTextWidth,
22372
- height: maxTextHeight,
22373
- textAlign,
22374
- textBaseline
22375
- };
22376
22397
  return labelGroup;
22377
22398
  }
22378
22399
  renderTitle(container) {
@@ -22526,7 +22547,7 @@
22526
22547
  }
22527
22548
  }
22528
22549
  const point = this.getVerticalCoord(tickDatum.point, offset, inside);
22529
- const vector = this.getVerticalVector(offset, inside, point);
22550
+ const vector = this.getVerticalVector(offset || 1, inside, point);
22530
22551
  const textContent = formatMethod
22531
22552
  ? formatMethod(`${tickDatum.label}`, tickDatum, index, tickData, layer)
22532
22553
  : tickDatum.label;
@@ -22658,10 +22679,22 @@
22658
22679
  do {
22659
22680
  items = reduce(items, sep);
22660
22681
  } while (items.length >= 3 && hasOverlap(items, sep));
22661
- if (items.length < 3 && !vutils.last(source).attribute.opacity) {
22662
- if (items.length > 1) {
22663
- vutils.last(items).setAttribute('opacity', 0);
22664
- vutils.last(source).setAttribute('opacity', 1);
22682
+ const checkLast = items.length < 3 || config.lastVisible;
22683
+ if (checkLast) {
22684
+ const lastSourceItem = vutils.last(source);
22685
+ if (!lastSourceItem.attribute.opacity) {
22686
+ const remainLength = items.length;
22687
+ if (remainLength > 1) {
22688
+ lastSourceItem.setAttribute('opacity', 1);
22689
+ for (let i = remainLength - 1; i >= 0; i--) {
22690
+ if (intersect(items[i], lastSourceItem, sep)) {
22691
+ items[i].setAttribute('opacity', 0);
22692
+ }
22693
+ else {
22694
+ break;
22695
+ }
22696
+ }
22697
+ }
22665
22698
  }
22666
22699
  }
22667
22700
  }
@@ -22780,7 +22813,7 @@
22780
22813
  }
22781
22814
 
22782
22815
  function autoLimit(labels, config) {
22783
- const { limitLength, ellipsis = '...', orient } = config;
22816
+ const { limitLength, verticalLimitLength, ellipsis = '...', orient } = config;
22784
22817
  if (vutils.isEmpty(labels) || !vutils.isValidNumber(limitLength)) {
22785
22818
  return;
22786
22819
  }
@@ -22788,14 +22821,20 @@
22788
22821
  if ((orient === 'top' || orient === 'bottom') && Math.floor(label.AABBBounds.height()) <= limitLength) {
22789
22822
  return;
22790
22823
  }
22791
- if ((orient === 'left' || orient === 'right') && Math.floor(label.AABBBounds.width()) <= limitLength) {
22824
+ const direction = label.attribute.direction;
22825
+ if ((orient === 'left' || orient === 'right') &&
22826
+ ((direction === 'vertical' && Math.floor(label.AABBBounds.height()) <= verticalLimitLength) ||
22827
+ (direction !== 'vertical' && Math.floor(label.AABBBounds.width()) <= limitLength))) {
22792
22828
  return;
22793
22829
  }
22794
- let limitLabelLength = label.attribute.angle === 0 || vutils.isNil(label.attribute.angle)
22830
+ const angle = label.attribute.angle;
22831
+ let limitLabelLength = angle === 0 || vutils.isNil(angle)
22795
22832
  ? orient === 'top' || orient === 'bottom'
22796
22833
  ? null
22797
- : limitLength
22798
- : Math.abs(limitLength / Math.sin(label.attribute.angle));
22834
+ : direction === 'vertical'
22835
+ ? verticalLimitLength
22836
+ : limitLength
22837
+ : Math.abs(limitLength / Math.sin(angle));
22799
22838
  if (vutils.isValidNumber(label.attribute.maxLineWidth)) {
22800
22839
  limitLabelLength = vutils.isValidNumber(limitLabelLength)
22801
22840
  ? Math.min(label.attribute.maxLineWidth, limitLabelLength)
@@ -23212,7 +23251,7 @@
23212
23251
  }
23213
23252
  const { verticalLimitSize, label, orient } = this.attribute;
23214
23253
  const limitLength = this._getAxisLabelLimitLength(verticalLimitSize, layerCount);
23215
- const { layoutFunc, autoRotate: autoRotate$1, autoRotateAngle, autoLimit: autoLimit$1, limitEllipsis, autoHide: autoHide$1, autoHideMethod, autoHideSeparation } = label;
23254
+ const { layoutFunc, autoRotate: autoRotate$1, autoRotateAngle, autoLimit: autoLimit$1, limitEllipsis, autoHide: autoHide$1, autoHideMethod, autoHideSeparation, lastVisible } = label;
23216
23255
  if (vutils.isFunction(layoutFunc)) {
23217
23256
  layoutFunc(labelShapes, labelData, layer, this);
23218
23257
  }
@@ -23224,8 +23263,13 @@
23224
23263
  });
23225
23264
  }
23226
23265
  if (autoLimit$1 && vutils.isValidNumber(limitLength) && limitLength > 0) {
23266
+ const verticalLimitLength = (orient === 'left' || orient === 'right') &&
23267
+ labelShapes.some(label => label.attribute.direction === 'vertical')
23268
+ ? Math.abs(this.attribute.start.y - this.attribute.end.y) / labelShapes.length
23269
+ : Infinity;
23227
23270
  autoLimit(labelShapes, {
23228
23271
  limitLength,
23272
+ verticalLimitLength,
23229
23273
  ellipsis: limitEllipsis,
23230
23274
  orient
23231
23275
  });
@@ -23234,7 +23278,8 @@
23234
23278
  autoHide(labelShapes, {
23235
23279
  orient,
23236
23280
  method: autoHideMethod,
23237
- separation: autoHideSeparation
23281
+ separation: autoHideSeparation,
23282
+ lastVisible
23238
23283
  });
23239
23284
  }
23240
23285
  }
@@ -26228,7 +26273,13 @@
26228
26273
  let shapeSize = 0;
26229
26274
  let shapeSpace = 0;
26230
26275
  if (shapeAttr && shapeAttr.visible !== false) {
26231
- shapeSize = vutils.get(shapeStyle, 'style.size', DEFAULT_SHAPE_SIZE);
26276
+ const s = vutils.get(shapeStyle, 'style.size', DEFAULT_SHAPE_SIZE);
26277
+ if (vutils.isArray(s)) {
26278
+ shapeSize = s[0] || 0;
26279
+ }
26280
+ else {
26281
+ shapeSize = s;
26282
+ }
26232
26283
  shapeSpace = vutils.get(shapeAttr, 'space', DEFAULT_SHAPE_SPACE);
26233
26284
  const itemShape = graphicCreator.symbol(Object.assign(Object.assign({ x: 0, y: 0, symbolType: 'circle', strokeBoundsBuffer: 0 }, shape), shapeStyle.style));
26234
26285
  Object.keys(shapeStyle.state || {}).forEach(key => {
@@ -29809,7 +29860,7 @@
29809
29860
  }
29810
29861
  };
29811
29862
 
29812
- const version = "0.17.8";
29863
+ const version = "0.17.10";
29813
29864
 
29814
29865
  exports.AbstractComponent = AbstractComponent;
29815
29866
  exports.ArcInfo = ArcInfo;