@visactor/vrender-components 0.21.0-alpha.3 → 0.21.0-alpha.5

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 (72) hide show
  1. package/cjs/axis/type.d.ts +2 -2
  2. package/cjs/axis/type.js.map +1 -1
  3. package/cjs/data-zoom/type.d.ts +1 -1
  4. package/cjs/data-zoom/type.js.map +1 -1
  5. package/cjs/index.d.ts +1 -1
  6. package/cjs/index.js +1 -1
  7. package/cjs/index.js.map +1 -1
  8. package/cjs/interface.js.map +1 -1
  9. package/cjs/label/arc.js +1 -1
  10. package/cjs/label/arc.js.map +1 -1
  11. package/cjs/label/base.js +12 -7
  12. package/cjs/label/base.js.map +1 -1
  13. package/cjs/label/overlap/place.d.ts +6 -1
  14. package/cjs/label/overlap/place.js +4 -4
  15. package/cjs/label/overlap/place.js.map +1 -1
  16. package/cjs/label/overlap/shiftY.d.ts +2 -1
  17. package/cjs/label/overlap/shiftY.js +72 -18
  18. package/cjs/label/overlap/shiftY.js.map +1 -1
  19. package/cjs/legend/color/type.d.ts +2 -2
  20. package/cjs/legend/color/type.js.map +1 -1
  21. package/cjs/legend/discrete/type.d.ts +1 -1
  22. package/cjs/legend/discrete/type.js.map +1 -1
  23. package/cjs/marker/type.d.ts +2 -2
  24. package/cjs/marker/type.js.map +1 -1
  25. package/cjs/player/type/discrete-player.d.ts +3 -3
  26. package/cjs/player/type/discrete-player.js.map +1 -1
  27. package/cjs/player/type/index.d.ts +2 -2
  28. package/cjs/player/type/index.js.map +1 -1
  29. package/cjs/scrollbar/index.d.ts +1 -0
  30. package/cjs/scrollbar/index.js +2 -1
  31. package/cjs/scrollbar/index.js.map +1 -1
  32. package/cjs/scrollbar/scrollbar-plugin.d.ts +18 -15
  33. package/cjs/scrollbar/scrollbar-plugin.js +109 -97
  34. package/cjs/scrollbar/scrollbar-plugin.js.map +1 -1
  35. package/cjs/timeline/type.js.map +1 -1
  36. package/dist/index.es.js +531 -140
  37. package/es/axis/type.d.ts +2 -2
  38. package/es/axis/type.js.map +1 -1
  39. package/es/data-zoom/type.d.ts +1 -1
  40. package/es/data-zoom/type.js.map +1 -1
  41. package/es/index.d.ts +1 -1
  42. package/es/index.js +1 -1
  43. package/es/index.js.map +1 -1
  44. package/es/interface.js.map +1 -1
  45. package/es/label/arc.js +1 -1
  46. package/es/label/arc.js.map +1 -1
  47. package/es/label/base.js +12 -7
  48. package/es/label/base.js.map +1 -1
  49. package/es/label/overlap/place.d.ts +6 -1
  50. package/es/label/overlap/place.js +4 -4
  51. package/es/label/overlap/place.js.map +1 -1
  52. package/es/label/overlap/shiftY.d.ts +2 -1
  53. package/es/label/overlap/shiftY.js +68 -15
  54. package/es/label/overlap/shiftY.js.map +1 -1
  55. package/es/legend/color/type.d.ts +2 -2
  56. package/es/legend/color/type.js.map +1 -1
  57. package/es/legend/discrete/type.d.ts +1 -1
  58. package/es/legend/discrete/type.js.map +1 -1
  59. package/es/marker/type.d.ts +2 -2
  60. package/es/marker/type.js.map +1 -1
  61. package/es/player/type/discrete-player.d.ts +3 -3
  62. package/es/player/type/discrete-player.js.map +1 -1
  63. package/es/player/type/index.d.ts +2 -2
  64. package/es/player/type/index.js.map +1 -1
  65. package/es/scrollbar/index.d.ts +1 -0
  66. package/es/scrollbar/index.js +2 -0
  67. package/es/scrollbar/index.js.map +1 -1
  68. package/es/scrollbar/scrollbar-plugin.d.ts +18 -15
  69. package/es/scrollbar/scrollbar-plugin.js +111 -94
  70. package/es/scrollbar/scrollbar-plugin.js.map +1 -1
  71. package/es/timeline/type.js.map +1 -1
  72. package/package.json +10 -9
package/dist/index.es.js CHANGED
@@ -2087,7 +2087,8 @@ const DefaultAttribute = Object.assign(Object.assign(Object.assign({
2087
2087
  globalZIndex: 1,
2088
2088
  globalCompositeOperation: "",
2089
2089
  overflow: "hidden",
2090
- shadowPickMode: "graphic"
2090
+ shadowPickMode: "graphic",
2091
+ keepStrokeScale: !1
2091
2092
  }, DefaultDebugAttribute), DefaultStyle), DefaultTransform);
2092
2093
  const DefaultArcAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
2093
2094
  startAngle: 0,
@@ -6125,9 +6126,6 @@ const SymbolRenderContribution = Symbol.for("SymbolRenderContribution");
6125
6126
  const TextRenderContribution = Symbol.for("TextRenderContribution");
6126
6127
  const InteractiveSubRenderContribution = Symbol.for("InteractiveSubRenderContribution");
6127
6128
 
6128
- function textDrawOffsetY(baseline, h) {
6129
- return "top" === baseline ? Math.ceil(.79 * h) : "middle" === baseline ? Math.round(.3 * h) : "bottom" === baseline ? Math.round(-.21 * h) : 0;
6130
- }
6131
6129
  function textDrawOffsetX(textAlign, width) {
6132
6130
  return "end" === textAlign || "right" === textAlign ? -width : "center" === textAlign ? -width / 2 : 0;
6133
6131
  }
@@ -7116,7 +7114,8 @@ class DefaultArcRenderContribution {
7116
7114
  x: originX = arcAttribute.x,
7117
7115
  y: originY = arcAttribute.y,
7118
7116
  scaleX = arcAttribute.scaleX,
7119
- scaleY = arcAttribute.scaleY
7117
+ scaleY = arcAttribute.scaleY,
7118
+ keepStrokeScale = arcAttribute.keepStrokeScale
7120
7119
  } = arc.attribute;
