@visactor/vrender-components 0.15.0-alpha.24 → 0.15.0-alpha.25

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 (89) hide show
  1. package/cjs/index.d.ts +1 -1
  2. package/cjs/index.js +1 -1
  3. package/cjs/index.js.map +1 -1
  4. package/cjs/label/arc.d.ts +5 -2
  5. package/cjs/label/arc.js +23 -37
  6. package/cjs/label/arc.js.map +1 -1
  7. package/cjs/label/base.js +8 -8
  8. package/cjs/label/base.js.map +1 -1
  9. package/cjs/legend/size/size.d.ts +2 -2
  10. package/cjs/legend/size/size.js.map +1 -1
  11. package/cjs/marker/area.d.ts +20 -1
  12. package/cjs/marker/area.js +37 -37
  13. package/cjs/marker/area.js.map +1 -1
  14. package/cjs/marker/base.d.ts +0 -1
  15. package/cjs/marker/base.js +18 -28
  16. package/cjs/marker/base.js.map +1 -1
  17. package/cjs/marker/config.d.ts +1 -1
  18. package/cjs/marker/config.js.map +1 -1
  19. package/cjs/marker/line.js +14 -27
  20. package/cjs/marker/line.js.map +1 -1
  21. package/cjs/marker/point.d.ts +7 -7
  22. package/cjs/marker/point.js +4 -5
  23. package/cjs/marker/point.js.map +1 -1
  24. package/cjs/marker/type.d.ts +5 -8
  25. package/cjs/marker/type.js.map +1 -1
  26. package/cjs/segment/segment.d.ts +6 -11
  27. package/cjs/segment/segment.js +40 -82
  28. package/cjs/segment/segment.js.map +1 -1
  29. package/cjs/segment/type.d.ts +3 -5
  30. package/cjs/segment/type.js.map +1 -1
  31. package/cjs/util/index.d.ts +1 -1
  32. package/cjs/util/index.js +1 -1
  33. package/cjs/util/index.js.map +1 -1
  34. package/cjs/util/{label-smartInvert.js → labelSmartInvert.js} +1 -1
  35. package/cjs/util/labelSmartInvert.js.map +1 -0
  36. package/dist/index.js +166 -296
  37. package/dist/index.min.js +1 -1
  38. package/es/index.d.ts +1 -1
  39. package/es/index.js +1 -1
  40. package/es/index.js.map +1 -1
  41. package/es/label/arc.d.ts +5 -2
  42. package/es/label/arc.js +23 -36
  43. package/es/label/arc.js.map +1 -1
  44. package/es/label/base.js +1 -1
  45. package/es/label/base.js.map +1 -1
  46. package/es/legend/size/size.d.ts +2 -2
  47. package/es/legend/size/size.js.map +1 -1
  48. package/es/marker/area.d.ts +20 -1
  49. package/es/marker/area.js +36 -38
  50. package/es/marker/area.js.map +1 -1
  51. package/es/marker/base.d.ts +0 -1
  52. package/es/marker/base.js +19 -27
  53. package/es/marker/base.js.map +1 -1
  54. package/es/marker/config.d.ts +1 -1
  55. package/es/marker/config.js.map +1 -1
  56. package/es/marker/line.js +13 -28
  57. package/es/marker/line.js.map +1 -1
  58. package/es/marker/point.d.ts +7 -7
  59. package/es/marker/point.js +4 -5
  60. package/es/marker/point.js.map +1 -1
  61. package/es/marker/type.d.ts +5 -8
  62. package/es/marker/type.js.map +1 -1
  63. package/es/segment/segment.d.ts +6 -11
  64. package/es/segment/segment.js +41 -81
  65. package/es/segment/segment.js.map +1 -1
  66. package/es/segment/type.d.ts +3 -5
  67. package/es/segment/type.js.map +1 -1
  68. package/es/util/index.d.ts +1 -1
  69. package/es/util/index.js +1 -1
  70. package/es/util/index.js.map +1 -1
  71. package/es/util/{label-smartInvert.js → labelSmartInvert.js} +1 -1
  72. package/es/util/labelSmartInvert.js.map +1 -0
  73. package/package.json +4 -4
  74. package/cjs/marker/util.d.ts +0 -1
  75. package/cjs/marker/util.js +0 -3
  76. package/cjs/marker/util.js.map +0 -1
  77. package/cjs/util/label-smartInvert.js.map +0 -1
  78. package/cjs/util/limit-shape.d.ts +0 -3
  79. package/cjs/util/limit-shape.js +0 -14
  80. package/cjs/util/limit-shape.js.map +0 -1
  81. package/es/marker/util.d.ts +0 -1
  82. package/es/marker/util.js +0 -3
  83. package/es/marker/util.js.map +0 -1
  84. package/es/util/label-smartInvert.js.map +0 -1
  85. package/es/util/limit-shape.d.ts +0 -3
  86. package/es/util/limit-shape.js +0 -8
  87. package/es/util/limit-shape.js.map +0 -1
  88. /package/cjs/util/{label-smartInvert.d.ts → labelSmartInvert.d.ts} +0 -0
  89. /package/es/util/{label-smartInvert.d.ts → labelSmartInvert.d.ts} +0 -0
package/dist/index.js CHANGED
@@ -2420,13 +2420,16 @@
2420
2420
  }
2421
2421
 
