@visactor/vrender-components 0.17.9 → 0.17.11-alpha.1

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 (65) hide show
  1. package/cjs/axis/base.js +19 -15
  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/jsx/index.js +1 -1
  17. package/cjs/label/arc.d.ts +1 -1
  18. package/cjs/label/arc.js +34 -31
  19. package/cjs/label/arc.js.map +1 -1
  20. package/cjs/label/base.d.ts +4 -7
  21. package/cjs/label/base.js +37 -24
  22. package/cjs/label/base.js.map +1 -1
  23. package/cjs/label/index.js +1 -2
  24. package/cjs/label/line.js +2 -1
  25. package/cjs/label/type.d.ts +10 -3
  26. package/cjs/label/type.js.map +1 -1
  27. package/cjs/label/util.d.ts +4 -0
  28. package/cjs/label/util.js +21 -3
  29. package/cjs/label/util.js.map +1 -1
  30. package/cjs/legend/discrete/discrete.js +2 -2
  31. package/cjs/legend/discrete/discrete.js.map +1 -1
  32. package/dist/index.js +304 -257
  33. package/dist/index.min.js +1 -1
  34. package/es/axis/base.js +18 -15
  35. package/es/axis/base.js.map +1 -1
  36. package/es/axis/line.js +21 -13
  37. package/es/axis/line.js.map +1 -1
  38. package/es/axis/overlap/auto-hide.d.ts +1 -0
  39. package/es/axis/overlap/auto-hide.js +10 -2
  40. package/es/axis/overlap/auto-hide.js.map +1 -1
  41. package/es/axis/overlap/auto-limit.d.ts +1 -0
  42. package/es/axis/overlap/auto-limit.js +5 -3
  43. package/es/axis/overlap/auto-limit.js.map +1 -1
  44. package/es/axis/type.d.ts +1 -0
  45. package/es/axis/type.js.map +1 -1
  46. package/es/index.d.ts +1 -1
  47. package/es/index.js +1 -1
  48. package/es/index.js.map +1 -1
  49. package/es/jsx/index.js +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/index.js +1 -2
  57. package/es/label/line.js +2 -1
  58. package/es/label/type.d.ts +10 -3
  59. package/es/label/type.js.map +1 -1
  60. package/es/label/util.d.ts +4 -0
  61. package/es/label/util.js +19 -2
  62. package/es/label/util.js.map +1 -1
  63. package/es/legend/discrete/discrete.js +3 -2
  64. package/es/legend/discrete/discrete.js.map +1 -1
  65. package/package.json +3 -3
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,
@@ -8295,10 +8267,12 @@
8295
8267
  get: function get() {
8296
8268
  var textTheme = getTheme(this).text,
8297
8269
  attribute = this.attribute;
8298
- if (!this.isSimplify()) return;
8270
+ if (this.isMultiLine) return;
8299
8271
  var _attribute$maxLineWid2 = attribute.maxLineWidth,
8300
8272
  maxLineWidth = _attribute$maxLineWid2 === void 0 ? textTheme.maxLineWidth : _attribute$maxLineWid2;
8301
- return !!Number.isFinite(maxLineWidth) && (this.tryUpdateAABBBounds(), null != this.clipedText && this.clipedText !== attribute.text.toString());
8273
+ return !!Number.isFinite(maxLineWidth) && (this.tryUpdateAABBBounds(), "vertical" === attribute.direction && this.cache.verticalList && this.cache.verticalList[0] ? this.cache.verticalList[0].map(function (item) {
8274
+ return item.text;
8275
+ }).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString());
8302
8276
  }
8303
8277
  }, {
8304
8278
  key: "multilineLayout",
@@ -12511,6 +12485,7 @@
12511
12485
  return DefaultBaseInteractiveRenderContribution;
12512
12486
  }();
12513
12487
  DefaultBaseInteractiveRenderContribution = __decorate$L([injectable(), __param$w(0, inject(ContributionProvider)), __param$w(0, named(InteractiveSubRenderContribution)), __metadata$B("design:paramtypes", [Object])], DefaultBaseInteractiveRenderContribution);