7121
7120
  let {
7122
7121
  innerRadius = arcAttribute.innerRadius,
@@ -7128,7 +7127,7 @@ class DefaultArcRenderContribution {
7128
7127
  {
7129
7128
  distance = arcAttribute[key].distance
7130
7129
  } = borderStyle,
7131
- d = getScaledStroke(context, distance, context.dpr),
7130
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
7132
7131
  deltaAngle = distance / outerRadius,
7133
7132
  sign = "outerBorder" === key ? 1 : -1;
7134
7133
  if (arc.setAttributes({
@@ -7173,14 +7172,15 @@ class DefaultCircleRenderContribution {
7173
7172
  x: originX = circleAttribute.x,
7174
7173
  y: originY = circleAttribute.y,
7175
7174
  scaleX = circleAttribute.scaleX,
7176
- scaleY = circleAttribute.scaleY
7175
+ scaleY = circleAttribute.scaleY,
7176
+ keepStrokeScale = circleAttribute.keepStrokeScale
7177
7177
  } = circle.attribute,
7178
7178
  renderBorder = (borderStyle, key) => {
7179
7179
  const doStroke = !(!borderStyle || !borderStyle.stroke),
7180
7180
  {
7181
7181
  distance = circleAttribute[key].distance
7182
7182
  } = borderStyle,
7183
- d = getScaledStroke(context, distance, context.dpr),
7183
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
7184
7184
  sign = "outerBorder" === key ? 1 : -1;
7185
7185
  if (context.beginPath(), context.arc(x, y, radius + sign * d, startAngle, endAngle), context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(circle, circle.attribute, circleAttribute), strokeCb) strokeCb(context, borderStyle, circleAttribute[key]);else if (doStroke) {
7186
7186
  const lastOpacity = circleAttribute[key].opacity;
@@ -7299,7 +7299,8 @@ class DefaultRectRenderContribution {
7299
7299
  scaleX = rectAttribute.scaleX,
7300
7300
  scaleY = rectAttribute.scaleY,
7301
7301
  x1: x1,
7302
- y1: y1
7302
+ y1: y1,
7303
+ keepStrokeScale = rectAttribute.keepStrokeScale
7303
7304
  } = rect.attribute;
7304
7305
  let {
7305
7306
  width: width,
@@ -7312,7 +7313,7 @@ class DefaultRectRenderContribution {
7312
7313
  {
7313
7314
  distance = rectAttribute[key].distance
7314
7315
  } = borderStyle,
7315
- d = getScaledStroke(context, distance, context.dpr),
7316
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
7316
7317
  nextX = x + sign * d,
7317
7318
  nextY = y + sign * d,
7318
7319
  dw = 2 * d;
@@ -7469,14 +7470,15 @@ class DefaultSymbolRenderContribution {
7469
7470
  x: originX = symbolAttribute.x,
7470
7471
  y: originY = symbolAttribute.y,
7471
7472
  scaleX = symbolAttribute.scaleX,
7472
- scaleY = symbolAttribute.scaleY
7473
+ scaleY = symbolAttribute.scaleY,
7474
+ keepStrokeScale = symbolAttribute.keepStrokeScale
7473
7475
  } = symbol.attribute,
7474
7476
  renderBorder = (borderStyle, key) => {
7475
7477
  const doStroke = !(!borderStyle || !borderStyle.stroke),
7476
7478
  {
7477
7479
  distance = symbolAttribute[key].distance
7478
7480
  } = borderStyle,
7479
- d = getScaledStroke(context, distance, context.dpr),
7481
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
7480
7482
  sign = "outerBorder" === key ? 1 : -1;
7481
7483
  if (context.beginPath(), !1 === parsedPath.drawOffset(context, size, x, y, sign * d) && context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), strokeCb) strokeCb(context, borderStyle, symbolAttribute[key]);else if (doStroke) {
7482
7484
  const lastOpacity = symbolAttribute[key].opacity;
@@ -8752,16 +8754,8 @@ let DefaultCanvasTextRender = class extends BaseRender {
8752
8754
  verticalMode = textAttribute.verticalMode,
8753
8755
  x: originX = textAttribute.x,
8754
8756
  y: originY = textAttribute.y
8755
- } = text.attribute;
8756
- let {
8757
- textAlign = textAttribute.textAlign,
8758
- textBaseline = textAttribute.textBaseline
8759
- } = text.attribute;
8760
- if (!verticalMode && "vertical" === direction) {
8761
- const t = textAlign;
8762
- textAlign = null !== (_a = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = text.getAlignMapBaseline()[t]) && void 0 !== _b ? _b : "top";
8763
- }
8764
- const lineHeight = null !== (_c = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _c ? _c : fontSize,
8757
+ } = text.attribute,
8758
+ lineHeight = null !== (_a = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _a ? _a : fontSize,
8765
8759
  data = this.valid(text, textAttribute, fillCb, strokeCb);
8766
8760
  if (!data) return;
8767
8761
  const {
@@ -8781,7 +8775,7 @@ let DefaultCanvasTextRender = class extends BaseRender {
8781
8775
  const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);
8782
8776
  matrix.rotateByCenter(Math.PI / 2, _x, _y), context.transformFromMatrix(matrix, !0), matrixAllocate.free(matrix);
8783
8777
  }
8784
- doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), context.strokeText(t, _x, _y, z))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), context.fillText(t, _x, _y, z), this.drawUnderLine(underline, lineThrough, text, _x, _y, z, textAttribute, context))), direction && (context.highPerformanceRestore(), context.setTransformForCurrent());
8778
+ doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), context.strokeText(t, _x, _y, z))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), context.fillText(t, _x, _y, z))), direction && (context.highPerformanceRestore(), context.setTransformForCurrent());
8785
8779
  };
8786
8780
  if (context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z), "horizontal" === direction) {
8787
8781
  const {
@@ -8795,11 +8789,19 @@ let DefaultCanvasTextRender = class extends BaseRender {
8795
8789
  doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
8796
8790
  context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
8797
8791
  }))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
8798
- context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z), this.drawUnderLine(underline, lineThrough, text, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y - textDrawOffsetY("bottom", fontSize) - .05 * fontSize, z, textAttribute, context, {
8792
+ context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z), this.drawUnderLine(underline, lineThrough, text, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, line.descent, (line.descent - line.ascent) / 2, z, textAttribute, context, {
8799
8793
  width: line.width
8800
8794
  });
8801
8795
  })));