2422
2422
  class ArcInfo {
2423
- constructor(refDatum, center, outerCenter, quadrant, radian, middleAngle) {
2423
+ constructor(refDatum, center, outerCenter, quadrant, radian, middleAngle, innerRadius, outerRadius, circleCenter) {
2424
2424
  this.refDatum = refDatum;
2425
2425
  this.center = center;
2426
2426
  this.outerCenter = outerCenter;
2427
2427
  this.quadrant = quadrant;
2428
2428
  this.radian = radian;
2429
2429
  this.middleAngle = middleAngle;
2430
+ this.innerRadius = innerRadius;
2431
+ this.outerRadius = outerRadius;
2432
+ this.circleCenter = circleCenter;
2430
2433
  this.labelVisible = true;
2431
2434
  this.labelLimit = 0;
2432
2435
  }
@@ -2486,11 +2489,9 @@
2486
2489
  return labels;
2487
2490
  }
2488
2491
  layoutArcLabels(position, attribute, currentMarks, data, textBoundsArray, ellipsisWidth) {
2489
- var _a;
2490
2492
  this._arcLeft.clear();
2491
2493
  this._arcRight.clear();
2492
2494
  this._ellipsisWidth = ellipsisWidth;
2493
- const centerOffset = (_a = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _a !== void 0 ? _a : 0;
2494
2495
  let maxRadius = 0;
2495
2496
  currentMarks.forEach(currentMarks => {
2496
2497
  if (currentMarks.attribute.outerRadius > maxRadius) {
@@ -2508,8 +2509,8 @@
2508
2509
  const arcQuadrant = computeQuadrant(graphicAttribute.endAngle - intervalAngle / 2);
2509
2510
  const arcMiddle = circlePoint(center.x, center.y, graphicAttribute.outerRadius, arcMiddleAngle);
2510
2511
  const outerArcMiddle = circlePoint(center.x, center.y, maxRadius + attribute.line.line1MinLength, arcMiddleAngle);
2511
- const arc = new ArcInfo(item, arcMiddle, outerArcMiddle, arcQuadrant, intervalAngle, arcMiddleAngle);
2512
- arc.pointA = circlePoint(center.x, center.y, this.computeDatumRadius(center.x * 2, center.y * 2, graphicAttribute.outerRadius, centerOffset), arc.middleAngle);
2512
+ const arc = new ArcInfo(item, arcMiddle, outerArcMiddle, arcQuadrant, intervalAngle, arcMiddleAngle, graphicAttribute.innerRadius, graphicAttribute.outerRadius, center);
2513
+ arc.pointA = circlePoint(center.x, center.y, this.computeDatumRadius(center.x * 2, center.y * 2, graphicAttribute.outerRadius), arc.middleAngle);
2513
2514
  arc.labelSize = {
2514
2515
  width: textBounds.x2 - textBounds.x1,
2515
2516
  height: textBounds.y2 - textBounds.y1
@@ -2535,18 +2536,13 @@
2535
2536
  return arcs;
2536
2537
  }
2537
2538
  _layoutInsideLabels(arcs, attribute, currentMarks) {
2538
- var _a, _b, _c, _d, _e;
2539
- 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 };
2540
- const centerOffset = (_e = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _e !== void 0 ? _e : 0;
2541
- const innerRadiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.innerRadius, attribute.width, attribute.height);
2542
- const outerRadiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height);
2543
2539
  const labelConfig = attribute;
2544
2540
  const spaceWidth = labelConfig.spaceWidth;
2545
2541
  arcs.forEach((arc) => {
2546
2542
  var _a, _b;
2547
2543
  const { labelSize, radian } = arc;
2548
- const innerRadius = this.computeRadius(innerRadiusRatio, attribute.width, attribute.height, centerOffset, 1);
2549
- const outerRadius = this.computeRadius(outerRadiusRatio, attribute.width, attribute.height, centerOffset, 1);
2544
+ const innerRadius = arc.innerRadius;
2545
+ const outerRadius = arc.outerRadius;
2550
2546
  const minRadian = connectLineRadian(outerRadius, labelSize.height);
2551
2547
  let limit;
2552
2548
  if (radian < minRadian) {
@@ -2571,7 +2567,7 @@
2571
2567
  const align = this._computeAlign(arc, attribute);
2572
2568
  const alignOffset = align === 'left' ? labelWidth : align === 'right' ? 0 : labelWidth / 2;
2573
2569
  const labelRadius = outerRadius - spaceWidth - alignOffset;
2574
- arc.labelPosition = circlePoint(center.x, center.y, labelRadius, arc.middleAngle);
2570
+ arc.labelPosition = circlePoint(arc.circleCenter.x, arc.circleCenter.y, labelRadius, arc.middleAngle);
2575
2571
  arc.labelLimit = labelWidth;
2576
2572
  if (!vutils.isGreater(labelWidth, 0)) {
2577
2573
  arc.labelVisible = false;
@@ -2646,9 +2642,8 @@
2646
2642
  return arcs;
2647
2643
  }
2648
2644
  _computeX(arc, attribute, currentMarks) {
2649
- var _a, _b, _c, _d, _e, _f;
2650
- 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 };
2651
- const centerOffset = (_e = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _e !== void 0 ? _e : 0;
2645
+ var _a;
2646
+ const center = arc.circleCenter;
2652
2647
  const plotLayout = { width: center.x * 2, height: center.y * 2 };
2653
2648
  let maxRadius = 0;
2654
2649
  currentMarks.forEach((currentMark) => {
@@ -2659,7 +2654,7 @@
2659
2654
  const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
2660
2655
  const line1MinLength = attribute.line.line1MinLength;
2661
2656
  const line2MinLength = attribute.line.line2MinLength;
2662
- const labelLayoutAlign = (_f = attribute.layout) === null || _f === void 0 ? void 0 : _f.align;
2657
+ const labelLayoutAlign = (_a = attribute.layout) === null || _a === void 0 ? void 0 : _a.align;
2663
2658
  const spaceWidth = attribute.spaceWidth;
2664
2659
  const { labelPosition, quadrant, pointB } = arc;
2665
2660
  if (!vutils.isValidNumber(pointB.x * pointB.y)) {
@@ -2667,7 +2662,7 @@
2667
2662
  labelPosition.x = NaN;
2668
2663
  arc.labelLimit = 0;
2669
2664
  }
2670
- const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset);
2665
+ const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height);
2671
2666
  const flag = isQuadrantLeft(quadrant) ? -1 : 1;
2672
2667
  let cx = 0;
2673
2668
  const restWidth = flag > 0 ? plotLayout.width - pointB.x : pointB.x;
@@ -2885,7 +2880,6 @@
2885
2880
  return -1;
2886
2881
  }
2887
2882
  _computePointB(arc, r, attribute, currentMarks) {
2888
- var _a, _b, _c, _d, _e;
2889
2883
  const labelConfig = attribute;
2890
2884
  let maxRadius = 0;
2891
2885
  currentMarks.forEach((currentMark) => {
@@ -2903,11 +2897,10 @@
2903
2897
  };
2904
2898
  }
2905
2899
  else {
2906
- 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 };
2907
- const centerOffset = (_e = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _e !== void 0 ? _e : 0;
2908
- const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset);
2900
+ const center = arc.circleCenter;
2901
+ const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height);
2909
2902
  const { labelPosition, quadrant } = arc;
2910
- const outerR = Math.max(radius + line1MinLength, currentMarks[0].attribute.outerRadius);
2903
+ const outerR = Math.max(radius + line1MinLength, arc.outerRadius);
2911
2904
  const rd = r - outerR;
2912
2905
  const x = Math.sqrt(r ** 2 - Math.abs(center.y - labelPosition.y) ** 2) - rd;
2913
2906
  if (vutils.isValidNumber(x)) {
@@ -2929,8 +2922,7 @@
2929
2922
  }
2930
2923
  }
2931
2924
  _computeYRange(arc, attribute, currentMarks) {
2932
- var _a, _b, _c, _d, _e;
2933
- 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 };
2925
+ const center = arc.circleCenter;
2934
2926
  const plotRect = { width: center.x * 2, height: center.y * 2 };
2935
2927
  let maxRadius = 0;
2936
2928
  currentMarks.forEach((currentMark) => {
@@ -2941,8 +2933,7 @@
2941
2933
  const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
2942
2934
  const line1MinLength = attribute.line.line1MinLength;
2943
2935
  const { width, height } = plotRect;
2944
- const centerOffset = (_e = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _e !== void 0 ? _e : 0;
2945
- const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset);
2936
+ const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height);
2946
2937
  const r = this._computeLayoutRadius(height / 2, attribute, currentMarks);
2947
2938
  const cx = Math.abs(arc.center.x - width / 2);
2948
2939
  const cy = arc.center.y - height / 2;
@@ -3001,7 +2992,6 @@
3001
2992
  arc.labelYRange = [min, max];
3002
2993
  }
3003
2994
  _computeLayoutRadius(halfYLength, attribute, currentMarks) {
3004
- var _a;
3005
2995
  const labelConfig = attribute;
3006
2996
  const layoutArcGap = labelConfig.layoutArcGap;
3007
2997
  const line1MinLength = labelConfig.line.line1MinLength;
@@ -3012,8 +3002,7 @@
3012
3002
  }
3013
3003
  });
3014
3004
  const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
3015
- const centerOffset = (_a = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _a !== void 0 ? _a : 0;
3016
- const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset);
3005
+ const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height);
3017
3006
  const outerR = radius + line1MinLength;
3018
3007
  const a = outerR - layoutArcGap;
3019
3008
  return Math.max((a ** 2 + halfYLength ** 2) / (2 * a), outerR);
@@ -3092,9 +3081,8 @@
3092
3081
  : undefined;
3093
3082
  return labelLine;
3094
3083
  }
3095
- computeRadius(r, width, height, centerOffset, k) {
3096
- var _a;
3097
- return ((_a = this.computeLayoutRadius(width ? width : 0, height ? height : 0) * r * (vutils.isNil(k) ? 1 : k) + centerOffset) !== null && _a !== void 0 ? _a : 0);
3084
+ computeRadius(r, width, height, k) {
3085
+ return this.computeLayoutRadius(width ? width : 0, height ? height : 0) * r * (vutils.isNil(k) ? 1 : k);
3098
3086
  }
3099
3087
  computeLayoutRadius(width, height) {
3100
3088
  return Math.min(width / 2, height / 2);
@@ -3105,10 +3093,9 @@
3105
3093
  computeLayoutOuterRadius(r, width, height) {
3106
3094
  return r / (Math.min(width, height) / 2);
3107
3095
  }
3108
- computeDatumRadius(width, height, outerRadius, centerOffset) {
3109
- var _a;
3096
+ computeDatumRadius(width, height, outerRadius) {
3110
3097
  const outerRadiusRatio = this.computeLayoutOuterRadius(outerRadius, width, height);
3111
- return (_a = this.computeLayoutRadius(width ? width : 0, height ? height : 0) * outerRadiusRatio + centerOffset) !== null && _a !== void 0 ? _a : 0;
3098
+ return this.computeLayoutRadius(width ? width : 0, height ? height : 0) * outerRadiusRatio;
3112
3099
  }
3113
3100
  }
3114
3101
  ArcLabel.defaultAttributes = {
@@ -3211,74 +3198,69 @@
3211
3198
  };
3212
3199
 
3213
3200
  class Segment extends AbstractComponent {
3214
- getStartAngle() {
3215
- return this._startAngle;
3216
- }
3217
- getEndAngle() {
3218
- return this._endAngle;
3219
- }
3220
- getMainSegmentPoints() {
3221
- return this._mainSegmentPoints;
3222
- }
3223
3201
  constructor(attributes) {
3224
3202
  super(vutils.merge({}, Segment.defaultAttributes, attributes));
3225
3203
  this.name = 'segment';
3226
3204
  }
3205
+ computeLineAngle() {
3206
+ const { points } = this.attribute;
3207
+ const start = points[0];
3208
+ const startInside = points[1];
3209
+ const endInside = points[points.length - 2];
3210
+ const end = points[points.length - 1];
3211
+ const startVector = [start.x - startInside.x, start.y - startInside.y];
3212
+ const startAngle = Math.atan2(startVector[1], startVector[0]);
3213
+ const endVector = [end.x - endInside.x, end.y - endInside.y];
3214
+ const endAngle = Math.atan2(endVector[1], endVector[0]);
3215
+ this._startAngle = startAngle;
3216
+ this._endAngle = endAngle;
3217
+ }
3227
3218
  render() {
3228
3219
  this.removeAllChild();
3229
- this._reset();
3230
- const { startSymbol, endSymbol, lineStyle, state, visible = true, multiSegment, mainSegmentIndex } = this.attribute;
3220
+ const { points, startSymbol, endSymbol, lineStyle, state, visible = true } = this.attribute;
3231
3221
  if (!visible) {
3232
3222
  return;
3233
3223
  }
3234
- this._computeLineAngle();
3235
- const startSymbolShape = this._renderSymbol(startSymbol, 'start');
3236
- const endSymbolShape = this._renderSymbol(endSymbol, 'end');
3224
+ if (points.length > 1) {
3225
+ this.computeLineAngle();
3226
+ }
3227
+ const startSymbolShape = this.renderSymbol(startSymbol, 'start');
3228
+ const endSymbolShape = this.renderSymbol(endSymbol, 'end');
3237
3229
  this.startSymbol = startSymbolShape;
3238
3230
  this.endSymbol = endSymbolShape;
3239
- if (multiSegment) {
3240
- const points = [...this.attribute.points];
3241
- if (vutils.isValidNumber(mainSegmentIndex)) {
3242
- points[mainSegmentIndex] = this._clipPoints(points[mainSegmentIndex]);
3243
- }
3244
- else {
3245
- const clipPoints = this._clipPoints(vutils.flattenArray(points));
3246
- points[0][0] = clipPoints[0];
3247
- points[points.length - 1][points[points.length - 1].length - 1] =
3248
- clipPoints[clipPoints.length - 1];
3249
- }
3250
- points.forEach((point, index) => {
3251
- var _a, _b;
3252
- const line = vrender.createLine(Object.assign(Object.assign({ points: point }, (vutils.isArray(lineStyle) ? (_a = lineStyle[index]) !== null && _a !== void 0 ? _a : lineStyle[lineStyle.length - 1] : lineStyle)), { fill: false }));
3253
- line.name = `${this.name}-line`;
3254
- line.id = this._getNodeId('line' + index);
3255
- if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.line)) {
3256
- line.states = vutils.isArray(state.line) ? (_b = state.line[index]) !== null && _b !== void 0 ? _b : state.line[state.line.length - 1] : state.line;
3257
- }
3258
- this.add(line);
3259
- });
3231
+ let pointsAfterClip = points;
3232
+ if (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.visible) {
3233
+ const startSize = (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.clip) ? (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.size) || 10 : 0;
3234
+ const pointsStart = {
3235
+ x: points[0].x - (startSize / 2) * (Math.cos(this._startAngle) || 0),
3236
+ y: points[0].y - (startSize / 2) * (Math.sin(this._startAngle) || 0)
3237
+ };
3238
+ pointsAfterClip = [pointsStart, ...pointsAfterClip.slice(1)];
3260
3239
  }
3261
- else {
3262
- const line = vrender.createLine(Object.assign(Object.assign({ points: this._clipPoints(this.attribute.points) }, vutils.array(lineStyle)[0]), { fill: false }));
3263
- line.name = `${this.name}-line`;
3264
- line.id = this._getNodeId('line');
3265
- if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.line)) {
3266
- line.states = [].concat(state.line)[0];
3267
- }
3268
- this.add(line);
3240
+ if (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.visible) {
3241
+ const endSize = (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.clip) ? (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.size) || 10 : 0;
3242
+ const pointsEnd = {
3243
+ x: points[points.length - 1].x - (endSize / 2) * (Math.cos(this._endAngle) || 0),
3244
+ y: points[points.length - 1].y - (endSize / 2) * (Math.sin(this._endAngle) || 0)
3245
+ };
3246
+ pointsAfterClip = [...pointsAfterClip.slice(0, pointsAfterClip.length - 1), pointsEnd];
3269
3247
  }
3270
- }
3271
- _renderSymbol(attribute, dim) {
3272
- const points = this._getMainSegmentPoints();
3273
- if (!points.length) {
3274
- return;
3248
+ const line = vrender.createLine(Object.assign({ points: pointsAfterClip, fill: false }, lineStyle));
3249
+ line.name = 'line';
3250
+ line.id = this._getNodeId('line');
3251
+ if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.line)) {
3252
+ line.states = state.line;
3275
3253
  }
3254
+ this.line = line;
3255
+ this.add(line);
3256
+ }
3257
+ renderSymbol(attribute, dim) {
3276
3258
  const { autoRotate = true } = attribute;
3277
3259
  let symbol;
3278
3260
  if (attribute === null || attribute === void 0 ? void 0 : attribute.visible) {
3279
3261
  const startAngle = this._startAngle;
3280
3262
  const endAngle = this._endAngle;
3281
- const { state } = this.attribute;
3263
+ const { points, state } = this.attribute;
3282
3264
  const start = points[0];
3283
3265
  const end = points[points.length - 1];
3284
3266
  const { refX = 0, refY = 0, refAngle = 0, style, symbolType, size = 12 } = attribute;
@@ -3286,22 +3268,20 @@
3286
3268
  let rotate;
3287
3269
  if (dim === 'start') {
3288
3270
  position = {
3289
- x: start.x +
3290
- (vutils.isValidNumber(startAngle) ? refX * Math.cos(startAngle) + refY * Math.cos(startAngle - Math.PI / 2) : 0),
3291
- y: start.y +
3292
- (vutils.isValidNumber(startAngle) ? refX * Math.sin(startAngle) + refY * Math.sin(startAngle - Math.PI / 2) : 0)
3271
+ x: start.x + (startAngle ? refX * Math.cos(startAngle) + refY * Math.cos(startAngle - Math.PI / 2) : 0),
3272
+ y: start.y + (startAngle ? refX * Math.sin(startAngle) + refY * Math.sin(startAngle - Math.PI / 2) : 0)
3293
3273
  };
3294
3274
  rotate = startAngle + Math.PI / 2;
3295
3275
  }
3296
3276
  else {
3297
3277
  position = {
3298
- x: end.x + (vutils.isValidNumber(endAngle) ? refX * Math.cos(endAngle) + refY * Math.cos(endAngle - Math.PI / 2) : 0),
3299
- y: end.y + (vutils.isValidNumber(endAngle) ? refX * Math.sin(endAngle) + refY * Math.sin(endAngle - Math.PI / 2) : 0)
3278
+ x: end.x + (endAngle ? refX * Math.cos(endAngle) + refY * Math.cos(endAngle - Math.PI / 2) : 0),
3279
+ y: end.y + (endAngle ? refX * Math.sin(endAngle) + refY * Math.sin(endAngle - Math.PI / 2) : 0)
3300
3280
  };
3301
3281
  rotate = endAngle + Math.PI / 2;
3302
3282
  }
3303
3283
  symbol = vrender.createSymbol(Object.assign(Object.assign(Object.assign({}, position), { symbolType: symbolType, size, angle: autoRotate ? rotate + refAngle : 0, strokeBoundsBuffer: 0 }), style));
3304
- symbol.name = `${this.name}-${dim}-symbol`;
3284
+ symbol.name = `${dim}-symbol`;
3305
3285
  symbol.id = this._getNodeId(`${dim}-symbol`);
3306
3286
  if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.symbol)) {
3307
3287
  symbol.states = state.symbol;
@@ -3310,69 +3290,11 @@
3310
3290
  }
3311
3291
  return symbol;
3312
3292
  }
3313
- _getMainSegmentPoints() {
3314
- if (this._mainSegmentPoints) {
3315
- return this._mainSegmentPoints;
3316
- }
3317
- const { points: originPoints, multiSegment, mainSegmentIndex } = this.attribute;
3318
- let points;
3319
- if (multiSegment) {
3320
- if (vutils.isValidNumber(mainSegmentIndex)) {
3321
- points = originPoints[mainSegmentIndex];
3322
- }
3323
- else {
3324
- points = vutils.flattenArray(originPoints);
3325
- }
3326
- }
3327
- else {
3328
- points = originPoints;
3329
- }
3330
- this._mainSegmentPoints = points;
3331
- return points;
3332
- }
3333
- _clipPoints(points) {
3334
- const { startSymbol, endSymbol } = this.attribute;
3335
- let pointsAfterClip = points;
3336
- if (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.visible) {
3337
- const startSize = (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.clip) ? (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.size) || 10 : 0;
3338
- const pointsStart = {
3339
- x: points[0].x - (startSize / 2) * (Math.cos(this._startAngle) || 0),
3340
- y: points[0].y - (startSize / 2) * (Math.sin(this._startAngle) || 0)
3341
- };
3342
- pointsAfterClip = [pointsStart, ...pointsAfterClip.slice(1)];
3343
- }
3344
- if (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.visible) {
3345
- const endSize = (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.clip) ? (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.size) || 10 : 0;
3346
- const pointsEnd = {
3347
- x: points[points.length - 1].x - (endSize / 2) * (Math.cos(this._endAngle) || 0),
3348
- y: points[points.length - 1].y - (endSize / 2) * (Math.sin(this._endAngle) || 0)
3349
- };
3350
- pointsAfterClip = [...pointsAfterClip.slice(0, pointsAfterClip.length - 1), pointsEnd];
3351
- }
3352
- return pointsAfterClip;
3353
- }
3354
- _computeLineAngle() {
3355
- const points = this._getMainSegmentPoints();
3356
- if (points.length <= 1) {
3357
- return;
3358
- }
3359
- const start = points[0];
3360
- const startInside = points[1];
3361
- const endInside = points[points.length - 2];
3362
- const end = points[points.length - 1];
3363
- const startVector = [start.x - startInside.x, start.y - startInside.y];
3364
- const startAngle = Math.atan2(startVector[1], startVector[0]);
3365
- const endVector = [end.x - endInside.x, end.y - endInside.y];
3366
- const endAngle = Math.atan2(endVector[1], endVector[0]);
3367
- this._startAngle = startAngle;
3368
- this._endAngle = endAngle;
3293
+ getStartAngle() {
3294
+ return this._startAngle;
3369
3295
  }
3370
- _reset() {
3371
- this.startSymbol = null;
3372
- this.endSymbol = null;
3373
- this._startAngle = null;
3374
- this._endAngle = null;
3375
- this._mainSegmentPoints = null;
3296
+ getEndAngle() {
3297
+ return this._endAngle;
3376
3298
  }
3377
3299
  }
3378
3300
  Segment.defaultAttributes = {
@@ -6084,41 +6006,25 @@
6084
6006
  })(exports.IMarkPointItemPosition || (exports.IMarkPointItemPosition = {}));
6085
6007
 
6086
6008
  class Marker extends AbstractComponent {
6087
- constructor() {
6088
- super(...arguments);
6089
- this.name = 'marker';
6090
- }
6091
6009
  _initContainer() {
6092
- var _a, _b;
6093
- const { limitRect, clipInRange } = this.attribute;
6094
- let group;
6095
- if (clipInRange) {
6096
- const groupClip = vrender.createGroup(Object.assign(Object.assign({}, limitRect), { clip: true, pickable: false }));
6097
- group = vrender.createGroup({
6098
- x: -((_a = limitRect === null || limitRect === void 0 ? void 0 : limitRect.x) !== null && _a !== void 0 ? _a : 0),
6099
- y: -((_b = limitRect === null || limitRect === void 0 ? void 0 : limitRect.y) !== null && _b !== void 0 ? _b : 0)
6100
- });
6101
- groupClip.add(group);
6102
- this._containerClip = groupClip;
6103
- this.add(groupClip);
6104
- }
6105
- else {
6106
- group = vrender.createGroup({
6107
- x: 0,
6108
- y: 0
6109
- });
6110
- this.add(group);
6111
- }
6112
- group.name = 'marker-container';
6010
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
6011
+ const groupClip = vrender.createGroup(Object.assign(Object.assign({}, (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.clipRange), { clip: (_c = vutils.isValid((_b = this.attribute) === null || _b === void 0 ? void 0 : _b.clipRange)) !== null && _c !== void 0 ? _c : false }));
6012
+ groupClip.name = 'marker-container';
6013
+ const group = vrender.createGroup({
6014
+ x: -((_f = (_e = (_d = this.attribute) === null || _d === void 0 ? void 0 : _d.clipRange) === null || _e === void 0 ? void 0 : _e.x) !== null && _f !== void 0 ? _f : 0),
6015
+ y: -((_j = (_h = (_g = this.attribute) === null || _g === void 0 ? void 0 : _g.clipRange) === null || _h === void 0 ? void 0 : _h.y) !== null && _j !== void 0 ? _j : 0)
6016
+ });
6017
+ groupClip.add(group);
6018
+ this._containerClip = groupClip;
6019
+ this.add(groupClip);
6113
6020
  this._container = group;
6114
6021
  }
6115
6022
  _updateContainer() {
6116
- var _a, _b, _c;
6117
- const { limitRect, clipInRange } = this.attribute;
6118
- (_a = this._containerClip) === null || _a === void 0 ? void 0 : _a.setAttributes(Object.assign({}, limitRect));
6023
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
6024
+ this._containerClip.setAttributes(Object.assign(Object.assign({}, (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.clipRange), { clip: (_c = vutils.isValid((_b = this.attribute) === null || _b === void 0 ? void 0 : _b.clipRange)) !== null && _c !== void 0 ? _c : false }));
6119
6025
  this._container.setAttributes({
6120
- x: clipInRange ? -((_b = limitRect === null || limitRect === void 0 ? void 0 : limitRect.x) !== null && _b !== void 0 ? _b : 0) : 0,
6121
- y: clipInRange ? -((_c = limitRect === null || limitRect === void 0 ? void 0 : limitRect.y) !== null && _c !== void 0 ? _c : 0) : 0
6026
+ x: -((_f = (_e = (_d = this.attribute) === null || _d === void 0 ? void 0 : _d.clipRange) === null || _e === void 0 ? void 0 : _e.x) !== null && _f !== void 0 ? _f : 0),
6027
+ y: -((_j = (_h = (_g = this.attribute) === null || _g === void 0 ? void 0 : _g.clipRange) === null || _h === void 0 ? void 0 : _h.y) !== null && _j !== void 0 ? _j : 0)
6122
6028
  });
6123
6029
  }
6124
6030
  render() {
@@ -6130,7 +6036,7 @@
6130
6036
  this.setAttribute('childrenPickable', false);
6131
6037
  }
6132
6038
  if (markerVisible) {
6133
- if (!this._container) {
6039
+ if (!this._containerClip) {
6134
6040
  this._initContainer();
6135
6041
  this.initMarker(this._container);
6136
6042
  }
@@ -6367,84 +6273,47 @@
6367
6273
  }
6368
6274
  };
6369
6275
 
6370
- function limitShapeInBounds(shape, bounds) {
6371
- const { x1: regionMinX, y1: regionMinY, x2: regionMaxX, y2: regionMaxY } = bounds;
6372
- const { x1, y1, x2, y2 } = shape.AABBBounds;
6373
- const { dx: originDx = 0, dy: originDy = 0 } = shape.attribute;
6374
- let dx = 0;
6375
- let dy = 0;
6376
- if (x1 < regionMinX) {
6377
- dx = regionMinX - x1;
6378
- }
6379
- if (y1 < regionMinY) {
6380
- dy = regionMinY - y1;
6381
- }
6382
- if (x2 > regionMaxX) {
6383
- dx = regionMaxX - x2;
6384
- }
6385
- if (y2 > regionMaxY) {
6386
- dy = regionMaxY - y2;
6387
- }
6388
- if (dx) {
6389
- shape.setAttribute('dx', dx + originDx);
6390
- }
6391
- if (dy) {
6392
- shape.setAttribute('dy', dy + originDy);
6393
- }
6394
- }
6395
-
6396
6276
  class MarkLine extends Marker {
6397
6277
  constructor(attributes) {
6398
6278
  super(vutils.merge({}, MarkLine.defaultAttributes, attributes));
6399
6279
  }
6400
6280
  setLabelPos() {
6401
- var _a, _b;
6402
- const { label = {}, limitRect } = this.attribute;
6403
- const { position = 'end', refX = 0, refY = 0, confine } = label;
6404
- const points = this._line.getMainSegmentPoints();
6405
- const labelAngle = (_a = this._line.getEndAngle()) !== null && _a !== void 0 ? _a : 0;
6406
- const labelOffsetX = refX * Math.cos(labelAngle) + refY * Math.cos(labelAngle - Math.PI / 2);
6407
- const labelOffsetY = refX * Math.sin(labelAngle) + refY * Math.sin(labelAngle - Math.PI / 2);
6408
- let labelPoint;
6409
- if (position.includes('start') || position.includes('Start')) {
6410
- labelPoint = {
6281
+ var _a, _b, _c, _d, _e;
6282
+ const { points, label } = this.attribute;
6283
+ const labelPosition = (_a = label === null || label === void 0 ? void 0 : label.position) !== null && _a !== void 0 ? _a : 'end';
6284
+ const labelAngle = this._line.getEndAngle();
6285
+ const labelOffsetX = (label === null || label === void 0 ? void 0 : label.refX) * Math.cos(labelAngle) + label.refY * Math.cos(labelAngle - Math.PI / 2);
6286
+ const labelOffsetY = (label === null || label === void 0 ? void 0 : label.refX) * Math.sin(labelAngle) + label.refY * Math.sin(labelAngle - Math.PI / 2);
6287
+ if (labelPosition.includes('start') || labelPosition.includes('Start')) {
6288
+ (_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes({
6411
6289
  x: points[0].x + labelOffsetX,
6412
6290
  y: points[0].y + labelOffsetY
6413
- };
6291
+ });
6414
6292
  }
6415
- else if (position.includes('middle') || position.includes('Middle')) {
6416
- labelPoint = {
6293
+ else if (labelPosition.includes('middle') || labelPosition.includes('Middle')) {
6294
+ (_c = this._label) === null || _c === void 0 ? void 0 : _c.setAttributes({
6417
6295
  x: (points[0].x + points[points.length - 1].x) / 2 + labelOffsetX,
6418
6296
  y: (points[0].y + points[points.length - 1].y) / 2 + labelOffsetY
6419
- };
6297
+ });
6420
6298
  }
6421
6299
  else {
6422
- labelPoint = {
6300
+ (_d = this._label) === null || _d === void 0 ? void 0 : _d.setAttributes({
6423
6301
  x: points[points.length - 1].x + labelOffsetX,
6424
6302
  y: points[points.length - 1].y + labelOffsetY
6425
- };
6426
- }
6427
- this._label.setAttributes(Object.assign(Object.assign({}, labelPoint), { angle: label.autoRotate ? labelAngle + ((_b = label === null || label === void 0 ? void 0 : label.refAngle) !== null && _b !== void 0 ? _b : 0) : 0, textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_LINE_TEXT_STYLE_MAP[position]), label.textStyle) }));
6428
- if (limitRect && confine) {
6429
- const { x, y, width, height } = limitRect;
6430
- limitShapeInBounds(this._label, {
6431
- x1: x,
6432
- y1: y,
6433
- x2: x + width,
6434
- y2: y + height
6435
6303
  });
6436
6304
  }
6305
+ this._label.setAttributes({
6306
+ angle: label.autoRotate && labelAngle + ((_e = label === null || label === void 0 ? void 0 : label.refAngle) !== null && _e !== void 0 ? _e : 0),
6307
+ textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_LINE_TEXT_STYLE_MAP[labelPosition]), label.textStyle)
6308
+ });
6437
6309
  }
6438
6310
  initMarker(container) {
6439
- const { points, startSymbol, endSymbol, label, lineStyle, mainSegmentIndex, multiSegment } = this
6440
- .attribute;
6311
+ const { points, startSymbol, endSymbol, label, lineStyle } = this.attribute;
6441
6312
  const line = new Segment({
6442
6313
  points,
6443
6314
  startSymbol,
6444
6315
  endSymbol,
6445
- lineStyle,
6446
- mainSegmentIndex,
6447
- multiSegment
6316
+ lineStyle
6448
6317
  });
6449
6318
  line.name = 'mark-line-line';
6450
6319
  this._line = line;
@@ -6464,7 +6333,7 @@
6464
6333
  endSymbol,
6465
6334
  lineStyle
6466
6335
  });
6467
- (_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({ dx: 0, dy: 0 }, label));
6336
+ (_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({}, label));
6468
6337
  this.setLabelPos();
6469
6338
  }
6470
6339
  }
@@ -6474,54 +6343,58 @@
6474
6343
  constructor(attributes) {
6475
6344
  super(vutils.merge({}, MarkArea.defaultAttributes, attributes));
6476
6345
  }
6477
- _getPositionByDirection(area, direction) {
6478
- const { x1, x2, y1, y2 } = this._area.AABBBounds;
6479
- if (direction.includes('left') || direction.includes('Left')) {
6480
- return {
6481
- x: x1,
6482
- y: (y1 + y2) / 2
6483
- };
6484
- }
6485
- if (direction.includes('right') || direction.includes('Right')) {
6486
- return {
6487
- x: x2,
6488
- y: (y1 + y2) / 2
6489
- };
6490
- }
6491
- if (direction.includes('top') || direction.includes('Top')) {
6492
- return {
6493
- x: (x1 + x2) / 2,
6494
- y: y1
6495
- };
6496
- }
6497
- if (direction.includes('bottom') || direction.includes('Bottom')) {
6498
- return {
6499
- x: (x1 + x2) / 2,
6500
- y: y2
6501
- };
6502
- }
6346
+ getLeftPos() {
6347
+ return {
6348
+ x: this._area.AABBBounds.x1,
6349
+ y: (this._area.AABBBounds.y1 + this._area.AABBBounds.y2) / 2
6350
+ };
6351
+ }
6352
+ getRightPos() {
6503
6353
  return {
6504
- x: (x1 + x2) / 2,
6505
- y: (y1 + y2) / 2
6354
+ x: this._area.AABBBounds.x2,
6355
+ y: (this._area.AABBBounds.y1 + this._area.AABBBounds.y2) / 2
6356
+ };
6357
+ }
6358
+ getTopPos() {
6359
+ return {
6360
+ x: (this._area.AABBBounds.x1 + this._area.AABBBounds.x2) / 2,
6361
+ y: this._area.AABBBounds.y1
6362
+ };
6363
+ }
6364
+ getBottomPos() {
6365
+ return {
6366
+ x: (this._area.AABBBounds.x1 + this._area.AABBBounds.x2) / 2,
6367
+ y: this._area.AABBBounds.y2
6368
+ };
6369
+ }
6370
+ getMiddlePos() {
6371
+ return {
6372
+ x: (this._area.AABBBounds.x1 + this._area.AABBBounds.x2) / 2,
6373
+ y: (this._area.AABBBounds.y1 + this._area.AABBBounds.y2) / 2
6506
6374
  };
6507
6375
  }
6508
6376
  setLabelPos() {
6509
- var _a;
6510
- if (this._label && this._area) {
6511
- const { label } = this.attribute;
6512
- const labelPosition = (_a = label === null || label === void 0 ? void 0 : label.position) !== null && _a !== void 0 ? _a : 'middle';
6513
- const labelPoint = this._getPositionByDirection(this._area, labelPosition);
6514
- this._label.setAttributes(Object.assign(Object.assign({}, labelPoint), { textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_AREA_TEXT_STYLE_MAP[labelPosition]), label.textStyle) }));
6515
- if (this.attribute.limitRect && (label === null || label === void 0 ? void 0 : label.confine)) {
6516
- const { x, y, width, height } = this.attribute.limitRect;
6517
- limitShapeInBounds(this._label, {
6518
- x1: x,
6519
- y1: y,
6520
- x2: x + width,
6521
- y2: y + height
6522
- });
6523
- }
6377
+ var _a, _b, _c, _d, _e, _f, _g;
6378
+ const { label } = this.attribute;
6379
+ const labelPosition = (_a = label === null || label === void 0 ? void 0 : label.position) !== null && _a !== void 0 ? _a : 'middle';
6380
+ if (labelPosition.includes('left') || labelPosition.includes('Left')) {
6381
+ (_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({}, this.getLeftPos()));
6382
+ }
6383
+ else if (labelPosition.includes('right') || labelPosition.includes('Right')) {
6384
+ (_c = this._label) === null || _c === void 0 ? void 0 : _c.setAttributes(Object.assign({}, this.getRightPos()));
6385
+ }
6386
+ else if (labelPosition.includes('top') || labelPosition.includes('Top')) {
6387
+ (_d = this._label) === null || _d === void 0 ? void 0 : _d.setAttributes(Object.assign({}, this.getTopPos()));
6388
+ }
6389
+ else if (labelPosition.includes('bottom') || labelPosition.includes('Bottom')) {
6390
+ (_e = this._label) === null || _e === void 0 ? void 0 : _e.setAttributes(Object.assign({}, this.getBottomPos()));
6391
+ }
6392
+ else {
6393
+ (_f = this._label) === null || _f === void 0 ? void 0 : _f.setAttributes(Object.assign({}, this.getMiddlePos()));
6524
6394
  }
6395
+ (_g = this._label) === null || _g === void 0 ? void 0 : _g.setAttributes({
6396
+ textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_AREA_TEXT_STYLE_MAP[labelPosition]), label.textStyle)
6397
+ });
6525
6398
  }
6526
6399
  initMarker(container) {
6527
6400
  const { points, label, areaStyle } = this.attribute;
@@ -6539,7 +6412,7 @@
6539
6412
  var _a, _b;
6540
6413
  const { points, label, areaStyle } = this.attribute;
6541
6414
  (_a = this._area) === null || _a === void 0 ? void 0 : _a.setAttributes(Object.assign({ points: points }, areaStyle));
6542
- (_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({ dx: 0, dy: 0 }, label));
6415
+ (_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({}, label));
6543
6416
  this.setLabelPos();
6544
6417
  }
6545
6418
  }
@@ -6553,29 +6426,26 @@
6553
6426
  }