12488
+
12514
12489
  var DefaultBaseTextureRenderContribution = /*#__PURE__*/function () {
12515
12490
  function DefaultBaseTextureRenderContribution() {
12516
12491
  _classCallCheck(this, DefaultBaseTextureRenderContribution);
@@ -12611,16 +12586,20 @@
12611
12586
  key: "drawShape",
12612
12587
  value: function drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
12613
12588
  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;
12589
+ var _graphic$attribute = graphic.attribute,
12590
+ _graphic$attribute$te = _graphic$attribute.texture,
12591
+ texture = _graphic$attribute$te === void 0 ? graphicAttribute.texture : _graphic$attribute$te,
12592
+ _graphic$attribute$te2 = _graphic$attribute.textureColor,
12593
+ textureColor = _graphic$attribute$te2 === void 0 ? graphicAttribute.textureColor : _graphic$attribute$te2,
12594
+ _graphic$attribute$te3 = _graphic$attribute.textureSize,
12595
+ textureSize = _graphic$attribute$te3 === void 0 ? graphicAttribute.textureSize : _graphic$attribute$te3,
12596
+ _graphic$attribute$te4 = _graphic$attribute.texturePadding,
12597
+ texturePadding = _graphic$attribute$te4 === void 0 ? graphicAttribute.texturePadding : _graphic$attribute$te4;
12598
+ texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
12599
+ }
12600
+ }, {
12601
+ key: "drawTexture",
12602
+ value: function drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
12624
12603
  var pattern = this.textureMap.get(texture);
12625
12604
  if (!pattern) switch (texture) {
12626
12605
  case "circle":
@@ -13136,6 +13115,37 @@
13136
13115
  var defaultSymbolTextureRenderContribution = defaultBaseTextureRenderContribution;
13137
13116
  var defaultSymbolBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
13138
13117
 
13118
+ var DefaultAreaTextureRenderContribution = /*#__PURE__*/function (_DefaultBaseTextureRe) {
13119
+ _inherits(DefaultAreaTextureRenderContribution, _DefaultBaseTextureRe);
13120
+ var _super = _createSuper(DefaultAreaTextureRenderContribution);
13121
+ function DefaultAreaTextureRenderContribution() {
13122
+ var _this;
13123
+ _classCallCheck(this, DefaultAreaTextureRenderContribution);
13124
+ _this = _super.apply(this, arguments), _this.time = BaseRenderContributionTime.afterFillStroke;
13125
+ return _this;
13126
+ }
13127
+ _createClass(DefaultAreaTextureRenderContribution, [{
13128
+ key: "drawShape",
13129
+ value: function drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
13130
+ var _a, _b, _c, _d;
13131
+ this.textureMap || this.initTextureMap(context, graphic.stage);
13132
+ var _ref = options || {},
13133
+ _ref$attribute = _ref.attribute,
13134
+ attribute = _ref$attribute === void 0 ? graphic.attribute : _ref$attribute,
13135
+ _attribute$texture = attribute.texture,
13136
+ texture = _attribute$texture === void 0 ? null !== (_a = graphic.attribute.texture) && void 0 !== _a ? _a : getAttributeFromDefaultAttrList(graphicAttribute, "texture") : _attribute$texture,
13137
+ _attribute$textureCol = attribute.textureColor,
13138
+ textureColor = _attribute$textureCol === void 0 ? null !== (_b = graphic.attribute.textureColor) && void 0 !== _b ? _b : getAttributeFromDefaultAttrList(graphicAttribute, "textureColor") : _attribute$textureCol,
13139
+ _attribute$textureSiz = attribute.textureSize,
13140
+ textureSize = _attribute$textureSiz === void 0 ? null !== (_c = graphic.attribute.textureSize) && void 0 !== _c ? _c : getAttributeFromDefaultAttrList(graphicAttribute, "textureSize") : _attribute$textureSiz,
13141
+ _attribute$texturePad = attribute.texturePadding,
13142
+ texturePadding = _attribute$texturePad === void 0 ? null !== (_d = graphic.attribute.texturePadding) && void 0 !== _d ? _d : getAttributeFromDefaultAttrList(graphicAttribute, "texturePadding") : _attribute$texturePad;
13143
+ texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
13144
+ }
13145
+ }]);
13146
+ return DefaultAreaTextureRenderContribution;
13147
+ }(DefaultBaseTextureRenderContribution);
13148
+
13139
13149
  var __decorate$J = undefined && undefined.__decorate || function (decorators, target, key, desc) {
13140
13150
  var d,
13141
13151
  c = arguments.length,
@@ -13376,6 +13386,26 @@
13376
13386
  }(BaseRender);
13377
13387
  DefaultCanvasCircleRender = __decorate$I([injectable(), __param$u(0, inject(ContributionProvider)), __param$u(0, named(CircleRenderContribution)), __metadata$z("design:paramtypes", [Object])], DefaultCanvasCircleRender);
13378
13388
 
13389
+ function drawSegItem(ctx, curve, endPercent, params) {
13390
+ if (!curve.p1) return;
13391
+ var _ref = params || {},
13392
+ _ref$offsetX = _ref.offsetX,
13393
+ offsetX = _ref$offsetX === void 0 ? 0 : _ref$offsetX,
13394
+ _ref$offsetY = _ref.offsetY,
13395
+ offsetY = _ref$offsetY === void 0 ? 0 : _ref$offsetY,
13396
+ _ref$offsetZ = _ref.offsetZ,
13397
+ offsetZ = _ref$offsetZ === void 0 ? 0 : _ref$offsetZ;
13398
+ 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) {
13399
+ var _divideCubic = divideCubic(curve, endPercent),
13400
+ _divideCubic2 = _slicedToArray(_divideCubic, 1),
13401
+ curve1 = _divideCubic2[0];
13402
+ 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);
13403
+ } else {
13404
+ var p = curve.getPointAt(endPercent);
13405
+ ctx.lineTo(offsetX + p.x, offsetY + p.y, offsetZ);
13406
+ }
13407
+ }
13408
+
13379
13409
  function drawSegments(path, segPath, percent, clipRangeByDimension, params) {
13380
13410
  var _a;
13381
13411
  var _ref = params || {},
@@ -13418,7 +13448,7 @@
13418
13448
  } else _lastCurve = curve;
13419
13449
  });
13420
13450
  } 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;
13451
+ curve.defined ? (needMoveTo && path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), drawSegItem(path, curve, 1, params), needMoveTo = !1) : needMoveTo = !0;
13422
13452
  });
13423
13453
  return;
13424
13454
  }
@@ -13457,7 +13487,7 @@
13457
13487
  needMoveTo = !0;
13458
13488
  continue;
13459
13489
  }
13460
- needMoveTo && path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), drawSegItem$1(path, curve, vutils.min(_p, 1), params), needMoveTo = !1;
13490
+ needMoveTo && path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), drawSegItem(path, curve, vutils.min(_p, 1), params), needMoveTo = !1;
13461
13491
  }
13462
13492
  }
13463
13493
  }
@@ -13494,25 +13524,6 @@
13494
13524
  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
13525
  });
13496
13526
  }
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
13527
 
