@visactor/vrender-components 0.17.9 → 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 (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 +300 -255
  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 +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
  }]);
@@ -20171,6 +20119,37 @@
20171
20119
  }
20172
20120
  return { x, y };
20173
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
+ }
20174
20153
 
20175
20154
  function loadLabelComponent() {
20176
20155
  registerGroup();
@@ -20236,9 +20215,10 @@
20236
20215
  }
20237
20216
  };
20238
20217
  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 : [];
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 : [];
20242
20222
  const labels = this._isCollectionBase ? [...this._graphicToText.values()] : [this._graphicToText.get(e.target)];
20243
20223
  labels.forEach(label => {
20244
20224
  if (label) {
@@ -20256,8 +20236,21 @@
20256
20236
  labeling(textBounds, graphicBounds, position, offset) {
20257
20237
  return;
20258
20238
  }
20259
- _labelLine(text) {
20260
- 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
+ }
20261
20254
  }
20262
20255
  render() {
20263
20256
  this._prepare();
@@ -20386,7 +20379,7 @@
20386
20379
  for (let i = 0; i < currentBaseMarks.length; i++) {
20387
20380
  const baseMark = currentBaseMarks[i];
20388
20381
  const points = getPointsOfLineArea(baseMark);
20389
- if (points === null || points === void 0 ? void 0 : points.length) {
20382
+ if (points && points.length) {
20390
20383
  for (let j = 0; j < points.length; j++) {
20391
20384
  const textData = data[cur];
20392
20385
  if (textData && points[j]) {
@@ -20505,7 +20498,10 @@
20505
20498
  result.push(text);
20506
20499
  continue;
20507
20500
  }
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)) {
20501
+ if (checkBounds &&
20502
+ baseMark &&
20503
+ baseMark.AABBBounds &&
20504
+ this._canPlaceInside(text.AABBBounds, baseMark.AABBBounds)) {
20509
20505
  bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
20510
20506
  result.push(text);
20511
20507
  continue;
@@ -20576,17 +20572,21 @@
20576
20572
  }
20577
20573
  }
20578
20574
  _renderWithAnimation(labels) {
20575
+ var _a;
20579
20576
  const currentTextMap = new Map();
20580
20577
  const prevTextMap = this._graphicToText || new Map();
20581
20578
  const texts = [];
20582
20579
  const labelLines = [];
20580
+ const { visible: showLabelLine } = (_a = this.attribute.line) !== null && _a !== void 0 ? _a : {};
20583
20581
  labels.forEach((text, index) => {
20584
- var _a, _b, _c, _d, _e, _f, _g;
20585
- const labelLine = this._labelLine(text);
20586
20582
  const relatedGraphic = this.getRelatedGraphic(text.attribute);
20587
20583
  const textId = text.attribute.id;
20588
20584
  const textKey = this._isCollectionBase ? textId : relatedGraphic;
20589
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
+ }
20590
20590
  if (state === 'enter') {
20591
20591
  texts.push(text);
20592
20592
  currentTextMap.set(textKey, labelLine ? { text, labelLine } : { text });
@@ -20594,7 +20594,6 @@
20594
20594
  const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');
20595
20595
  this.add(text);
20596
20596
  if (labelLine) {
20597
- this._setStatesOfLabelLine(labelLine);
20598
20597
  labelLines.push(labelLine);
20599
20598
  this.add(labelLine);
20600
20599
  }
@@ -20615,10 +20614,9 @@
20615
20614
  const prevText = prevLabel.text;
20616
20615
  const { duration, easing } = this._animationConfig.update;
20617
20616
  updateAnimation(prevText, text, this._animationConfig.update);
20618
- if (prevLabel.labelLine) {
20617
+ if (prevLabel.labelLine && labelLine) {
20619
20618
  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
20619
+ points: labelLine.attribute.points
20622
20620
  }), duration, easing);
20623
20621
  }
20624
20622
  }
@@ -20627,7 +20625,7 @@
20627
20625
  var _a;
20628
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(() => {
20629
20627
  this.removeChild(label.text);
20630
- if (label === null || label === void 0 ? void 0 : label.labelLine) {
20628
+ if (label.labelLine) {
20631
20629
  this.removeChild(label.labelLine);
20632
20630
  }
20633
20631
  });
@@ -20635,14 +20633,18 @@
20635
20633
  this._graphicToText = currentTextMap;
20636
20634
  }
20637
20635
  _renderWithOutAnimation(labels) {
20636
+ var _a;
20638
20637
  const currentTextMap = new Map();
20639
20638
  const prevTextMap = this._graphicToText || new Map();
20639
+ const { visible: showLabelLine } = (_a = this.attribute.line) !== null && _a !== void 0 ? _a : {};
20640
20640
  labels.forEach(text => {
20641
- var _a;
20642
- const labelLine = this._labelLine(text);
20643
20641
  const relatedGraphic = this.getRelatedGraphic(text.attribute);
20644
20642
  const state = (prevTextMap === null || prevTextMap === void 0 ? void 0 : prevTextMap.get(relatedGraphic)) ? 'update' : 'enter';
20645
20643
  const textKey = this._isCollectionBase ? text.attribute.id : relatedGraphic;
20644
+ let labelLine;
20645
+ if (showLabelLine) {
20646
+ labelLine = this._createLabelLine(text, relatedGraphic);
20647
+ }
20646
20648
  if (state === 'enter') {
20647
20649
  currentTextMap.set(textKey, labelLine ? { text, labelLine } : { text });
20648
20650
  this.add(text);
@@ -20656,14 +20658,14 @@
20656
20658
  prevTextMap.delete(textKey);
20657
20659
  currentTextMap.set(textKey, prevLabel);
20658
20660
  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 });
20661
+ if (prevLabel.labelLine && labelLine) {
20662
+ prevLabel.labelLine.setAttributes({ points: labelLine.attribute.points });
20661
20663
  }
20662
20664
  }
20663
20665
  });
20664
20666
  prevTextMap.forEach(label => {
20665
20667
  this.removeChild(label.text);
20666
- if (label === null || label === void 0 ? void 0 : label.labelLine) {
20668
+ if (label.labelLine) {
20667
20669
  this.removeChild(label.labelLine);
20668
20670
  }
20669
20671
  });
@@ -20771,7 +20773,7 @@
20771
20773
  stroke && label.setAttributes({ stroke });
20772
20774
  }
20773
20775
  else {
20774
- const isInside = this._canPlaceInside(label.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds);
20776
+ const isInside = this._canPlaceInside(label.AABBBounds, baseMark.AABBBounds);
20775
20777
  if (isInside) {
20776
20778
  const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
20777
20779
  fill && label.setAttributes({ fill });
@@ -21034,18 +21036,20 @@
21034
21036
  for (let i = 0; i < data.length; i++) {
21035
21037
  const textData = data[i];
21036
21038
  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);
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
+ }
21049
21053
  }
21050
21054
  return labels;
21051
21055
  }
@@ -21108,8 +21112,8 @@
21108
21112
  var _a, _b;
21109
21113
  const labelConfig = attribute;
21110
21114
  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;
21115
+ const position = (_a = labelConfig.position) !== null && _a !== void 0 ? _a : 'inside';
21116
+ const offsetRadius = (_b = labelConfig.offsetRadius) !== null && _b !== void 0 ? _b : -spaceWidth;
21113
21117
  arcs.forEach((arc) => {
21114
21118
  var _a, _b, _c;
21115
21119
  const { labelSize, radian } = arc;
@@ -21130,7 +21134,7 @@
21130
21134
  }
21131
21135
  limit = outerRadius - minRadius - spaceWidth;
21132
21136
  }
21133
- if ((labelConfig === null || labelConfig === void 0 ? void 0 : labelConfig.rotate) !== true) {
21137
+ if (labelConfig.rotate !== true) {
21134
21138
  limit = outerRadius - spaceWidth;
21135
21139
  }
21136
21140
  const text = this._getFormatLabelText(arc.refDatum, limit);
@@ -21153,8 +21157,8 @@
21153
21157
  if (!vutils.isGreater(labelWidth, 0)) {
21154
21158
  arc.labelVisible = false;
21155
21159
  }
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;
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;
21158
21162
  if (['inside-inner', 'inside-outer'].includes(position)) {
21159
21163
  offsetAngle += Math.PI / 2;
21160
21164
  }
@@ -21163,8 +21167,8 @@
21163
21167
  return arcs;
21164
21168
  }
21165
21169
  _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 };
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 };
21168
21172
  const height = center.y * 2;
21169
21173
  const line2MinLength = attribute.line.line2MinLength;
21170
21174
  const labelLayout = attribute.layout;
@@ -21199,7 +21203,7 @@
21199
21203
  }
21200
21204
  }
21201
21205
  else {
21202
- 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);
21203
21207
  this._adjustY(arcs, maxLabels, attribute, currentMarks);
21204
21208
  const { minY, maxY } = arcs.reduce((yInfo, arc) => {
21205
21209
  const { y1, y2 } = arc.getLabelBounds();
@@ -21222,11 +21226,11 @@
21222
21226
  vutils.isGreater(arc.pointB.x, width - line2MinLength - spaceWidth))) {
21223
21227
  arc.labelVisible = false;
21224
21228
  }
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) {
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) {
21227
21231
  arc.angle += attribute.offsetAngle;
21228
21232
  }
21229
- arc.labelLine = Object.assign({}, attribute === null || attribute === void 0 ? void 0 : attribute.line);
21233
+ arc.labelLine = Object.assign({}, attribute.line);
21230
21234
  });
21231
21235
  return arcs;
21232
21236
  }
@@ -21308,8 +21312,8 @@
21308
21312
  return (_a = value === null || value === void 0 ? void 0 : value.text) !== null && _a !== void 0 ? _a : '';
21309
21313
  }
21310
21314
  _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 };
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 };
21313
21317
  const plotRect = { width: center.x * 2, height: center.y * 2 };
21314
21318
  const labelLayout = attribute.layout;
21315
21319
  if (labelLayout.strategy === 'vertical') {
@@ -21648,17 +21652,21 @@
21648
21652
  }
21649
21653
  }
21650
21654
  }
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)
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
21654
21659
  ? 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
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
21660
21665
  })
21661
21666
  : undefined;
21667
+ if (labelLine) {
21668
+ this._setStatesOfLabelLine(labelLine);
21669
+ }
21662
21670
  return labelLine;
21663
21671
  }
21664
21672
  computeRadius(r, width, height, k) {
@@ -22256,6 +22264,32 @@
22256
22264
  this.beforeLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);
22257
22265
  this.handleLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);
22258
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
+ };
22259
22293
  });
22260
22294
  }
22261
22295
  }
@@ -22326,12 +22360,8 @@
22326
22360
  labelGroup.name = `${exports.AXIS_ELEMENT_NAME.labelContainer}-layer-${layer}`;
22327
22361
  labelGroup.id = this._getNodeId(`label-container-layer-${layer}`);
22328
22362
  container.add(labelGroup);
22329
- let maxTextWidth = 0;
22330
- let maxTextHeight = 0;
22331
- let textAlign = 'center';
22332
- let textBaseline = 'middle';
22333
22363
  data.forEach((item, index) => {
22334
- var _a, _b, _c, _d;
22364
+ var _a, _b, _c;
22335
22365
  const labelStyle = this._getLabelAttribute(item, index, data, layer);
22336
22366
  let text;
22337
22367
  if (labelStyle.type === 'rich') {
@@ -22363,22 +22393,7 @@
22363
22393
  text.states = labelState;
22364
22394
  }
22365
22395
  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
22396
  });
22376
- this.axisLabelLayerSize[layer] = {
22377
- width: maxTextWidth,
22378
- height: maxTextHeight,
22379
- textAlign,
22380
- textBaseline
22381
- };
22382
22397
  return labelGroup;
22383
22398
  }
22384
22399
  renderTitle(container) {
@@ -22664,10 +22679,22 @@
22664
22679
  do {
22665
22680
  items = reduce(items, sep);
22666
22681
  } 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);
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
+ }
22671
22698
  }
22672
22699
  }
22673
22700
  }
@@ -22786,7 +22813,7 @@
22786
22813
  }
22787
22814
 
22788
22815
  function autoLimit(labels, config) {
22789
- const { limitLength, ellipsis = '...', orient } = config;
22816
+ const { limitLength, verticalLimitLength, ellipsis = '...', orient } = config;
22790
22817
  if (vutils.isEmpty(labels) || !vutils.isValidNumber(limitLength)) {
22791
22818
  return;
22792
22819
  }
@@ -22794,14 +22821,20 @@
22794
22821
  if ((orient === 'top' || orient === 'bottom') && Math.floor(label.AABBBounds.height()) <= limitLength) {
22795
22822
  return;
22796
22823
  }
22797
- 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))) {
22798
22828
  return;
22799
22829
  }
22800
- 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)
22801
22832
  ? orient === 'top' || orient === 'bottom'
22802
22833
  ? null
22803
- : limitLength
22804
- : Math.abs(limitLength / Math.sin(label.attribute.angle));
22834
+ : direction === 'vertical'
22835
+ ? verticalLimitLength
22836
+ : limitLength
22837
+ : Math.abs(limitLength / Math.sin(angle));
22805
22838
  if (vutils.isValidNumber(label.attribute.maxLineWidth)) {
22806
22839
  limitLabelLength = vutils.isValidNumber(limitLabelLength)
22807
22840
  ? Math.min(label.attribute.maxLineWidth, limitLabelLength)
@@ -23218,7 +23251,7 @@
23218
23251
  }
23219
23252
  const { verticalLimitSize, label, orient } = this.attribute;
23220
23253
  const limitLength = this._getAxisLabelLimitLength(verticalLimitSize, layerCount);
23221
- 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;
23222
23255
  if (vutils.isFunction(layoutFunc)) {
23223
23256
  layoutFunc(labelShapes, labelData, layer, this);
23224
23257
  }
@@ -23230,8 +23263,13 @@
23230
23263
  });
23231
23264
  }
23232
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;
23233
23270
  autoLimit(labelShapes, {
23234
23271
  limitLength,
23272
+ verticalLimitLength,
23235
23273
  ellipsis: limitEllipsis,
23236
23274
  orient
23237
23275
  });
@@ -23240,7 +23278,8 @@
23240
23278
  autoHide(labelShapes, {
23241
23279
  orient,
23242
23280
  method: autoHideMethod,
23243
- separation: autoHideSeparation
23281
+ separation: autoHideSeparation,
23282
+ lastVisible
23244
23283
  });
23245
23284
  }
23246
23285
  }
@@ -26234,7 +26273,13 @@
26234
26273
  let shapeSize = 0;
26235
26274
  let shapeSpace = 0;
26236
26275
  if (shapeAttr && shapeAttr.visible !== false) {
26237
- 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
+ }
26238
26283
  shapeSpace = vutils.get(shapeAttr, 'space', DEFAULT_SHAPE_SPACE);
26239
26284
  const itemShape = graphicCreator.symbol(Object.assign(Object.assign({ x: 0, y: 0, symbolType: 'circle', strokeBoundsBuffer: 0 }, shape), shapeStyle.style));
26240
26285
  Object.keys(shapeStyle.state || {}).forEach(key => {
@@ -29815,7 +29860,7 @@
29815
29860
  }
29816
29861
  };
29817
29862
 
29818
- const version = "0.17.9";
29863
+ const version = "0.17.10";
29819
29864
 
29820
29865
  exports.AbstractComponent = AbstractComponent;
29821
29866
  exports.ArcInfo = ArcInfo;