6554
6427
  setItemAttributes(item, itemContent, itemPosition, itemType) {
6555
6428
  var _a;
6556
- if (!item) {
6557
- return;
6558
- }
6559
6429
  const { autoRotate = true, refX = 0, refY = 0, refAngle = 0, textStyle, richTextStyle, imageStyle, position = exports.IMarkPointItemPosition.middle } = itemContent;
6560
6430
  const itemAngle = ((_a = this._line) === null || _a === void 0 ? void 0 : _a.getEndAngle()) || 0;
6561
6431
  const itemOffsetX = refX * Math.cos(itemAngle) + refY * Math.cos(itemAngle - Math.PI / 2);
6562
6432
  const itemOffsetY = refX * Math.sin(itemAngle) + refY * Math.sin(itemAngle - Math.PI / 2);
6563
6433
  if (itemType === 'text') {
6564
- item.setAttributes(Object.assign(Object.assign({}, textStyle), { textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_POINT_TEXT_STYLE_MAP[(itemContent === null || itemContent === void 0 ? void 0 : itemContent.position) || 'end']), textStyle === null || textStyle === void 0 ? void 0 : textStyle.textStyle) }));
6434
+ item === null || item === void 0 ? void 0 : item.setAttributes(Object.assign(Object.assign({}, textStyle), { textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_POINT_TEXT_STYLE_MAP[(itemContent === null || itemContent === void 0 ? void 0 : itemContent.position) || 'end']), textStyle === null || textStyle === void 0 ? void 0 : textStyle.textStyle) }));
6565
6435
  }