13517
13528
  var __decorate$H = undefined && undefined.__decorate || function (decorators, target, key, desc) {
13518
13529
  var d,
@@ -13584,10 +13595,10 @@
13584
13595
  var z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
13585
13596
  points = line.attribute.points,
13586
13597
  startP = points[0];
13587
- context.moveTo(startP.x, startP.y, z);
13598
+ context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
13588
13599
  for (var i = 1; i < points.length; i++) {
13589
13600
  var p = points[i];
13590
- context.lineTo(p.x, p.y, z);
13601
+ context.lineTo(p.x + offsetX, p.y + offsetY, z);
13591
13602
  }
13592
13603
  context.setShadowBlendStyle && context.setShadowBlendStyle(line, line.attribute, lineAttribute);
13593
13604
  var _line$attribute = line.attribute,
@@ -13820,83 +13831,7 @@
13820
13831
  }
13821
13832
  path.closePath();
13822
13833
  }
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
13834
 
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
13835
  var defaultAreaTextureRenderContribution = new DefaultAreaTextureRenderContribution();
13901
13836
  var defaultAreaBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
13902
13837
 
@@ -13953,39 +13888,43 @@
13953
13888
  var z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
13954
13889
  points = area.attribute.points,
13955
13890
  startP = points[0];
13956
- context.moveTo(startP.x, startP.y, z);
13891
+ context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
13957
13892
  for (var i = 1; i < points.length; i++) {
13958
13893
  var p = points[i];
13959
- context.lineTo(p.x, p.y, z);
13894
+ context.lineTo(p.x + offsetX, p.y + offsetY, z);
13960
13895
  }
13961
13896
  for (var _i = points.length - 1; _i >= 0; _i--) {
13962
13897
  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);
13898
+ 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
13899
  }
13965
- context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(area, area.attribute, areaAttribute);
13900
+ context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(area, area.attribute, areaAttribute), this.beforeRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, areaAttribute, drawContext, fillCb, null, {
13901
+ attribute: area.attribute
13902
+ });
13966
13903
  var _area$attribute = area.attribute,
13967
13904
  _area$attribute$x = _area$attribute.x,
13968
13905
  originX = _area$attribute$x === void 0 ? 0 : _area$attribute$x,
13969
13906
  _area$attribute$x2 = _area$attribute.x,
13970
13907
  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) {
13908
+ 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, {
13909
+ attribute: area.attribute
13910
+ }), stroke) {
13972
13911
  var _area$attribute$strok = area.attribute.stroke,
13973
13912
  _stroke = _area$attribute$strok === void 0 ? areaAttribute && areaAttribute.stroke : _area$attribute$strok;
13974
13913
  if (vutils.isArray(_stroke) && (_stroke[0] || _stroke[2]) && !1 === _stroke[1]) if (context.beginPath(), _stroke[0]) {
13975
- context.moveTo(startP.x, startP.y, z);
13914
+ context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
13976
13915
  for (var _i2 = 1; _i2 < points.length; _i2++) {
13977
13916
  var _p2 = points[_i2];
13978
- context.lineTo(_p2.x, _p2.y, z);
13917
+ context.lineTo(_p2.x + offsetX, _p2.y + offsetY, z);
13979
13918
  }
13980
13919
  } else if (_stroke[2]) {
13981
13920
  var endP = points[points.length - 1];
13982
- context.moveTo(endP.x, endP.y, z);
13921
+ context.moveTo(endP.x + offsetX, endP.y + offsetY, z);
13983
13922
  for (var _i3 = points.length - 2; _i3 >= 0; _i3--) {
13984
13923
  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);
13924
+ 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
13925
  }
13987
13926
  }
13988
- context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke();
13927
+ strokeCb ? strokeCb(context, area.attribute, areaAttribute) : (context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke());
13989
13928
  }
13990
13929
  }
13991
13930
  }, {
@@ -17506,13 +17445,24 @@
17506
17445
  x = _area$attribute$x === void 0 ? areaAttribute.x : _area$attribute$x,
17507
17446
  _area$attribute$y = _area$attribute.y,
17508
17447
  y = _area$attribute$y === void 0 ? areaAttribute.y : _area$attribute$y;
17448
+ var _area$attribute2 = area.attribute,
17449
+ _area$attribute2$fill = _area$attribute2.fillPickable,
17450
+ fillPickable = _area$attribute2$fill === void 0 ? areaAttribute.fillPickable : _area$attribute2$fill,
17451
+ _area$attribute2$stro = _area$attribute2.strokePickable,
17452
+ strokePickable = _area$attribute2$stro === void 0 ? areaAttribute.strokePickable : _area$attribute2$stro;
17509
17453
  if (pickContext.highPerformanceSave(), area.transMatrix.onlyTranslate()) {
17510
17454
  var _point = area.getOffsetXY(areaAttribute);
17511
17455
  x += _point.x, y += _point.y, pickContext.setTransformForCurrent();
17512
17456
  } else x = 0, y = 0, pickContext.transformFromMatrix(area.transMatrix, !0);
17513
17457
  var picked = !1;
17514
17458
  return this.canvasRenderer.drawShape(area, pickContext, x, y, {}, null, function (context) {
17515
- return !!picked || (picked = context.isPointInPath(point.x, point.y), picked);
17459
+ return !!picked || !!fillPickable && (picked = context.isPointInPath(point.x, point.y), picked);
17460
+ }, function (context, areaAttribute, themeAttribute) {
17461
+ if (picked) return !0;
17462
+ if (!strokePickable) return !1;
17463
+ var lineWidth = areaAttribute.lineWidth || themeAttribute.lineWidth,
17464
+ pickStrokeBuffer = areaAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
17465
+ return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
17516
17466
  }), pickContext.highPerformanceRestore(), picked;
17517
17467
  }
17518
17468
  }]);
@@ -20171,6 +20121,37 @@
20171
20121
  }
20172
20122
  return { x, y };
20173
20123
  }