8802
8796
  } else {
8797
+ let {
8798
+ textAlign = textAttribute.textAlign,
8799
+ textBaseline = textAttribute.textBaseline
8800
+ } = text.attribute;
8801
+ if (!verticalMode) {
8802
+ const t = textAlign;
8803
+ textAlign = null !== (_b = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = text.getAlignMapBaseline()[t]) && void 0 !== _c ? _c : "top";
8804
+ }
8803
8805
  text.tryUpdateAABBBounds();
8804
8806
  const cache = text.cache,
8805
8807
  {
@@ -8838,12 +8840,10 @@ let DefaultCanvasTextRender = class extends BaseRender {
8838
8840
  computed3dMatrix = !keepDirIn3d;
8839
8841
  this._draw(text, textAttribute, computed3dMatrix, drawContext, params);
8840
8842
  }
8841
- drawUnderLine(underline, lineThrough, text, x, y, z, textAttribute, context, multiOption) {
8843
+ drawUnderLine(underline, lineThrough, text, anchorX, anchorY, offsetUnderLineY, offsetThroughLineY, z, textAttribute, context, multiOption) {
8842
8844
  if (lineThrough + underline <= 0) return;
8843
8845
  const {
8844
8846
  textAlign = textAttribute.textAlign,
8845
- textBaseline = textAttribute.textBaseline,
8846
- fontSize = textAttribute.fontSize,
8847
8847
  fill = textAttribute.fill,
8848
8848
  opacity = textAttribute.opacity,
8849
8849
  underlineOffset = textAttribute.underlineOffset,
@@ -8853,23 +8853,21 @@ let DefaultCanvasTextRender = class extends BaseRender {
8853
8853
  isMulti = !isNil(multiOption),
8854
8854
  w = isMulti ? multiOption.width : text.clipedWidth,
8855
8855
  offsetX = isMulti ? 0 : textDrawOffsetX(textAlign, w),
8856
- offsetY = textLayoutOffsetY(isMulti ? "alphabetic" : textBaseline, fontSize, fontSize),
8857
8856
  attribute = {
8858
8857
  lineWidth: 0,
8859
8858
  stroke: fill,
8860
8859
  opacity: opacity,
8861
8860
  strokeOpacity: fillOpacity
8862
8861
  };
8863
- let deltaY = isMulti ? -3 : 0;
8864
8862
  if (underline) {
8865
- attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
8866
- const dy = y + offsetY + fontSize + underlineOffset + deltaY;
8867
- context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
8863
+ attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, anchorX, anchorY, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
8864
+ const dy = anchorY + offsetUnderLineY + underlineOffset;
8865
+ context.moveTo(anchorX + offsetX, dy, z), context.lineTo(anchorX + offsetX + w, dy, z), context.stroke();
8868
8866
  }
8869
- if (isMulti && (deltaY = -1), lineThrough) {
8870
- attribute.lineWidth = lineThrough, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.beginPath();
8871
- const dy = y + offsetY + fontSize / 2 + deltaY;
8872
- context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
8867
+ if (lineThrough) {
8868
+ attribute.lineWidth = lineThrough, context.setStrokeStyle(text, attribute, anchorX, anchorY, textAttribute), context.beginPath();
8869
+ const dy = anchorY + offsetThroughLineY;
8870
+ context.moveTo(anchorX + offsetX, dy, z), context.lineTo(anchorX + offsetX + w, dy, z), context.stroke();
8873
8871
  }
8874
8872
  }
8875
8873
  };
@@ -9554,7 +9552,7 @@ class CanvasTextLayout {
9554
9552
  for (let i = 0, len = lines.length; i < len; i++) {
9555
9553
  const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions);
9556
9554
  width = Math.min(metrics.width, lineWidth), linesLayout.push({
9557
- str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
9555
+ str: metrics.width <= lineWidth ? lines[i].toString() : this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
9558
9556
  width: width,
9559
9557
  ascent: metrics.ascent,
9560
9558
  descent: metrics.descent
@@ -9751,8 +9749,7 @@ class Text extends Graphic {
9751
9749
  whiteSpace = textTheme.whiteSpace,
9752
9750
  suffixPosition = textTheme.suffixPosition
9753
9751
  } = attribute,
9754
- buf = ignoreBuf ? 0 : 2,
9755
- lineHeight = this.getLineHeight(attribute, textTheme) + buf;
9752
+ lineHeight = this.getLineHeight(attribute, textTheme);
9756
9753
  if ("normal" === whiteSpace || wrap) return this.updateWrapAABBBounds(text);
9757
9754
  if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
9758
9755
  const bbox = this.cache.layoutData.bbox;
@@ -9788,8 +9785,7 @@ class Text extends Graphic {
9788
9785
  heightLimit = 0,
9789
9786
  lineClamp: lineClamp
9790
9787
  } = this.attribute,
9791
- buf = ignoreBuf ? 0 : 2,
9792
- lineHeight = this.getLineHeight(this.attribute, textTheme) + buf;
9788
+ lineHeight = this.getLineHeight(this.attribute, textTheme);
9793
9789
  if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
9794
9790
  const bbox = this.cache.layoutData.bbox;
9795
9791
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
@@ -9820,8 +9816,8 @@ class Text extends Graphic {
9820
9816
  });
9821
9817
  break;
9822
9818
  }
9823
- const clip = textMeasure.clipText(str, textOptions, maxLineWidth, "break-word" === wordBreak);
9824
- if ("" !== str && "" === clip.str) {
9819
+ const clip = textMeasure.clipText(str, textOptions, maxLineWidth, "break-all" !== wordBreak, "keep-all" === wordBreak);
9820
+ if ("" !== str && "" === clip.str || clip.wordBreaked) {
9825
9821
  if (ellipsis) {
9826
9822
  const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
9827
9823
  clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
@@ -9829,13 +9825,15 @@ class Text extends Graphic {
9829
9825
  needCut = !1;
9830
9826
  }
9831
9827
  const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);
9832
- if (linesLayout.push({
9828
+ linesLayout.push({
9833
9829
  str: clip.str,
9834
9830
  width: clip.width,
9835
9831
  ascent: matrics.ascent,
9836
9832
  descent: matrics.descent
9837
- }), clip.str.length === str.length) ;else if (needCut) {
9838
- const newStr = str.substring(clip.str.length);
9833
+ });
9834
+ let cutLength = clip.str.length;
9835
+ if (!clip.wordBreaked || "" !== str && "" === clip.str || (needCut = !0, cutLength = clip.wordBreaked), clip.str.length === str.length) ;else if (needCut) {
9836
+ const newStr = str.substring(cutLength);
9839
9837
  lines.splice(i + 1, 0, newStr);
9840
9838
  }
9841
9839
  }
@@ -10151,6 +10149,9 @@ class BaseSymbol {
10151
10149
  bounds.x1 = -halfS, bounds.x2 = halfS, bounds.y1 = -halfS, bounds.y2 = halfS;
10152
10150
  } else bounds.x1 = -size[0] / 2, bounds.x2 = size[0] / 2, bounds.y1 = -size[1] / 2, bounds.y2 = size[1] / 2;
10153
10151
  }
10152
+ parseSize(size) {
10153
+ return isNumber(size) ? size : Math.min(size[0], size[1]);
10154
+ }
10154
10155
  }
10155
10156
 
10156
10157
  function circle(ctx, r, x, y, z) {
@@ -10161,13 +10162,13 @@ class CircleSymbol extends BaseSymbol {
10161
10162
  super(...arguments), this.type = "circle", this.pathStr = "M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0";
10162
10163
  }
10163
10164
  draw(ctx, size, x, y, z) {
10164
- return circle(ctx, size / 2, x, y, z);
10165
+ return circle(ctx, this.parseSize(size) / 2, x, y, z);
10165
10166
  }
10166
10167
  drawOffset(ctx, size, x, y, offset, z) {
10167
- return circle(ctx, size / 2 + offset, x, y, z);
10168
+ return circle(ctx, this.parseSize(size) / 2 + offset, x, y, z);
10168
10169
  }
10169
10170
  drawToSvgPath(size, x, y, z) {
10170
- const r = size / 2;
10171
+ const r = this.parseSize(size) / 2;
10171
10172
  return `M ${x - r}, ${y} a ${r},${r} 0 1,0 ${2 * r},0 a ${r},${r} 0 1,0 -${2 * r},0`;
10172
10173
  }
10173
10174
  }
@@ -10184,10 +10185,10 @@ class CrossSymbol extends BaseSymbol {
10184
10185
  super(...arguments), this.type = "cross", this.pathStr = "M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z";
10185
10186
  }
10186
10187
  draw(ctx, size, x, y, z) {
10187
- return cross(ctx, size / 6, x, y, z);
10188
+ return cross(ctx, this.parseSize(size) / 6, x, y, z);
10188
10189
  }
10189
10190
  drawOffset(ctx, size, x, y, offset, z) {
10190
- return crossOffset(ctx, size / 6, x, y, offset, z);
10191
+ return crossOffset(ctx, this.parseSize(size) / 6, x, y, offset, z);
10191
10192
  }
10192
10193
  }
10193
10194
  var cross$1 = new CrossSymbol();
@@ -10200,13 +10201,13 @@ class DiamondSymbol extends BaseSymbol {
10200
10201
  super(...arguments), this.type = "diamond", this.pathStr = "M-0.5,0L0,-0.5L0.5,0L0,0.5Z";
10201
10202
  }
10202
10203
  draw(ctx, size, x, y, z) {
10203
- return diamond(ctx, size / 2, x, y, z);
10204
+ return diamond(ctx, this.parseSize(size) / 2, x, y, z);
10204
10205
  }
10205
10206
  drawFitDir(ctx, size, x, y, z) {
10206
- return diamond(ctx, size / 2, x, y, z);
10207
+ return diamond(ctx, this.parseSize(size) / 2, x, y, z);
10207
10208
  }
10208
10209
  drawOffset(ctx, size, x, y, offset, z) {
10209
- return diamond(ctx, size / 2 + offset, x, y, z);
10210
+ return diamond(ctx, this.parseSize(size) / 2 + offset, x, y, z);
10210
10211
  }
10211
10212
  }
10212
10213
  var diamond$1 = new DiamondSymbol();
@@ -10220,10 +10221,10 @@ class SquareSymbol extends BaseSymbol {
10220
10221
  super(...arguments), this.type = "square", this.pathStr = "M-0.5,-0.5h1v1h-1Z";
10221
10222
  }
10222
10223
  draw(ctx, size, x, y) {
10223
- return square(ctx, size / 2, x, y);
10224
+ return square(ctx, this.parseSize(size) / 2, x, y);
10224
10225
  }
10225
10226
  drawOffset(ctx, size, x, y, offset) {
10226
- return square(ctx, size / 2 + offset, x, y);
10227
+ return square(ctx, this.parseSize(size) / 2 + offset, x, y);
10227
10228
  }
10228
10229
  }
10229
10230
  var square$1 = new SquareSymbol();
@@ -10237,10 +10238,10 @@ class TriangleUpSymbol extends BaseSymbol {
10237
10238
  super(...arguments), this.type = "triangleUp", this.pathStr = "M0.5,0.5 L-0.5,0.5 L0,-0.5 Z";
10238
10239
  }
10239
10240
  draw(ctx, size, x, y) {
10240
- return trianglUpOffset(ctx, size / 2, x, y);
10241
+ return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y);
10241
10242
  }
10242
10243
  drawOffset(ctx, size, x, y, offset) {
10243
- return trianglUpOffset(ctx, size / 2, x, y, offset);
10244
+ return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y, offset);
10244
10245
  }
10245
10246
  }
10246
10247
  var triangleUp = new TriangleUpSymbol();
@@ -10272,10 +10273,10 @@ class StarSymbol extends BaseSymbol {
10272
10273
  super(...arguments), this.type = "star", this.pathStr = "M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z";
10273
10274
  }
10274
10275
  draw(ctx, size, transX, transY) {
10275
- return star(ctx, size / 2, transX, transY);
10276
+ return star(ctx, this.parseSize(size) / 2, transX, transY);
10276
10277
  }
10277
10278
  drawOffset(ctx, size, transX, transY, offset) {
10278
- return star(ctx, size / 2 + offset, transX, transY);
10279
+ return star(ctx, this.parseSize(size) / 2 + offset, transX, transY);
10279
10280
  }
10280
10281
  }
10281
10282
  var star$1 = new StarSymbol();
@@ -10293,10 +10294,10 @@ class ArrowSymbol extends BaseSymbol {
10293
10294
  super(...arguments), this.type = "arrow", this.pathStr = "M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z";
10294
10295
  }
10295
10296
  draw(ctx, size, transX, transY) {
10296
- return arrow(ctx, size / 2, transX, transY);
10297
+ return arrow(ctx, this.parseSize(size) / 2, transX, transY);
10297
10298
  }
10298
10299
  drawOffset(ctx, size, transX, transY, offset) {
10299
- return arrow(ctx, size / 2 + offset, transX, transY);
10300
+ return arrow(ctx, this.parseSize(size) / 2 + offset, transX, transY);
10300
10301
  }
10301
10302
  }
10302
10303
  var arrow$1 = new ArrowSymbol();
@@ -10310,10 +10311,10 @@ class WedgeSymbol extends BaseSymbol {
10310
10311
  super(...arguments), this.type = "wedge", this.pathStr = "M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z";
10311
10312
  }
10312
10313
  draw(ctx, size, transX, transY) {
10313
- return wedge(ctx, size / 2, transX, transY);
10314
+ return wedge(ctx, this.parseSize(size) / 2, transX, transY);
10314
10315
  }
10315
10316
  drawOffset(ctx, size, transX, transY, offset) {
10316
- return wedge(ctx, size / 2 + offset, transX, transY);
10317
+ return wedge(ctx, this.parseSize(size) / 2 + offset, transX, transY);
10317
10318
  }
10318
10319
  }
10319
10320
  var wedge$1 = new WedgeSymbol();