6566
6436
  else if (itemType === 'richText') {
6567
- item.setAttributes({
6437
+ item === null || item === void 0 ? void 0 : item.setAttributes({
6568
6438
  dx: this.getItemDx(item, position, richTextStyle) + ((richTextStyle === null || richTextStyle === void 0 ? void 0 : richTextStyle.dx) || 0),
6569
6439
  dy: this.getItemDy(item, position, richTextStyle) + ((richTextStyle === null || richTextStyle === void 0 ? void 0 : richTextStyle.dy) || 0)
6570
6440
  });
6571
6441
  }
6572
6442
  else if (itemType === 'image') {
6573
- item.setAttributes({
6443
+ item === null || item === void 0 ? void 0 : item.setAttributes({
6574
6444
  dx: this.getItemDx(item, position, imageStyle) + ((imageStyle === null || imageStyle === void 0 ? void 0 : imageStyle.dx) || 0),
6575
6445
  dy: this.getItemDy(item, position, imageStyle) + ((imageStyle === null || imageStyle === void 0 ? void 0 : imageStyle.dy) || 0)
6576
6446
  });
6577
6447
  }
6578
- item.setAttributes({
6448
+ item === null || item === void 0 ? void 0 : item.setAttributes({
6579
6449
  x: itemPosition.x + (itemOffsetX || 0),
6580
6450
  y: itemPosition.y + (itemOffsetY || 0),
6581
6451
  angle: autoRotate && itemAngle + refAngle
@@ -6587,7 +6457,7 @@
6587
6457
  if (position.includes('inside')) {
6588
6458
  return -width;
6589
6459
  }
6590
- if (position === 'insideTop') {
6460
+ else if (position === 'insideTop') {
6591
6461
  return 0;
6592
6462
  }
6593
6463
  return 0;
@@ -6598,7 +6468,7 @@
6598
6468
  if (position.includes('top') || position.includes('Top')) {
6599
6469
  return -height;
6600
6470
  }
6601
- if (position.includes('middle') || position.includes('Middle')) {
6471
+ else if (position.includes('middle') || position.includes('Middle')) {
6602
6472
  return -height / 2;
6603
6473
  }
6604
6474
  return 0;
@@ -10475,7 +10345,7 @@
10475
10345
  return new Tag(params ? params.attribute : {});
10476
10346
  }
10477
10347
 
10478
- const version = "0.15.0-alpha.24";
10348
+ const version = "0.15.0-alpha.25";
10479
10349
 
10480
10350
  exports.AbstractComponent = AbstractComponent;
10481
10351
  exports.ArcInfo = ArcInfo;