20124
+ function connectLineBetweenBounds(boundA, boundB) {
20125
+ if (!boundA || !boundB) {
20126
+ return;
20127
+ }
20128
+ if (vutils.isRectIntersect(boundA, boundB, true)) {
20129
+ return;
20130
+ }
20131
+ const x1 = Math.min(boundA.x1, boundA.x2);
20132
+ const y1 = Math.min(boundA.y1, boundA.y2);
20133
+ const x2 = Math.min(boundB.x1, boundB.x2);
20134
+ const y2 = Math.min(boundB.y1, boundB.y2);
20135
+ const w1 = Math.abs(boundA.x2 - x1) / 2;
20136
+ const h1 = Math.abs(boundA.y2 - y1) / 2;
20137
+ const w2 = Math.abs(boundB.x2 - x2) / 2;
20138
+ const h2 = Math.abs(boundB.y2 - y2) / 2;
20139
+ const cx1 = x1 + w1;
20140
+ const cy1 = y1 + h1;
20141
+ const cx2 = x2 + w2;
20142
+ const cy2 = y2 + h2;
20143
+ const dx = cx2 - cx1;
20144
+ const dy = cy2 - cy1;
20145
+ const p1 = getIntersection(dx, dy, cx1, cy1, w1, h1);
20146
+ const p2 = getIntersection(-dx, -dy, cx2, cy2, w2, h2);
20147
+ return [p1, p2];
20148
+ }
20149
+ function getIntersection(dx, dy, cx, cy, w, h) {
20150
+ if (Math.abs(dy / dx) < h / w) {
20151
+ return { x: cx + (dx > 0 ? w : -w), y: cy + (dy * w) / Math.abs(dx) };
20152
+ }
20153
+ return { x: cx + (dx * h) / Math.abs(dy), y: cy + (dy > 0 ? h : -h) };
20154
+ }
20174
20155
 
20175
20156
  function loadLabelComponent() {
20176
20157
  registerGroup();
@@ -20236,9 +20217,10 @@
20236
20217
  }
20237
20218
  };