@@ -10326,10 +10327,10 @@ class StrokeSymbol extends BaseSymbol {
10326
10327
  super(...arguments), this.type = "stroke", this.pathStr = "";
10327
10328
  }
10328
10329
  draw(ctx, size, transX, transY) {
10329
- return stroke(ctx, size / 2, transX, transY);
10330
+ return stroke(ctx, this.parseSize(size) / 2, transX, transY);
10330
10331
  }
10331
10332
  drawOffset(ctx, size, transX, transY, offset) {
10332
- return stroke(ctx, size / 2 + offset, transX, transY);
10333
+ return stroke(ctx, this.parseSize(size) / 2 + offset, transX, transY);
10333
10334
  }
10334
10335
  }
10335
10336
  var stroke$1 = new StrokeSymbol();
@@ -10351,10 +10352,10 @@ class WyeSymbol extends BaseSymbol {
10351
10352
  super(...arguments), this.type = "wye", this.pathStr = "M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z";
10352
10353
  }
10353
10354
  draw(ctx, size, transX, transY) {
10354
- return wye(ctx, size / 2, transX, transY);
10355
+ return wye(ctx, this.parseSize(size) / 2, transX, transY);
10355
10356
  }
10356
10357
  drawOffset(ctx, size, transX, transY, offset) {
10357
- return wye(ctx, size / 2 + offset, transX, transY);
10358
+ return wye(ctx, this.parseSize(size) / 2 + offset, transX, transY);
10358
10359
  }
10359
10360
  }
10360
10361
  var wye$1 = new WyeSymbol();
@@ -10367,10 +10368,10 @@ class TriangleLeftSymbol extends BaseSymbol {
10367
10368
  super(...arguments), this.type = "triangleLeft", this.pathStr = "M-0.5,0 L0.5,0.5 L0.5,-0.5 Z";
10368
10369
  }
10369
10370
  draw(ctx, size, x, y) {
10370
- return trianglLeftOffset(ctx, size / 2, x, y, 0);
10371
+ return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, 0);
10371
10372
  }
10372
10373
  drawOffset(ctx, size, x, y, offset) {
10373
- return trianglLeftOffset(ctx, size / 2, x, y, offset);
10374
+ return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, offset);
10374
10375
  }
10375
10376
  }
10376
10377
  var triangleLeft = new TriangleLeftSymbol();
@@ -10384,10 +10385,10 @@ class TriangleRightSymbol extends BaseSymbol {
10384
10385
  super(...arguments), this.type = "triangleRight", this.pathStr = "M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z";
10385
10386
  }
10386
10387
  draw(ctx, size, x, y) {
10387
- return trianglRightOffset(ctx, size / 2, x, y);
10388
+ return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y);
10388
10389
  }
10389
10390
  drawOffset(ctx, size, x, y, offset) {
10390
- return trianglRightOffset(ctx, size / 2, x, y, offset);
10391
+ return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y, offset);
10391
10392
  }
10392
10393
  }
10393
10394
  var triangleRight = new TriangleRightSymbol();
@@ -10401,10 +10402,10 @@ class TriangleDownSymbol extends BaseSymbol {
10401
10402
  super(...arguments), this.type = "triangleDown", this.pathStr = "M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z";
10402
10403
  }
10403
10404
  draw(ctx, size, x, y) {
10404
- return trianglDownOffset(ctx, size / 2, x, y);
10405
+ return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y);
10405
10406
  }
10406
10407
  drawOffset(ctx, size, x, y, offset) {
10407
- return trianglDownOffset(ctx, size / 2, x, y, offset);
10408
+ return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y, offset);
10408
10409
  }
10409
10410
  }
10410
10411
  var triangleDown = new TriangleDownSymbol();
@@ -10419,10 +10420,10 @@ class ThinTriangleSymbol extends BaseSymbol {
10419
10420
  super(...arguments), this.type = "thinTriangle", this.pathStr = "M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z";
10420
10421
  }
10421
10422
  draw(ctx, size, x, y) {
10422
- return thinTriangle(ctx, size / 2 / sqrt3, x, y);
10423
+ return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3, x, y);
10423
10424
  }
10424
10425
  drawOffset(ctx, size, x, y, offset) {
10425
- return thinTriangle(ctx, size / 2 / sqrt3 + offset, x, y);
10426
+ return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3 + offset, x, y);
10426
10427
  }
10427
10428
  }
10428
10429
  var thinTriangle$1 = new ThinTriangleSymbol();
@@ -10436,10 +10437,10 @@ class Arrow2LeftSymbol extends BaseSymbol {
10436
10437
  super(...arguments), this.type = "arrow2Left", this.pathStr = "M 0.25 -0.5 L -0.25 0 l 0.25 0.5";
10437
10438
  }
10438
10439
  draw(ctx, size, transX, transY) {
10439
- return arrow2Left(ctx, size / 4, transX, transY);
10440
+ return arrow2Left(ctx, this.parseSize(size) / 4, transX, transY);
10440
10441
  }
10441
10442
  drawOffset(ctx, size, transX, transY, offset) {
10442
- return arrow2Left(ctx, size / 4 + offset, transX, transY);
10443
+ return arrow2Left(ctx, this.parseSize(size) / 4 + offset, transX, transY);
10443
10444
  }
10444
10445
  }
10445
10446
  var arrow2Left$1 = new Arrow2LeftSymbol();
@@ -10453,10 +10454,10 @@ class Arrow2RightSymbol extends BaseSymbol {
10453
10454
  super(...arguments), this.type = "arrow2Right", this.pathStr = "M -0.25 -0.5 l 0.25 0 l -0.25 0.5";
10454
10455
  }
10455
10456
  draw(ctx, size, transX, transY) {
10456
- return arrow2Right(ctx, size / 4, transX, transY);
10457
+ return arrow2Right(ctx, this.parseSize(size) / 4, transX, transY);
10457
10458
  }
10458
10459
  drawOffset(ctx, size, transX, transY, offset) {
10459
- return arrow2Right(ctx, size / 4 + offset, transX, transY);
10460
+ return arrow2Right(ctx, this.parseSize(size) / 4 + offset, transX, transY);
10460
10461
  }
10461
10462
  }
10462
10463
  var arrow2Right$1 = new Arrow2RightSymbol();
@@ -10470,10 +10471,10 @@ class Arrow2UpSymbol extends BaseSymbol {
10470
10471
  super(...arguments), this.type = "arrow2Up", this.pathStr = "M -0.5 0.25 L 0 -0.25 l 0.5 0.25";
10471
10472
  }
10472
10473
  draw(ctx, size, transX, transY) {
10473
- return arrow2Up(ctx, size / 4, transX, transY);
10474
+ return arrow2Up(ctx, this.parseSize(size) / 4, transX, transY);
10474
10475
  }
10475
10476
  drawOffset(ctx, size, transX, transY, offset) {
10476
- return arrow2Up(ctx, size / 4 + offset, transX, transY);
10477
+ return arrow2Up(ctx, this.parseSize(size) / 4 + offset, transX, transY);
10477
10478
  }
10478
10479
  }
10479
10480
  var arrow2Up$1 = new Arrow2UpSymbol();
@@ -10487,10 +10488,10 @@ class Arrow2DownSymbol extends BaseSymbol {
10487
10488
  super(...arguments), this.type = "arrow2Down", this.pathStr = "M -0.5 -0.25 L 0 0.25 l 0.5 -0.25";
10488
10489
  }
10489
10490
  draw(ctx, size, transX, transY) {
10490
- return arrow2Down(ctx, size / 4, transX, transY);
10491
+ return arrow2Down(ctx, this.parseSize(size) / 4, transX, transY);
10491
10492
  }
10492
10493
  drawOffset(ctx, size, transX, transY, offset) {
10493
- return arrow2Down(ctx, size / 4 + offset, transX, transY);
10494
+ return arrow2Down(ctx, this.parseSize(size) / 4 + offset, transX, transY);
10494
10495
  }
10495
10496
  }
10496
10497
  var arrow2Down$1 = new Arrow2DownSymbol();
@@ -10503,13 +10504,13 @@ class LineVSymbol extends BaseSymbol {
10503
10504
  super(...arguments), this.type = "lineV", this.pathStr = "M0,-0.5L0,0.5";
10504
10505
  }
10505
10506
  draw(ctx, size, x, y, z) {
10506
- return lineV(ctx, size / 2, x, y);
10507
+ return lineV(ctx, this.parseSize(size) / 2, x, y);
10507
10508
  }
10508
10509
  drawOffset(ctx, size, x, y, offset, z) {
10509
- return lineV(ctx, size / 2 + offset, x, y);
10510
+ return lineV(ctx, this.parseSize(size) / 2 + offset, x, y);
10510
10511
  }
10511
10512
  drawToSvgPath(size, x, y, z) {
10512
- const r = size / 2;
10513
+ const r = this.parseSize(size) / 2;
10513
10514
  return `M ${x}, ${y - r} L ${x},${y + r}`;
10514
10515
  }
10515
10516
  }
@@ -10523,13 +10524,13 @@ class LineHSymbol extends BaseSymbol {
10523
10524
  super(...arguments), this.type = "lineH", this.pathStr = "M-0.5,0L0.5,0";
10524
10525
  }
10525
10526
  draw(ctx, size, x, y, z) {
10526
- return lineH(ctx, size / 2, x, y);
10527
+ return lineH(ctx, this.parseSize(size) / 2, x, y);
10527
10528
  }
10528
10529
  drawOffset(ctx, size, x, y, offset, z) {
10529
- return lineH(ctx, size / 2 + offset, x, y);
10530
+ return lineH(ctx, this.parseSize(size) / 2 + offset, x, y);
10530
10531
  }
10531
10532
  drawToSvgPath(size, x, y, z) {
10532
- const r = size / 2;
10533
+ const r = this.parseSize(size) / 2;
10533
10534
  return `M ${x - r}, ${y} L ${x + r},${y}`;
10534
10535
  }
10535
10536
  }
@@ -10543,13 +10544,13 @@ class CloseSymbol extends BaseSymbol {
10543
10544
  super(...arguments), this.type = "close", this.pathStr = "M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5";
10544
10545
  }
10545
10546
  draw(ctx, size, x, y, z) {
10546
- return close(ctx, size / 2, x, y);
10547
+ return close(ctx, this.parseSize(size) / 2, x, y);
10547
10548
  }
10548
10549
  drawOffset(ctx, size, x, y, offset, z) {
10549
- return close(ctx, size / 2 + offset, x, y);
10550
+ return close(ctx, this.parseSize(size) / 2 + offset, x, y);
10550
10551
  }
10551
10552
  drawToSvgPath(size, x, y, z) {
10552
- const r = size / 2;
10553
+ const r = this.parseSize(size) / 2;
10553
10554
  return `M ${x - r}, ${y - r} L ${x + r},${y + r} M ${x + r}, ${y - r} L ${x - r},${y + r}`;
10554
10555
  }
10555
10556
  }
@@ -10583,15 +10584,18 @@ class CustomSymbolClass {
10583
10584
  this.pathStr = "", this.type = type, isArray(path) ? this.svgCache = path : this.path = path, this.isSvg = isSvg;
10584
10585
  }
10585
10586
  drawOffset(ctx, size, x, y, offset, z, cb) {
10586
- return this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
10587
+ return size = this.parseSize(size), this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
10587
10588
  ctx.beginPath(), renderCommandList(item.path.commandList, ctx, x, y, size, size), cb && cb(item.path, item.attribute);
10588
10589
  }), !1) : (renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset), !1);
10589
10590
  }
10590
10591
  draw(ctx, size, x, y, z, cb) {
10591
- return this.drawOffset(ctx, size, x, y, 0, z, cb);
10592
+ return size = this.parseSize(size), this.drawOffset(ctx, size, x, y, 0, z, cb);
10593
+ }
10594
+ parseSize(size) {
10595
+ return isNumber(size) ? size : Math.min(size[0], size[1]);
10592
10596
  }