20238
20219
  this._handleRelatedGraphicSetState = (e) => {
20239
- var _a, _b, _c;
20240
- if (((_a = e.detail) === null || _a === void 0 ? void 0 : _a.type) === AttributeUpdateType.STATE) {
20241
- const currentStates = (_c = (_b = e.target) === null || _b === void 0 ? void 0 : _b.currentStates) !== null && _c !== void 0 ? _c : [];
20220
+ var _a, _b, _c, _d, _e;
20221
+ if (((_a = e.detail) === null || _a === void 0 ? void 0 : _a.type) === AttributeUpdateType.STATE ||
20222
+ (((_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))) {
20223
+ const currentStates = (_e = (_d = e.target) === null || _d === void 0 ? void 0 : _d.currentStates) !== null && _e !== void 0 ? _e : [];
20242
20224
  const labels = this._isCollectionBase ? [...this._graphicToText.values()] : [this._graphicToText.get(e.target)];
20243
20225
  labels.forEach(label => {
20244
20226
  if (label) {
@@ -20256,8 +20238,21 @@
20256
20238
  labeling(textBounds, graphicBounds, position, offset) {
20257
20239
  return;
20258
20240
  }
20259
- _labelLine(text) {
20260
- return;
20241
+ _createLabelLine(text, baseMark) {
20242
+ const points = connectLineBetweenBounds(text.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds);
20243
+ if (points) {
20244
+ const line = graphicCreator.line({
20245
+ points
20246
+ });
20247
+ if (baseMark && baseMark.attribute.fill) {
20248
+ line.setAttribute('stroke', baseMark.attribute.fill);
20249
+ }
20250
+ if (this.attribute.line && !vutils.isEmpty(this.attribute.line.style)) {
20251
+ line.setAttributes(this.attribute.line.style);
20252
+ }
20253
+ this._setStatesOfLabelLine(line);
20254
+ return line;
20255
+ }
20261
20256
  }
20262
20257
  render() {
20263
20258
  this._prepare();
@@ -20386,7 +20381,7 @@
20386
20381
  for (let i = 0; i < currentBaseMarks.length; i++) {
20387
20382
  const baseMark = currentBaseMarks[i];
20388
20383
  const points = getPointsOfLineArea(baseMark);
20389
- if (points === null || points === void 0 ? void 0 : points.length) {
20384
+ if (points && points.length) {
20390
20385
  for (let j = 0; j < points.length; j++) {
20391
20386
  const textData = data[cur];
20392
20387
  if (textData && points[j]) {
@@ -20505,7 +20500,10 @@
20505
20500
  result.push(text);
20506
20501
  continue;
20507
20502
  }
20508
- if (checkBounds && (baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds) && this._canPlaceInside(text.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds)) {
20503
+ if (checkBounds &&
20504
+ baseMark &&
20505
+ baseMark.AABBBounds &&
20506
+ this._canPlaceInside(text.AABBBounds, baseMark.AABBBounds)) {
20509
20507
  bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
20510
20508
  result.push(text);
20511
20509
  continue;
@@ -20576,17 +20574,21 @@
20576
20574
  }
20577
20575
  }
20578
20576
  _renderWithAnimation(labels) {
20577
+ var _a;
20579
20578
  const currentTextMap = new Map();
20580
20579
  const prevTextMap = this._graphicToText || new Map();
20581
20580
  const texts = [];
20582
20581
  const labelLines = [];
20582
+ const { visible: showLabelLine } = (_a = this.attribute.line) !== null && _a !== void 0 ? _a : {};
20583
20583
  labels.forEach((text, index) => {
20584
- var _a, _b, _c, _d, _e, _f, _g;
20585
- const labelLine = this._labelLine(text);
20586
20584
  const relatedGraphic = this.getRelatedGraphic(text.attribute);
20587
20585
  const textId = text.attribute.id;
20588
20586
  const textKey = this._isCollectionBase ? textId : relatedGraphic;
20589
20587
  const state = (prevTextMap === null || prevTextMap === void 0 ? void 0 : prevTextMap.get(textKey)) ? 'update' : 'enter';
20588
+ let labelLine;
20589
+ if (showLabelLine) {
20590
+ labelLine = this._createLabelLine(text, relatedGraphic);
20591
+ }
20590
20592
  if (state === 'enter') {
20591
20593
  texts.push(text);
20592
20594
  currentTextMap.set(textKey, labelLine ? { text, labelLine } : { text });
@@ -20594,7 +20596,6 @@
20594
20596
  const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');
20595
20597
  this.add(text);
20596
20598
  if (labelLine) {
20597
- this._setStatesOfLabelLine(labelLine);
20598
20599
  labelLines.push(labelLine);
20599
20600
  this.add(labelLine);
20600
20601
  }
@@ -20615,10 +20616,9 @@
20615
20616
  const prevText = prevLabel.text;
20616
20617
  const { duration, easing } = this._animationConfig.update;
20617
20618
  updateAnimation(prevText, text, this._animationConfig.update);
20618
- if (prevLabel.labelLine) {
20619
+ if (prevLabel.labelLine && labelLine) {
20619
20620
  prevLabel.labelLine.animate().to(vutils.merge({}, prevLabel.labelLine.attribute, {
20620
- 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,
20621
- points: (_g = text.attribute) === null || _g === void 0 ? void 0 : _g.points
20621
+ points: labelLine.attribute.points
20622
20622
  }), duration, easing);
20623
20623
  }
20624
20624
  }
@@ -20627,7 +20627,7 @@
20627
20627
  var _a;
20628
20628
  (_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(() => {
20629
20629
  this.removeChild(label.text);
20630
- if (label === null || label === void 0 ? void 0 : label.labelLine) {
20630
+ if (label.labelLine) {
20631
20631
  this.removeChild(label.labelLine);
20632
20632
  }
20633
20633
  });
@@ -20635,14 +20635,18 @@
20635
20635
  this._graphicToText = currentTextMap;
20636
20636
  }
20637
20637
  _renderWithOutAnimation(labels) {
20638
+ var _a;
20638
20639
  const currentTextMap = new Map();
20639
20640
  const prevTextMap = this._graphicToText || new Map();
20641
+ const { visible: showLabelLine } = (_a = this.attribute.line) !== null && _a !== void 0 ? _a : {};
20640
20642
  labels.forEach(text => {
20641
- var _a;
20642
- const labelLine = this._labelLine(text);
20643
20643
  const relatedGraphic = this.getRelatedGraphic(text.attribute);
20644
20644
  const state = (prevTextMap === null || prevTextMap === void 0 ? void 0 : prevTextMap.get(relatedGraphic)) ? 'update' : 'enter';
20645
20645
  const textKey = this._isCollectionBase ? text.attribute.id : relatedGraphic;
20646
+ let labelLine;
20647
+ if (showLabelLine) {
20648
+ labelLine = this._createLabelLine(text, relatedGraphic);
20649
+ }
20646
20650
  if (state === 'enter') {
20647
20651
  currentTextMap.set(textKey, labelLine ? { text, labelLine } : { text });
20648
20652
  this.add(text);
@@ -20656,14 +20660,14 @@
20656
20660
  prevTextMap.delete(textKey);
20657
20661
  currentTextMap.set(textKey, prevLabel);
20658
20662
  prevLabel.text.setAttributes(text.attribute);
20659
- if (prevLabel === null || prevLabel === void 0 ? void 0 : prevLabel.labelLine) {
20660
- prevLabel.labelLine.setAttributes({ points: (_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points });
20663
+ if (prevLabel.labelLine && labelLine) {
20664
+ prevLabel.labelLine.setAttributes({ points: labelLine.attribute.points });
20661
20665
  }
20662
20666
  }
20663
20667
  });
20664
20668
  prevTextMap.forEach(label => {
20665
20669
  this.removeChild(label.text);
20666
- if (label === null || label === void 0 ? void 0 : label.labelLine) {
20670
+ if (label.labelLine) {
20667
20671
  this.removeChild(label.labelLine);
20668
20672
  }
20669
20673
  });
@@ -20771,7 +20775,7 @@
20771
20775
  stroke && label.setAttributes({ stroke });
20772
20776
  }
20773
20777
  else {
20774
- const isInside = this._canPlaceInside(label.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds);
20778
+ const isInside = this._canPlaceInside(label.AABBBounds, baseMark.AABBBounds);
20775
20779
  if (isInside) {
20776
20780
  const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
20777
20781
  fill && label.setAttributes({ fill });
@@ -21034,18 +21038,20 @@
21034
21038
  for (let i = 0; i < data.length; i++) {
21035
21039
  const textData = data[i];
21036
21040
  const basedArc = arcs.find(arc => { var _a; return ((_a = arc.refDatum) === null || _a === void 0 ? void 0 : _a.id) === textData.id; });
21037
- const labelAttribute = {
21038
- visible: basedArc.labelVisible,
21039
- x: basedArc.labelPosition.x,
21040
- y: basedArc.labelPosition.y,
21041
- angle: basedArc.angle,
21042
- maxLineWidth: basedArc.labelLimit,
21043
- 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)
21044
- ? [basedArc.pointA, basedArc.pointB, basedArc.pointC]
21045
- : undefined,
21046
- line: basedArc === null || basedArc === void 0 ? void 0 : basedArc.labelLine
21047
- };
21048
- labels[i].setAttributes(labelAttribute);
21041
+ if (basedArc) {
21042
+ const labelAttribute = {
21043
+ visible: basedArc.labelVisible,
21044
+ x: basedArc.labelPosition.x,
21045
+ y: basedArc.labelPosition.y,
21046
+ angle: basedArc.angle,
21047
+ maxLineWidth: basedArc.labelLimit,
21048
+ points: basedArc.pointA && basedArc.pointB && basedArc.pointC
21049
+ ? [basedArc.pointA, basedArc.pointB, basedArc.pointC]
21050
+ : undefined,
21051
+ line: basedArc.labelLine
21052
+ };
21053
+ labels[i].setAttributes(labelAttribute);
21054
+ }
21049
21055
  }
21050
21056
  return labels;
21051
21057
  }
@@ -21108,8 +21114,8 @@
21108
21114
  var _a, _b;
21109
21115
  const labelConfig = attribute;
21110
21116
  const spaceWidth = labelConfig.spaceWidth;
21111
- const position = (_a = labelConfig === null || labelConfig === void 0 ? void 0 : labelConfig.position) !== null && _a !== void 0 ? _a : 'inside';
21112
- const offsetRadius = (_b = labelConfig === null || labelConfig === void 0 ? void 0 : labelConfig.offsetRadius) !== null && _b !== void 0 ? _b : -spaceWidth;
21117
+ const position = (_a = labelConfig.position) !== null && _a !== void 0 ? _a : 'inside';
21118
+ const offsetRadius = (_b = labelConfig.offsetRadius) !== null && _b !== void 0 ? _b : -spaceWidth;
21113
21119
  arcs.forEach((arc) => {
21114
21120
  var _a, _b, _c;
21115
21121
  const { labelSize, radian } = arc;
@@ -21130,7 +21136,7 @@
21130
21136
  }
21131
21137
  limit = outerRadius - minRadius - spaceWidth;
21132
21138
  }
21133
- if ((labelConfig === null || labelConfig === void 0 ? void 0 : labelConfig.rotate) !== true) {
21139
+ if (labelConfig.rotate !== true) {
21134
21140
  limit = outerRadius - spaceWidth;
21135
21141
  }
21136
21142
  const text = this._getFormatLabelText(arc.refDatum, limit);
@@ -21153,8 +21159,8 @@
21153
21159
  if (!vutils.isGreater(labelWidth, 0)) {
21154
21160
  arc.labelVisible = false;
21155
21161
  }
21156
- 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;
21157
- let offsetAngle = (_c = labelConfig === null || labelConfig === void 0 ? void 0 : labelConfig.offsetAngle) !== null && _c !== void 0 ? _c : 0;
21162
+ arc.angle = (_b = (_a = attribute.textStyle) === null || _a === void 0 ? void 0 : _a.angle) !== null && _b !== void 0 ? _b : arc.middleAngle;
21163
+ let offsetAngle = (_c = labelConfig.offsetAngle) !== null && _c !== void 0 ? _c : 0;
21158
21164
  if (['inside-inner', 'inside-outer'].includes(position)) {
21159
21165
  offsetAngle += Math.PI / 2;
21160
21166
  }
@@ -21163,8 +21169,8 @@
21163
21169
  return arcs;
21164
21170
  }
21165
21171
  _layoutOutsideLabels(arcs, attribute, currentMarks) {
21166
- var _a, _b, _c, _d, _e;
21167
- 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 };
21172
+ var _a, _b, _c;
21173
+ 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 };
21168
21174
  const height = center.y * 2;
21169
21175
  const line2MinLength = attribute.line.line2MinLength;
21170
21176
  const labelLayout = attribute.layout;
@@ -21199,7 +21205,7 @@
21199
21205
  }
21200
21206
  }
21201
21207
  else {
21202
- const maxLabels = height / (((_e = attribute.textStyle) === null || _e === void 0 ? void 0 : _e.fontSize) || 16);
21208
+ const maxLabels = height / (((_c = attribute.textStyle) === null || _c === void 0 ? void 0 : _c.fontSize) || 16);
21203
21209
  this._adjustY(arcs, maxLabels, attribute, currentMarks);
21204
21210
  const { minY, maxY } = arcs.reduce((yInfo, arc) => {
21205
21211
  const { y1, y2 } = arc.getLabelBounds();
@@ -21222,11 +21228,11 @@
21222
21228
  vutils.isGreater(arc.pointB.x, width - line2MinLength - spaceWidth))) {
21223
21229
  arc.labelVisible = false;
21224
21230
  }
21225
- 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;
21226
- if (attribute === null || attribute === void 0 ? void 0 : attribute.offsetAngle) {
21231
+ arc.angle = (_b = (_a = attribute.textStyle) === null || _a === void 0 ? void 0 : _a.angle) !== null && _b !== void 0 ? _b : 0;
21232
+ if (attribute.offsetAngle) {
21227
21233
  arc.angle += attribute.offsetAngle;
21228
21234
  }
21229
- arc.labelLine = Object.assign({}, attribute === null || attribute === void 0 ? void 0 : attribute.line);
21235
+ arc.labelLine = Object.assign({}, attribute.line);
21230
21236
  });
21231
21237
  return arcs;
21232
21238
  }
@@ -21308,8 +21314,8 @@
21308
21314
  return (_a = value === null || value === void 0 ? void 0 : value.text) !== null && _a !== void 0 ? _a : '';
21309
21315
  }
21310
21316
  _adjustY(arcs, maxLabels, attribute, currentMarks) {
21311
- var _a, _b, _c, _d;
21312
- 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 };
21317
+ var _a, _b;
21318
+ 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 };
21313
21319
  const plotRect = { width: center.x * 2, height: center.y * 2 };
21314
21320
  const labelLayout = attribute.layout;
21315
21321
  if (labelLayout.strategy === 'vertical') {
@@ -21648,17 +21654,21 @@
21648
21654
  }
21649
21655
  }
21650
21656
  }
21651
- _labelLine(text) {
21652
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
21653
- const labelLine = ((_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points)
21657
+ _createLabelLine(text, baseMark) {
21658
+ var _a, _b, _c, _d, _e, _f, _g;
21659
+ const { points, line = {}, visible, fill } = text.attribute;
21660
+ const labelLine = text.attribute.points
21654
21661
  ? graphicCreator.line({
21655
- 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,
21656
- 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,
21657
- 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,
21658
- points: (_s = text.attribute) === null || _s === void 0 ? void 0 : _s.points,
21659
- curveType: ((_u = (_t = text.attribute) === null || _t === void 0 ? void 0 : _t.line) === null || _u === void 0 ? void 0 : _u.smooth) ? 'basis' : null
21662
+ 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,
21663
+ stroke: (_e = (_d = line.style) === null || _d === void 0 ? void 0 : _d.stroke) !== null && _e !== void 0 ? _e : fill,
21664
+ lineWidth: (_g = (_f = line.style) === null || _f === void 0 ? void 0 : _f.lineWidth) !== null && _g !== void 0 ? _g : 1,
21665
+ points: points,
21666
+ curveType: line.smooth ? 'basis' : null
21660
21667
  })
21661
21668
  : undefined;
21669
+ if (labelLine) {
21670
+ this._setStatesOfLabelLine(labelLine);
21671
+ }
21662
21672
  return labelLine;
21663
21673
  }
21664
21674
  computeRadius(r, width, height, k) {
@@ -22256,6 +22266,32 @@
22256
22266
  this.beforeLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);
22257
22267
  this.handleLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);
22258
22268
  this.afterLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);
22269
+ let maxTextWidth = 0;
22270
+ let maxTextHeight = 0;
22271
+ let textAlign = 'center';
22272
+ let textBaseline = 'middle';
22273
+ labels.forEach((label) => {
22274
+ var _a;
22275
+ const labelStyle = label.attribute;
22276
+ const angle = (_a = labelStyle.angle) !== null && _a !== void 0 ? _a : 0;
22277
+ const textBounds = label.AABBBounds;
22278
+ let textWidth = textBounds.width();
22279
+ let textHeight = textBounds.height();
22280
+ if (angle) {
22281
+ textWidth = Math.abs(textWidth * Math.cos(angle));
22282
+ textHeight = Math.abs(textHeight * Math.sin(angle));
22283
+ }
22284
+ maxTextWidth = Math.max(maxTextWidth, textWidth);
22285
+ maxTextHeight = Math.max(maxTextHeight, textHeight);
22286
+ textAlign = labelStyle.textAlign;
22287
+ textBaseline = labelStyle.textBaseline;
22288
+ });
22289
+ this.axisLabelLayerSize[layer] = {
22290
+ width: maxTextWidth,
22291
+ height: maxTextHeight,
22292
+ textAlign,
22293
+ textBaseline
22294
+ };
22259
22295
  });
22260
22296
  }
22261
22297
  }
@@ -22326,12 +22362,8 @@
22326
22362
  labelGroup.name = `${exports.AXIS_ELEMENT_NAME.labelContainer}-layer-${layer}`;
22327
22363
  labelGroup.id = this._getNodeId(`label-container-layer-${layer}`);
22328
22364
  container.add(labelGroup);
22329
- let maxTextWidth = 0;
22330
- let maxTextHeight = 0;
22331
- let textAlign = 'center';
22332
- let textBaseline = 'middle';
22333
22365
  data.forEach((item, index) => {
22334
- var _a, _b, _c, _d;
22366
+ var _a, _b, _c;
22335
22367
  const labelStyle = this._getLabelAttribute(item, index, data, layer);
22336
22368
  let text;
22337
22369
  if (labelStyle.type === 'rich') {
@@ -22363,22 +22395,7 @@
22363
22395
  text.states = labelState;
22364
22396
  }
22365
22397
  labelGroup.add(text);
22366
- const angle = (_d = labelStyle.angle) !== null && _d !== void 0 ? _d : 0;
22367
- maxTextWidth = Math.max(maxTextWidth, text.AABBBounds.width());
22368
- maxTextHeight = Math.max(maxTextHeight, text.AABBBounds.height());
22369
- if (angle) {
22370
- maxTextWidth = Math.abs(maxTextWidth * Math.cos(angle));
22371
- maxTextHeight = Math.abs(maxTextHeight * Math.sin(angle));
22372
- }
22373
- textAlign = labelStyle.textAlign;
22374
- textBaseline = labelStyle.textBaseline;
22375
22398
  });
22376
- this.axisLabelLayerSize[layer] = {
22377
- width: maxTextWidth,
22378
- height: maxTextHeight,
22379
- textAlign,
22380
- textBaseline
22381
- };
22382
22399
  return labelGroup;
22383
22400
  }
22384
22401
  renderTitle(container) {
@@ -22664,10 +22681,22 @@
22664
22681
  do {
22665
22682
  items = reduce(items, sep);
22666
22683
  } while (items.length >= 3 && hasOverlap(items, sep));
22667
- if (items.length < 3 && !vutils.last(source).attribute.opacity) {
22668
- if (items.length > 1) {
22669
- vutils.last(items).setAttribute('opacity', 0);
22670
- vutils.last(source).setAttribute('opacity', 1);
22684
+ const checkLast = items.length < 3 || config.lastVisible;
22685
+ if (checkLast) {
22686
+ const lastSourceItem = vutils.last(source);
22687
+ if (!lastSourceItem.attribute.opacity) {
22688
+ const remainLength = items.length;
22689
+ if (remainLength > 1) {
22690
+ lastSourceItem.setAttribute('opacity', 1);
22691
+ for (let i = remainLength - 1; i >= 0; i--) {
22692
+ if (intersect(items[i], lastSourceItem, sep)) {
22693
+ items[i].setAttribute('opacity', 0);
22694
+ }
22695
+ else {
22696
+ break;
22697
+ }
22698
+ }
22699
+ }
22671
22700
  }
22672
22701
  }
22673
22702
  }
@@ -22786,7 +22815,7 @@
22786
22815
  }
22787
22816
 
22788
22817
  function autoLimit(labels, config) {
22789
- const { limitLength, ellipsis = '...', orient } = config;
22818
+ const { limitLength, verticalLimitLength, ellipsis = '...', orient } = config;
22790
22819
  if (vutils.isEmpty(labels) || !vutils.isValidNumber(limitLength)) {
22791
22820
  return;
22792
22821
  }
@@ -22794,14 +22823,20 @@
22794
22823
  if ((orient === 'top' || orient === 'bottom') && Math.floor(label.AABBBounds.height()) <= limitLength) {
22795
22824
  return;
22796
22825
  }
22797
- if ((orient === 'left' || orient === 'right') && Math.floor(label.AABBBounds.width()) <= limitLength) {
22826
+ const direction = label.attribute.direction;
22827
+ if ((orient === 'left' || orient === 'right') &&
22828
+ ((direction === 'vertical' && Math.floor(label.AABBBounds.height()) <= verticalLimitLength) ||
22829
+ (direction !== 'vertical' && Math.floor(label.AABBBounds.width()) <= limitLength))) {
22798
22830
  return;
22799
22831
  }
22800
- let limitLabelLength = label.attribute.angle === 0 || vutils.isNil(label.attribute.angle)
22832
+ const angle = label.attribute.angle;
22833
+ let limitLabelLength = angle === 0 || vutils.isNil(angle)
22801
22834
  ? orient === 'top' || orient === 'bottom'
22802
22835
  ? null
22803
- : limitLength
22804
- : Math.abs(limitLength / Math.sin(label.attribute.angle));
22836
+ : direction === 'vertical'
22837
+ ? verticalLimitLength
22838
+ : limitLength
22839
+ : Math.abs(limitLength / Math.sin(angle));
22805
22840
  if (vutils.isValidNumber(label.attribute.maxLineWidth)) {
22806
22841
  limitLabelLength = vutils.isValidNumber(limitLabelLength)
22807
22842
  ? Math.min(label.attribute.maxLineWidth, limitLabelLength)
@@ -23218,7 +23253,7 @@
23218
23253
  }
23219
23254
  const { verticalLimitSize, label, orient } = this.attribute;
23220
23255
  const limitLength = this._getAxisLabelLimitLength(verticalLimitSize, layerCount);
23221
- const { layoutFunc, autoRotate: autoRotate$1, autoRotateAngle, autoLimit: autoLimit$1, limitEllipsis, autoHide: autoHide$1, autoHideMethod, autoHideSeparation } = label;
23256
+ const { layoutFunc, autoRotate: autoRotate$1, autoRotateAngle, autoLimit: autoLimit$1, limitEllipsis, autoHide: autoHide$1, autoHideMethod, autoHideSeparation, lastVisible } = label;
23222
23257
  if (vutils.isFunction(layoutFunc)) {
23223
23258
  layoutFunc(labelShapes, labelData, layer, this);
23224
23259
  }
@@ -23230,8 +23265,13 @@
23230
23265
  });
23231
23266
  }
23232
23267
  if (autoLimit$1 && vutils.isValidNumber(limitLength) && limitLength > 0) {
23268
+ const verticalLimitLength = (orient === 'left' || orient === 'right') &&
23269
+ labelShapes.some(label => label.attribute.direction === 'vertical')
23270
+ ? Math.abs(this.attribute.start.y - this.attribute.end.y) / labelShapes.length
23271
+ : Infinity;
23233
23272
  autoLimit(labelShapes, {
23234
23273
  limitLength,
23274
+ verticalLimitLength,
23235
23275
  ellipsis: limitEllipsis,
23236
23276
  orient
23237
23277
  });
@@ -23240,7 +23280,8 @@
23240
23280
  autoHide(labelShapes, {
23241
23281
  orient,
23242
23282
  method: autoHideMethod,
23243
- separation: autoHideSeparation
23283
+ separation: autoHideSeparation,
23284
+ lastVisible
23244
23285
  });
23245
23286
  }
23246
23287
  }
@@ -26234,7 +26275,13 @@
26234
26275
  let shapeSize = 0;
26235
26276
  let shapeSpace = 0;
26236
26277
  if (shapeAttr && shapeAttr.visible !== false) {
26237
- shapeSize = vutils.get(shapeStyle, 'style.size', DEFAULT_SHAPE_SIZE);
26278
+ const s = vutils.get(shapeStyle, 'style.size', DEFAULT_SHAPE_SIZE);
26279
+ if (vutils.isArray(s)) {
26280
+ shapeSize = s[0] || 0;
26281
+ }
26282
+ else {
26283
+ shapeSize = s;
26284
+ }
26238
26285
  shapeSpace = vutils.get(shapeAttr, 'space', DEFAULT_SHAPE_SPACE);
26239
26286
  const itemShape = graphicCreator.symbol(Object.assign(Object.assign({ x: 0, y: 0, symbolType: 'circle', strokeBoundsBuffer: 0 }, shape), shapeStyle.style));
26240
26287
  Object.keys(shapeStyle.state || {}).forEach(key => {
@@ -29815,7 +29862,7 @@
29815
29862
  }
29816
29863
  };
29817
29864
 
29818
- const version = "0.17.9";
29865
+ const version = "0.17.11-alpha.1";
29819
29866
 
29820
29867
  exports.AbstractComponent = AbstractComponent;
29821
29868
  exports.ArcInfo = ArcInfo;