10593
10597
  bounds(size, bounds) {
10594
- if (this.isSvg) {
10598
+ if (size = this.parseSize(size), this.isSvg) {
10595
10599
  if (!this.svgCache) return;
10596
10600
  return bounds.clear(), void this.svgCache.forEach(_ref => {
10597
10601
  let {
@@ -11095,7 +11099,11 @@ class Paragraph {
11095
11099
  case "sub":
11096
11100
  baseline += this.descent / 2;
11097
11101
  }
11098
- "vertical" === direction && (ctx.save(), ctx.rotateAbout(Math.PI / 2, left, baseline), ctx.translate(-this.heightOrigin || -this.lineHeight / 2, -this.descent / 2), ctx.translate(left, baseline), left = 0, baseline = 0), this.character.stroke && (applyStrokeStyle(ctx, this.character), ctx.strokeText(text, left, baseline)), applyFillStyle(ctx, this.character), this.character.fill && ctx.fillText(text, left, baseline), this.character.fill && ("boolean" == typeof this.character.lineThrough || "boolean" == typeof this.character.underline ? (this.character.underline && ctx.fillRect(left, 1 + baseline, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1), this.character.lineThrough && ctx.fillRect(left, 1 + baseline - this.ascent / 2, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1)) : "underline" === this.character.textDecoration ? ctx.fillRect(left, 1 + baseline, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1) : "line-through" === this.character.textDecoration && ctx.fillRect(left, 1 + baseline - this.ascent / 2, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1)), "vertical" === direction && ctx.restore();
11102
+ "vertical" === direction && (ctx.save(), ctx.rotateAbout(Math.PI / 2, left, baseline), ctx.translate(-this.heightOrigin || -this.lineHeight / 2, -this.descent / 2), ctx.translate(left, baseline), left = 0, baseline = 0);
11103
+ const {
11104
+ lineWidth = 1
11105
+ } = this.character;
11106
+ this.character.stroke && lineWidth && (applyStrokeStyle(ctx, this.character), ctx.strokeText(text, left, baseline)), applyFillStyle(ctx, this.character), this.character.fill && ctx.fillText(text, left, baseline), this.character.fill && ("boolean" == typeof this.character.lineThrough || "boolean" == typeof this.character.underline ? (this.character.underline && ctx.fillRect(left, 1 + baseline, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1), this.character.lineThrough && ctx.fillRect(left, 1 + baseline - this.ascent / 2, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1)) : "underline" === this.character.textDecoration ? ctx.fillRect(left, 1 + baseline, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1) : "line-through" === this.character.textDecoration && ctx.fillRect(left, 1 + baseline - this.ascent / 2, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1)), "vertical" === direction && ctx.restore();
11099
11107
  }
11100
11108
  getWidthWithEllips(direction) {
11101
11109
  let text = this.text;
@@ -13282,8 +13290,9 @@ class PickerBase {
13282
13290
  return this.canvasRenderer.drawShape(graphic, pickContext, x, y, {}, null, (context, arcAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, arcAttribute, themeAttribute) => {
13283
13291
  if (picked) return !0;
13284
13292
  const lineWidth = arcAttribute.lineWidth || themeAttribute.lineWidth,
13285
- pickStrokeBuffer = arcAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
13286
- return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
13293
+ pickStrokeBuffer = arcAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
13294
+ keepStrokeScale = arcAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
13295
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
13287
13296
  }), pickContext.highPerformanceRestore(), picked;
13288
13297
  }
13289
13298
  }
@@ -13505,8 +13514,9 @@ class RectPickerBase {
13505
13514
  if (!onlyTranslate || rect.shadowRoot || isNumber(cornerRadius, !0) && 0 !== cornerRadius || isArray(cornerRadius) && cornerRadius.some(num => 0 !== num)) picked = !1, this.canvasRenderer.drawShape(rect, pickContext, x, y, {}, null, (context, rectAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, rectAttribute, themeAttribute) => {
13506
13515
  if (picked) return !0;
13507
13516
  const lineWidth = rectAttribute.lineWidth || themeAttribute.lineWidth,
13508
- pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
13509
- return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
13517
+ pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
13518
+ keepStrokeScale = rectAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
13519
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
13510
13520
  });else {
13511
13521
  const {
13512
13522
  fill = rectAttribute.fill,
@@ -13685,8 +13695,9 @@ class BaseLinePicker extends BaseRender {
13685
13695
  return this.canvasRenderer.drawShape(graphic, pickContext, x, y, {}, null, context => !!picked || (picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked), (context, lineAttribute, themeAttribute) => {
13686
13696
  if (picked) return !0;
13687
13697
  const lineWidth = lineAttribute.lineWidth || themeAttribute.lineWidth,
13688
- pickStrokeBuffer = lineAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
13689
- return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
13698
+ pickStrokeBuffer = lineAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
13699
+ keepStrokeScale = lineAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
13700
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
13690
13701
  }), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
13691
13702
  }
13692
13703
  }
@@ -13821,8 +13832,9 @@ let DefaultCanvasSymbolPicker = class extends Base3dPicker {
13821
13832
  return this.canvasRenderer.drawShape(symbol, pickContext, x, y, {}, null, (context, symbolAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked), (context, symbolAttribute, themeAttribute) => {
13822
13833
  if (picked) return !0;
13823
13834
  const lineWidth = symbolAttribute.lineWidth || themeAttribute.lineWidth,
13824
- pickStrokeBuffer = symbolAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
13825
- return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
13835
+ pickStrokeBuffer = symbolAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
13836
+ keepStrokeScale = symbolAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
13837
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
13826
13838
  }), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
13827
13839
  }
13828
13840
  };
@@ -13916,8 +13928,10 @@ let DefaultCanvasTextPicker = class extends Base3dPicker {
13916
13928
  } = text.attribute,
13917
13929
  bounds = text.AABBBounds,
13918
13930
  height = bounds.height(),
13919
- width = bounds.width();
13920
- return context.rect(bounds.x1, bounds.y1, width, height, z), picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked;
13931
+ width = bounds.width(),
13932
+ offsetY = textLayoutOffsetY(textBaseline, height, fontSize),
13933
+ offsetX = textDrawOffsetX(textAlign, width);
13934
+ return context.rect(offsetX + x, offsetY + y, width, height, z), picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked;
13921
13935
  }, (context, symbolAttribute, themeAttribute) => picked), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
13922
13936
  }
13923
13937
  };
@@ -14467,6 +14481,288 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
14467
14481
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
14468
14482
  };
14469
14483
 
14484
+ var ScrollBarPlugin_1;
14485
+ let ScrollBarPlugin = ScrollBarPlugin_1 = class ScrollBarPlugin {
14486
+ constructor() {
14487
+ this.name = 'scrollbar';
14488
+ this.activeEvent = 'onRegister';
14489
+ this._uid = Generator.GenAutoIncrementId();
14490
+ this.key = this.name + this._uid;
14491
+ this.scroll = (e) => {
14492
+ var _a, _b;
14493
+ const graphic = e.target;
14494
+ const data = this.getScrollContainer(graphic);
14495
+ if (!data && !this.scrollContainer) {
14496
+ return;
14497
+ }
14498
+ if (!data && this.scrollContainer) {
14499
+ if (!this.scrollContainer.g.stage || this.scrollContainer.g.stage !== graphic.stage) {
14500
+ return;
14501
+ }
14502
+ const newScrollContainer = this.formatScrollContainer(this.scrollContainer.g);
14503
+ if (!newScrollContainer) {
14504
+ this.clearScrollbar(this.scrollContainer.g, 'all');
14505
+ return;
14506
+ }
14507
+ if (this.scrollContainer.showH && !newScrollContainer.showH) {
14508
+ this.clearScrollbar(this.scrollContainer.g, 'horizontal');
14509
+ }
14510
+ if (this.scrollContainer.showV && !newScrollContainer.showV) {
14511
+ this.clearScrollbar(this.scrollContainer.g, 'vertical');
14512
+ }
14513
+ this.scrollContainer = newScrollContainer;
14514
+ }
14515
+ else if (data && this.scrollContainer && data.g !== this.scrollContainer.g) {
14516
+ this.clearScrollbar(this.scrollContainer.g, 'all');
14517
+ }
14518
+ this.scrollContainer = data !== null && data !== void 0 ? data : this.scrollContainer;
14519
+ const scrollContainer = data.g;
14520
+ const { width, height, scrollX = 0, scrollY = 0 } = scrollContainer.attribute;
14521
+ let newScrollX = scrollX;
14522
+ let newScrollY = scrollY;
14523
+ let { showH, showV } = data;
14524
+ this.scrollContainerBounds = new Bounds().set(0, 0, scrollContainer.attribute.width, scrollContainer.attribute.height);
14525
+ if (showH && showH) {
14526
+ if (abs(e.deltaX) > abs(e.deltaY)) {
14527
+ showH = showH && true;
14528
+ showV = showV && false;
14529
+ }
14530
+ else {
14531
+ showH = showH && false;
14532
+ showV = showV && true;
14533
+ }
14534
+ }
14535
+ const childrenBounds = this.childrenBounds;
14536
+ childrenBounds.clear();
14537
+ childrenBounds.set(0, 0, scrollContainer.AABBBounds.width(), scrollContainer.AABBBounds.height());
14538
+ const scrollWidth = childrenBounds.width();
14539
+ const scrollHeight = childrenBounds.height();
14540
+ if (showH) {
14541
+ newScrollX = Math.max(Math.min(((_a = e.deltaX) !== null && _a !== void 0 ? _a : 0) - scrollX, scrollWidth - width), 0);
14542
+ }
14543
+ else {
14544
+ newScrollX = -scrollX;
14545
+ }
14546
+ if (showV) {
14547
+ newScrollY = Math.max(Math.min(((_b = e.deltaY) !== null && _b !== void 0 ? _b : 0) - scrollY, scrollHeight - height), 0);
14548
+ }
14549
+ else {
14550
+ newScrollY = -scrollY;
14551
+ }
14552
+ childrenBounds.translate(-newScrollX, -newScrollY);
14553
+ this.addOrUpdateScroll(showH, showV, scrollContainer.parent, scrollContainer);
14554
+ scrollContainer.setAttributes({
14555
+ scrollX: -newScrollX,
14556
+ scrollY: -newScrollY
14557
+ });
14558
+ };
14559
+ this.handleScrollBarChange = (params) => {
14560
+ if (!this.scrollContainer ||
14561
+ !this.scrollContainerBounds ||
14562
+ !this.childrenBounds ||
14563
+ !params ||
14564
+ !params.target ||
14565
+ !params.detail ||
14566
+ !params.detail.value) {
14567
+ return;
14568
+ }
14569
+ const scrollbar = params.target;
14570
+ const newRange = params.detail.value;
14571
+ if (scrollbar.attribute.direction === 'horizontal') {
14572
+ const scrollWidth = this.childrenBounds.width();
14573
+ this.scrollContainer.g.setAttributes({ scrollX: -newRange[0] * scrollWidth });
14574
+ }
14575
+ else {
14576
+ const scrollHeight = this.childrenBounds.height();
14577
+ this.scrollContainer.g.setAttributes({ scrollY: -newRange[0] * scrollHeight });
14578
+ }
14579
+ };
14580
+ }
14581
+ activate(context) {
14582
+ this.pluginService = context;
14583
+ const { stage } = this.pluginService;
14584
+ this.childrenBounds = new AABBBounds();
14585
+ stage.addEventListener('wheel', this.scroll);
14586
+ this.params = ScrollBarPlugin_1.defaultParams;
14587
+ }
14588
+ initEventOfScrollbar(scrollContainer, scrollbar, isHorozntal) {
14589
+ scrollContainer.addEventListener('pointerover', () => {
14590
+ scrollbar.setAttribute('visibleAll', true);
14591
+ });
14592
+ scrollContainer.addEventListener('pointermove', () => {
14593
+ scrollbar.setAttribute('visibleAll', true);
14594
+ });
14595
+ scrollContainer.addEventListener('pointerout', () => {
14596
+ scrollbar.setAttribute('visibleAll', false);
14597
+ });
14598
+ scrollbar.addEventListener('pointerover', () => {
14599
+ scrollbar.setAttribute('visibleAll', true);
14600
+ });
14601
+ scrollbar.addEventListener('pointerout', () => {
14602
+ scrollbar.setAttribute('visibleAll', true);
14603
+ });
14604
+ scrollbar.addEventListener('scrollUp', this.handleScrollBarChange);
14605
+ scrollbar.addEventListener(SCROLLBAR_EVENT, this.handleScrollBarChange);
14606
+ }
14607
+ addOrUpdateScroll(showH, showV, container, scrollContainer) {
14608
+ if (showH) {
14609
+ const { scrollBar: hScrollbar, isUpdate } = this.addOrUpdateHScroll(scrollContainer, container, true);
14610
+ if (!isUpdate) {
14611
+ this.initEventOfScrollbar(scrollContainer, hScrollbar, true);
14612
+ }
14613
+ }
14614
+ else {
14615
+ this.clearScrollbar(scrollContainer, 'horizontal');
14616
+ }
14617
+ if (showV) {
14618
+ const { scrollBar: vScrollbar, isUpdate } = this.addOrUpdateHScroll(scrollContainer, container, false);
14619
+ if (!isUpdate) {
14620
+ this.initEventOfScrollbar(scrollContainer, vScrollbar, false);
14621
+ }
14622
+ }
14623
+ else {
14624
+ this.clearScrollbar(scrollContainer, 'vertical');
14625
+ }
14626
+ }
14627
+ getDirection(isHorozntal) {
14628
+ return isHorozntal ? 'horizontal' : 'vertical';
14629
+ }
14630
+ addOrUpdateHScroll(scrollContainer, container, isHorozntal) {
14631
+ var _a;
14632
+ const direction = this.getDirection(isHorozntal);
14633
+ const name = `${(_a = scrollContainer.name) !== null && _a !== void 0 ? _a : scrollContainer._uid}_${this.getDirection(isHorozntal)}_${this.name}`;
14634
+ const scrollbars = container.children.filter((g) => g.name === name);
14635
+ let isUpdate = true;
14636
+ let scrollBar = scrollbars[0];
14637
+ const { y = 0, dy = 0, x = 0, dx = 0, height, width, zIndex = 0 } = this.scrollContainer.g.attribute;
14638
+ const attrs = {
14639
+ x: 0,
14640
+ y: 0,
14641
+ direction,
14642
+ zIndex: zIndex + 1,
14643
+ visibleAll: true,
14644
+ padding: [2, 0],
14645
+ railStyle: {
14646
+ fill: 'rgba(0, 0, 0, .1)'
14647
+ },
14648
+ range: [0, 0.05]
14649
+ };
14650
+ if (isHorozntal) {
14651
+ attrs.width = this.scrollContainerBounds.width();
14652
+ attrs.height = 12;
14653
+ }
14654
+ else {
14655
+ attrs.height = this.scrollContainerBounds.height();
14656
+ attrs.width = 12;
14657
+ }
14658
+ if (!scrollBar) {
14659
+ isUpdate = false;
14660
+ scrollBar = new ScrollBar(attrs);
14661
+ scrollBar.name = name;
14662
+ container.add(scrollBar);
14663
+ scrollBar.isScrollBar = true;
14664
+ }
14665
+ else if (scrollbars.length > 1) {
14666
+ scrollbars.forEach((child, index) => {
14667
+ var _a;
14668
+ if (index) {
14669
+ (_a = child.parent) === null || _a === void 0 ? void 0 : _a.removeChild(child);
14670
+ }
14671
+ });
14672
+ }
14673
+ const childrenBounds = this.childrenBounds;
14674
+ if (isHorozntal) {
14675
+ const ratio = Math.min(this.scrollContainerBounds.width() / childrenBounds.width(), 1);
14676
+ const start = Math.max(Math.min(this.childrenBounds.x1 / this.childrenBounds.width(), 0), ratio - 1);
14677
+ attrs.x = x + dx;
14678
+ attrs.y = y + dy + height - this.scrollContainerBounds.height();
14679
+ attrs.range = [-start, -start + ratio];
14680
+ }
14681
+ else {
14682
+ const ratio = Math.min(this.scrollContainerBounds.height() / childrenBounds.height(), 1);
14683
+ const start = Math.max(Math.min(this.childrenBounds.y1 / this.childrenBounds.height(), 0), ratio - 1);
14684
+ attrs.x = x + dx + width - this.scrollContainerBounds.width();
14685
+ attrs.y = y + dy;
14686
+ attrs.range = [-start, -start + ratio];
14687
+ }
14688
+ scrollBar.setAttributes(attrs);
14689
+ return {
14690
+ scrollBar,
14691
+ isUpdate
14692
+ };
14693
+ }
14694
+ clearScrollbar(scrollContainer, type) {
14695
+ if (!scrollContainer.parent) {
14696
+ return;
14697
+ }
14698
+ const scrollbarBars = scrollContainer.parent.children.filter((child) => {
14699
+ return child.isScrollBar && (type === 'all' || child.attribute.direction === type);
14700
+ });
14701
+ scrollbarBars.forEach((child) => {
14702
+ child.parent.removeChild(child);
14703
+ });
14704
+ }
14705
+ formatScrollContainer(g) {
14706
+ if (!g || g.type !== 'group' || !g.attribute) {
14707
+ return null;
14708
+ }
14709
+ const { overflow, width, height } = g.attribute;
14710
+ if (!overflow || overflow === 'hidden') {
14711
+ return null;
14712
+ }
14713
+ let showH = false;
14714
+ let showV = false;
14715
+ if (overflow === 'scroll') {
14716
+ showH = true;
14717
+ showV = true;
14718
+ }
14719
+ else {
14720
+ showH = overflow === 'scroll-x';
14721
+ showV = !showH;
14722
+ }
14723
+ if (!g.AABBBounds.empty()) {
14724
+ if (showH) {
14725
+ showH = width < g.AABBBounds.width();
14726
+ }
14727
+ if (showV) {
14728
+ showV = height < g.AABBBounds.height();
14729
+ }
14730
+ }
14731
+ return showH || showV ? { g: g, showH, showV } : null;
14732
+ }
14733
+ getScrollContainer(graphic) {
14734
+ let g = graphic;
14735
+ while (g) {
14736
+ const res = this.formatScrollContainer(g);
14737
+ if (res) {
14738
+ return res;
14739
+ }
14740
+ g = g.parent;
14741
+ }
14742
+ return null;
14743
+ }
14744
+ deactivate(context) {
14745
+ const { stage } = this.pluginService;
14746
+ stage.removeEventListener('wheel', this.scroll);
14747
+ }
14748
+ };
14749
+ ScrollBarPlugin.defaultParams = {
14750
+ timeout: 500
14751
+ };
14752
+ ScrollBarPlugin = ScrollBarPlugin_1 = __decorate([
14753
+ injectable()
14754
+ ], ScrollBarPlugin);
14755
+
14756
+ const scrollbarModule = new ContainerModule((bind, unbind, isBound, rebind) => {
14757
+ if (!isBound(ScrollBarPlugin)) {
14758
+ bind(ScrollBarPlugin).toSelf();
14759
+ bind(AutoEnablePlugins).toService(ScrollBarPlugin);
14760
+ }
14761
+ });
14762
+ function loadScrollbar() {
14763
+ container.load(scrollbarModule);
14764
+ }
14765
+
14470
14766
  function traverseGroup(group, cb) {
14471
14767
  group.forEachChildren(node => {
14472
14768
  const stopped = cb(node);
@@ -15924,24 +16220,29 @@ function defaultLabelPosition(type) {
15924
16220
  return DefaultPositions;
15925
16221
  }
15926
16222
  }
15927
- function clampText(text, width, height) {
16223
+ function clampText(text, width, height, padding = {}) {
15928
16224
  const { x1, x2, y1, y2 } = text.AABBBounds;
16225
+ const { top = 0, left = 0, right = 0, bottom = 0 } = padding;
15929
16226
  const minX = Math.min(x1, x2);
15930
16227
  const maxX = Math.max(x1, x2);
15931
16228
  const minY = Math.min(y1, y2);
15932
16229
  const maxY = Math.max(y1, y2);
16230
+ const minXWithPadding = 0 - left;
16231
+ const maxXWithPadding = width + right;
16232
+ const minYWithPadding = 0 - top;
16233
+ const maxYWithPadding = height + bottom;
15933
16234
  let dx = 0;
15934
16235
  let dy = 0;
15935
- if (minX < 0 && maxX - minX <= width) {
16236
+ if (minX < minXWithPadding && maxX - minX <= width) {
15936
16237
  dx = -minX;
15937
16238
  }
15938
- else if (maxX > width && minX - (maxX - width) >= 0) {
16239
+ else if (maxX > maxXWithPadding && minX - (maxX - width) >= minXWithPadding) {
15939
16240
  dx = width - maxX;
15940
16241
  }
15941
- if (minY < 0 && maxY - minY <= height) {
16242
+ if (minY < minYWithPadding && maxY - minY <= height) {
15942
16243
  dy = -minY;
15943
16244
  }
15944
- else if (maxY > height && minY - (maxY - height) >= 0) {
16245
+ else if (maxY > maxYWithPadding && minY - (maxY - height) >= minYWithPadding) {
15945
16246
  dy = height - maxY;
15946
16247
  }
15947
16248
  return { dx, dy };
@@ -16241,56 +16542,121 @@ function loadLabelComponent() {
16241
16542
  registerLine();
16242
16543
  }
16243
16544
 
16244
- function shiftY(texts, option = {}) {
16245
- const { maxIterations = 10, maxError = 0.1, padding = 1, maxY = Number.MAX_VALUE } = option;
16545
+ const isIntersect = (top, bottom) => {
16546
+ return Math.ceil(top) > Math.floor(bottom);
16547
+ };
16548
+ const isXIntersect = ([a, b], [c, d]) => {
16549
+ return d > a && b > c;
16550
+ };
16551
+ function getIntersectionLength(range1, range2) {
16552
+ const [start1, end1] = range1;
16553
+ const [start2, end2] = range2;
16554
+ const start = Math.max(start1, start2);
16555
+ const end = Math.min(end1, end2);
16556
+ return Math.max(0, end - start);
16557
+ }
16558
+ function shiftY(texts, option) {
16559
+ const { maxIterations = 10, maxError = 0.1, padding = 1, maxY = Number.MAX_VALUE, labelling } = option;
16246
16560
  const n = texts.length;
16247
16561
  if (n <= 1) {
16248
16562
  return texts;
16249
16563
  }
16250
- const isIntersect = ([a, b], [c, d]) => {
16251
- return d > a && b > c;
16252
- };
16564
+ const xMap = new Map();
16253
16565
  const textInformation = new Map();
16254
- const getY0 = (text) => textInformation.get(text).y0;
16255
- const getY = (text) => textInformation.get(text).y;
16566
+ const getY1Initial = (text) => textInformation.get(text).y1Initial;
16256
16567
  const getHeight = (text) => textInformation.get(text).height;
16568
+ const getY1 = (text) => textInformation.get(text).y1;
16569
+ const getY = (text) => textInformation.get(text).y;
16570
+ const getX = (text) => textInformation.get(text).x;
16257
16571
  const getX1 = (text) => textInformation.get(text).x1;
16258
16572
  const getX2 = (text) => textInformation.get(text).x2;
16259
- const setY = (text, y) => {
16260
- textInformation.get(text).y = y;
16573
+ const setY1 = (text, y) => {
16574
+ textInformation.get(text).y1 = y;
16261
16575
  };
16576
+ function adjustPositionInOneGroup(texts) {
16577
+ if (texts.length === 1) {
16578
+ return;
16579
+ }
16580
+ for (let i = texts.length - 1; i > 0; i--) {
16581
+ const curText = texts[i];
16582
+ const upperText = texts[i - 1];
16583
+ const lowerText = texts[i + 1];
16584
+ if (isIntersect(getY1(upperText) + getHeight(upperText), getY1(curText))) {
16585
+ const { y } = labelling(curText);
16586
+ if (!lowerText || !isIntersect(y + getHeight(curText) / 2, getY1(lowerText))) {
16587
+ if (y + getHeight(curText) / 2 <= maxY) {
16588
+ setY1(curText, getY1(curText) + y - getY(curText));
16589
+ }
16590
+ }
16591
+ }
16592
+ }
16593
+ }
16594
+ texts.sort((a, b) => a.attribute.x - b.attribute.x);
16262
16595
  for (const text of texts) {
16263
16596
  const { y1, y2, x1, x2 } = text.AABBBounds;
16264
- textInformation.set(text, { y0: y1, y: y1, height: y2 - y1, x1, x2 });
16597
+ const { x, y } = text.attribute;
16598
+ textInformation.set(text, { y1Initial: y1, y1, y2, y, height: y2 - y1, x1, x2, x });
16599
+ let hasRange = false;
16600
+ for (const [range, xGroupTexts] of xMap) {
16601
+ const { start, end } = range;
16602
+ if (x1 >= start && x2 <= end) {
16603
+ xGroupTexts.push(text);
16604
+ hasRange = true;
16605
+ }
16606
+ else if (isNumberClose(x, getX(xGroupTexts[0]), undefined, 5)) {
16607
+ const newRange = { start: Math.min(start, x1), end: Math.max(end, x2) };
16608
+ xGroupTexts.push(text);
16609
+ xMap.set(newRange, xGroupTexts);
16610
+ xMap.delete(range);
16611
+ hasRange = true;
16612
+ }
16613
+ else if (getIntersectionLength([start, end], [x1, x2]) / (end - start) > 0.5) {
16614
+ const newRange = { start: Math.min(start, x1), end: Math.max(end, x2) };
16615
+ xGroupTexts.push(text);
16616
+ xMap.set(newRange, xGroupTexts);
16617
+ xMap.delete(range);
16618
+ hasRange = true;
16619
+ }
16620
+ if (hasRange) {
16621
+ break;
16622
+ }
16623
+ }
16624
+ if (!hasRange) {
16625
+ xMap.set({ start: x1, end: x2 }, [text]);
16626
+ }
16627
+ }
16628
+ for (const xTexts of xMap.values()) {
16629
+ xTexts.sort((a, b) => getY1Initial(a) - getY1Initial(b));
16630
+ adjustPositionInOneGroup(xTexts);
16265
16631
  }
16266
16632
  for (let iter = 0; iter < maxIterations; iter++) {
16267
- texts.sort((a, b) => getY(a) - getY(b));
16633
+ texts.sort((a, b) => getY1(a) - getY1(b));
16268
16634
  let error = 0;
16269
16635
  for (let i = 0; i < n - 1; i++) {
16270
16636
  const curText = texts[i];
16271
16637
  let j = i + 1;
16272
16638
  let nextText;
16273
16639
  while ((nextText = texts[j]) &&
16274
- !isIntersect([getX1(curText), getX2(curText)], [getX1(nextText), getX2(nextText)])) {
16640
+ !isXIntersect([getX1(curText), getX2(curText)], [getX1(nextText), getX2(nextText)])) {
16275
16641
  j += 1;
16276
16642
  }
16277
16643
  if (nextText) {
16278
- const y0 = getY(curText);
16644
+ const y1 = getY1(curText);
16279
16645
  const h0 = getHeight(curText);
16280
- const y1 = getY(nextText);
16281
- const delta = y1 - (y0 + h0);
16646
+ const nextY1 = getY1(nextText);
16647
+ const delta = nextY1 - (y1 + h0);
16282
16648
  if (delta < padding) {
16283
16649
  const newDelta = (padding - delta) / 2;
16284
16650
  error = Math.max(error, newDelta);
16285
16651
  if (y1 + newDelta + getHeight(nextText) > maxY) {
16286
- setY(curText, y0 - (padding - delta));
16652
+ setY1(curText, y1 - (padding - delta));
16287
16653
  }
16288
- else if (y0 - newDelta < 0) {
16289
- setY(nextText, y1 + (padding - delta));
16654
+ else if (y1 - newDelta < 0) {
16655
+ setY1(nextText, nextY1 + (padding - delta));
16290
16656
  }
16291
16657
  else {
16292
- setY(curText, y0 - newDelta);
16293
- setY(nextText, y1 + newDelta);
16658
+ setY1(curText, y1 - newDelta);
16659
+ setY1(nextText, nextY1 + newDelta);
16294
16660
  }
16295
16661
  }
16296
16662
  }
@@ -16300,10 +16666,25 @@ function shiftY(texts, option = {}) {
16300
16666
  }
16301
16667
  }
16302
16668
  for (const text of texts) {
16303
- const finalY = text.attribute.y + getY(text) - getY0(text);
16669
+ const finalY = text.attribute.y + getY1(text) - getY1Initial(text);
16304
16670
  text.setAttribute('y', finalY);
16305
16671
  }
16306
- return texts;
16672
+ const result = [];
16673
+ texts.sort((a, b) => a.attribute.x - b.attribute.x);
16674
+ let start = 0;
16675
+ let end = texts.length - 1;
16676
+ while (start <= end) {
16677
+ if (start === end) {
16678
+ result.push(texts[start]);
16679
+ }
16680
+ else {
16681
+ result.push(texts[start]);
16682
+ result.push(texts[end]);
16683
+ }
16684
+ start++;
16685
+ end--;
16686
+ }
16687
+ return result;
16307
16688
  }
16308
16689
 
16309
16690
  loadLabelComponent();
@@ -16649,18 +17030,25 @@ class LabelBase extends AbstractComponent {
16649
17030
  if (clampForce) {
16650
17031
  for (let i = 0; i < result.length; i++) {
16651
17032
  const text = labels[i];
16652
- const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height);
17033
+ const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
16653
17034
  if (dx !== 0 || dy !== 0) {
16654
17035
  text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
17036
+ text._isClamped = true;
16655
17037
  }
16656
17038
  }
16657
17039
  }
16658
- result = shiftY(result, Object.assign({ maxY: bmpTool.height }, strategy));
17040
+ result = shiftY(result, Object.assign(Object.assign({ maxY: bmpTool.height }, strategy), { labelling: (text) => {
17041
+ const baseMark = this.getRelatedGraphic(text.attribute);
17042
+ const graphicBound = this._isCollectionBase
17043
+ ? this.getGraphicBounds(null, this._idToPoint.get(text.attribute.id))
17044
+ : this.getGraphicBounds(baseMark, text);
17045
+ return this.labeling(text.AABBBounds, graphicBound, 'bottom', this.attribute.offset);
17046
+ } }));
16659
17047
  for (let i = 0; i < result.length; i++) {
16660
17048
  const text = result[i];
16661
17049
  const bounds = text.AABBBounds;
16662
17050
  const range = boundToRange(bmpTool, bounds, true);
16663
- if (canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding)) {
17051
+ if (canPlace(bmpTool, bitmap, bounds, clampForce, text._isClamped ? 0 : overlapPadding)) {
16664
17052
  bitmap.setRange(range);
16665
17053
  }
16666
17054
  else {
@@ -16733,7 +17121,7 @@ class LabelBase extends AbstractComponent {
16733
17121
  }
16734
17122
  }
16735
17123
  if (!hasPlace && clampForce) {
16736
- const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height);
17124
+ const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
16737
17125
  if (dx === 0 && dy === 0) {
16738
17126
  if (canPlace(bmpTool, bitmap, text.AABBBounds)) {
16739
17127
  bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
@@ -17217,6 +17605,9 @@ class ArcLabel extends LabelBase {
17217
17605
  this._alignOffset = 0;
17218
17606
  }
17219
17607
  _overlapping(labels) {
17608
+ if (['inside', 'inside-center'].includes(this.attribute.position)) {
17609
+ return super._overlapping(labels);
17610
+ }
17220
17611
  return labels;
17221
17612
  }
17222
17613
  labeling(textBounds, graphicBounds, position = 'outside', offset = 0) {
@@ -29483,6 +29874,6 @@ EmptyTip.defaultAttributes = {
29483
29874
  }
29484
29875
  };
29485
29876
 
29486
- const version = "0.21.0-alpha.3";
29877
+ const version = "0.21.0-alpha.5";
29487
29878
 
29488
- export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
29879
+ export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, loadScrollbar, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, scrollbarModule, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };