@visactor/vrender-components 0.21.0-alpha.3 → 0.21.0-beta.0

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 +852 -390
  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 +8 -7
package/dist/index.es.js CHANGED
@@ -2009,7 +2009,6 @@ const DefaultStrokeStyle = Object.assign({
2009
2009
  const DefaultTextStyle = {
2010
2010
  text: "",
2011
2011
  maxLineWidth: 1 / 0,
2012
- maxWidth: 1 / 0,
2013
2012
  textAlign: "left",
2014
2013
  textBaseline: "alphabetic",
2015
2014
  fontSize: 16,
@@ -2087,7 +2086,8 @@ const DefaultAttribute = Object.assign(Object.assign(Object.assign({
2087
2086
  globalZIndex: 1,
2088
2087
  globalCompositeOperation: "",
2089
2088
  overflow: "hidden",
2090
- shadowPickMode: "graphic"
2089
+ shadowPickMode: "graphic",
2090
+ keepStrokeScale: !1
2091
2091
  }, DefaultDebugAttribute), DefaultStyle), DefaultTransform);
2092
2092
  const DefaultArcAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
2093
2093
  startAngle: 0,
@@ -2354,32 +2354,10 @@ let ATextMeasure = class {
2354
2354
  configure(service, env) {
2355
2355
  this.canvas = service.canvas, this.context = service.context, service.bindTextMeasure(this);
2356
2356
  }
2357
- _measureTextWithoutAlignBaseline(text, options, compatible) {
2357
+ measureTextWidth(text, options) {
2358
+ if (!this.context) return this.estimate(text, options).width;
2358
2359
  this.context.setTextStyleWithoutAlignBaseline(options);
2359
- const metrics = this.context.measureText(text);
2360
- return compatible ? this.compatibleMetrics(metrics, options) : metrics;
2361
- }
2362
- _measureTextWithAlignBaseline(text, options, compatible) {
2363
- this.context.setTextStyle(options);
2364
- const metrics = this.context.measureText(text);
2365
- return compatible ? this.compatibleMetrics(metrics, options) : metrics;
2366
- }
2367
- compatibleMetrics(metrics, options) {
2368
- if (null == metrics.actualBoundingBoxAscent || null == metrics.actualBoundingBoxDescent || null == metrics.fontBoundingBoxAscent || null == metrics.fontBoundingBoxDescent) {
2369
- const {
2370
- ascent: ascent,
2371
- descent: descent
2372
- } = this.measureTextBoundADscentEstimate(options);
2373
- metrics.actualBoundingBoxAscent = ascent, metrics.actualBoundingBoxDescent = descent, metrics.fontBoundingBoxAscent = ascent, metrics.fontBoundingBoxDescent = descent;
2374
- }
2375
- if (null == metrics.actualBoundingBoxLeft || null == metrics.actualBoundingBoxRight) {
2376
- const {
2377
- left: left,
2378
- right: right
2379
- } = this.measureTextBoundLeftRightEstimate(options);
2380
- metrics.actualBoundingBoxLeft = left, metrics.actualBoundingBoxRight = right;
2381
- }
2382
- return metrics;
2360
+ return this.context.measureText(text).width;
2383
2361
  }
2384
2362
  estimate(text, _ref) {
2385
2363
  let {
@@ -2393,85 +2371,19 @@ let ATextMeasure = class {
2393
2371
  height: fontSize
2394
2372
  };
2395
2373
  }
2396
- measureTextWidth(text, options, textMeasure) {
2397
- return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options)).width : this.estimate(text, options).width;
2398
- }
2399
- measureTextBoundsWidth(text, options, textMeasure) {
2400
- return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options)).width : this.estimate(text, options).width;
2401
- }
2402
- measureTextBoundsLeftRight(text, options, textMeasure) {
2403
- return this.context ? {
2404
- left: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).actualBoundingBoxLeft,
2405
- right: textMeasure.actualBoundingBoxRight
2406
- } : this.measureTextBoundLeftRightEstimate(options);
2407
- }
2408
- measureTextPixelHeight(text, options, textMeasure) {
2409
- var _a;
2410
- return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options, !0), Math.abs(textMeasure.actualBoundingBoxAscent - textMeasure.actualBoundingBoxDescent)) : null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
2411
- }
2412
- measureTextPixelADscent(text, options, textMeasure) {
2413
- return this.context ? {
2414
- ascent: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).actualBoundingBoxAscent,
2415
- descent: textMeasure.actualBoundingBoxDescent
2416
- } : this.measureTextBoundADscentEstimate(options);
2417
- }
2418
- measureTextBoundHieght(text, options, textMeasure) {
2419
- var _a;
2420
- return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options, !0), Math.abs(textMeasure.fontBoundingBoxAscent - textMeasure.fontBoundingBoxDescent)) : null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
2421
- }
2422
- measureTextBoundADscent(text, options, textMeasure) {
2423
- return this.context ? {
2424
- ascent: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).fontBoundingBoxAscent,
2425
- descent: textMeasure.fontBoundingBoxDescent
2426
- } : this.measureTextBoundADscentEstimate(options);
2427
- }
2428
- measureTextBoundADscentEstimate(options) {
2374
+ measureTextPixelHeight(text, options) {
2429
2375
  var _a;
2430
- const fontSize = null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize,
2431
- {
2432
- textBaseline: textBaseline
2433
- } = options;
2434
- return "bottom" === textBaseline ? {
2435
- ascent: fontSize,
2436
- descent: 0
2437
- } : "middle" === textBaseline ? {
2438
- ascent: fontSize / 2,
2439
- descent: fontSize / 2
2440
- } : "alphabetic" === textBaseline ? {
2441
- ascent: .79 * fontSize,
2442
- descent: .21 * fontSize
2443
- } : {
2444
- ascent: 0,
2445
- descent: fontSize
2446
- };
2376
+ if (!this.context) return null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
2377
+ this.context.setTextStyleWithoutAlignBaseline(options);
2378
+ const textMeasure = this.context.measureText(text);
2379
+ return Math.abs(textMeasure.actualBoundingBoxAscent - textMeasure.actualBoundingBoxDescent);
2447
2380
  }
2448
- measureTextBoundLeftRightEstimate(options) {
2381
+ measureTextBoundHieght(text, options) {
2449
2382
  var _a;
2450
- const fontSize = null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize,
2451
- {
2452
- textAlign: textAlign
2453
- } = options;
2454
- return "center" === textAlign ? {
2455
- left: fontSize / 2,
2456
- right: fontSize / 2
2457
- } : "right" === textAlign || "end" === textAlign ? {
2458
- left: fontSize,
2459
- right: 0
2460
- } : {
2461
- left: 0,
2462
- right: fontSize
2463
- };
2464
- }
2465
- measureTextPixelADscentAndWidth(text, options) {
2466
- if (!this.context) return Object.assign(Object.assign({}, this.measureTextBoundADscentEstimate(options)), {
2467
- width: this.estimate(text, options).width
2468
- });
2469
- const out = this._measureTextWithoutAlignBaseline(text, options, !0);
2470
- return {
2471
- ascent: out.actualBoundingBoxAscent,
2472
- descent: out.actualBoundingBoxDescent,
2473
- width: out.width
2474
- };
2383
+ if (!this.context) return null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
2384
+ this.context.setTextStyleWithoutAlignBaseline(options);
2385
+ const textMeasure = this.context.measureText(text);
2386
+ return Math.abs(textMeasure.fontBoundingBoxAscent - textMeasure.fontBoundingBoxDescent);
2475
2387
  }
2476
2388
  measureText(text, options) {
2477
2389
  return this.context ? (this.context.setTextStyleWithoutAlignBaseline(options), this.context.measureText(text)) : this.estimate(text, options);
@@ -7116,7 +7028,8 @@ class DefaultArcRenderContribution {
7116
7028
  x: originX = arcAttribute.x,
7117
7029
  y: originY = arcAttribute.y,
7118
7030
  scaleX = arcAttribute.scaleX,
7119
- scaleY = arcAttribute.scaleY
7031
+ scaleY = arcAttribute.scaleY,
7032
+ keepStrokeScale = arcAttribute.keepStrokeScale
7120
7033
  } = arc.attribute;
7121
7034
  let {
7122
7035
  innerRadius = arcAttribute.innerRadius,
@@ -7128,7 +7041,7 @@ class DefaultArcRenderContribution {
7128
7041
  {
7129
7042
  distance = arcAttribute[key].distance
7130
7043
  } = borderStyle,
7131
- d = getScaledStroke(context, distance, context.dpr),
7044
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
7132
7045
  deltaAngle = distance / outerRadius,
7133
7046
  sign = "outerBorder" === key ? 1 : -1;
7134
7047
  if (arc.setAttributes({
@@ -7173,14 +7086,15 @@ class DefaultCircleRenderContribution {
7173
7086
  x: originX = circleAttribute.x,
7174
7087
  y: originY = circleAttribute.y,
7175
7088
  scaleX = circleAttribute.scaleX,
7176
- scaleY = circleAttribute.scaleY
7089
+ scaleY = circleAttribute.scaleY,
7090
+ keepStrokeScale = circleAttribute.keepStrokeScale
7177
7091
  } = circle.attribute,
7178
7092
  renderBorder = (borderStyle, key) => {
7179
7093
  const doStroke = !(!borderStyle || !borderStyle.stroke),
7180
7094
  {
7181
7095
  distance = circleAttribute[key].distance
7182
7096
  } = borderStyle,
7183
- d = getScaledStroke(context, distance, context.dpr),
7097
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
7184
7098
  sign = "outerBorder" === key ? 1 : -1;
7185
7099
  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
7100
  const lastOpacity = circleAttribute[key].opacity;
@@ -7299,7 +7213,8 @@ class DefaultRectRenderContribution {
7299
7213
  scaleX = rectAttribute.scaleX,
7300
7214
  scaleY = rectAttribute.scaleY,
7301
7215
  x1: x1,
7302
- y1: y1
7216
+ y1: y1,
7217
+ keepStrokeScale = rectAttribute.keepStrokeScale
7303
7218
  } = rect.attribute;
7304
7219
  let {
7305
7220
  width: width,
@@ -7312,7 +7227,7 @@ class DefaultRectRenderContribution {
7312
7227
  {
7313
7228
  distance = rectAttribute[key].distance
7314
7229
  } = borderStyle,
7315
- d = getScaledStroke(context, distance, context.dpr),
7230
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
7316
7231
  nextX = x + sign * d,
7317
7232
  nextY = y + sign * d,
7318
7233
  dw = 2 * d;
@@ -7469,14 +7384,15 @@ class DefaultSymbolRenderContribution {
7469
7384
  x: originX = symbolAttribute.x,
7470
7385
  y: originY = symbolAttribute.y,
7471
7386
  scaleX = symbolAttribute.scaleX,
7472
- scaleY = symbolAttribute.scaleY
7387
+ scaleY = symbolAttribute.scaleY,
7388
+ keepStrokeScale = symbolAttribute.keepStrokeScale
7473
7389
  } = symbol.attribute,
7474
7390
  renderBorder = (borderStyle, key) => {
7475
7391
  const doStroke = !(!borderStyle || !borderStyle.stroke),
7476
7392
  {
7477
7393
  distance = symbolAttribute[key].distance
7478
7394
  } = borderStyle,
7479
- d = getScaledStroke(context, distance, context.dpr),
7395
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
7480
7396
  sign = "outerBorder" === key ? 1 : -1;
7481
7397
  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
7398
  const lastOpacity = symbolAttribute[key].opacity;
@@ -8783,50 +8699,77 @@ let DefaultCanvasTextRender = class extends BaseRender {
8783
8699
  }
8784
8700
  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());
8785
8701
  };
8786
- if (context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z), "horizontal" === direction) {
8787
- const {
8788
- multilineLayout: multilineLayout
8789
- } = text;
8790
- if (!multilineLayout) return void context.highPerformanceRestore();
8791
- const {
8792
- xOffset: xOffset,
8793
- yOffset: yOffset
8794
- } = multilineLayout.bbox;
8795
- doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
8796
- context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
8797
- }))), 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, {
8799
- width: line.width
8702
+ if (text.isMultiLine) {
8703
+ if (context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z), "horizontal" === direction) {
8704
+ const {
8705
+ multilineLayout: multilineLayout
8706
+ } = text;
8707
+ if (!multilineLayout) return void context.highPerformanceRestore();
8708
+ const {
8709
+ xOffset: xOffset,
8710
+ yOffset: yOffset
8711
+ } = multilineLayout.bbox;
8712
+ doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
8713
+ context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
8714
+ }))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
8715
+ 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, {
8716
+ width: line.width
8717
+ });
8718
+ })));
8719
+ } else {
8720
+ text.tryUpdateAABBBounds();
8721
+ const cache = text.cache,
8722
+ {
8723
+ verticalList: verticalList
8724
+ } = cache;
8725
+ context.textAlign = "left", context.textBaseline = "top";
8726
+ const totalHeight = lineHeight * verticalList.length;
8727
+ let totalW = 0;
8728
+ verticalList.forEach(verticalData => {
8729
+ const _w = verticalData.reduce((a, b) => a + (b.width || 0), 0);
8730
+ totalW = max(_w, totalW);
8731
+ });
8732
+ let offsetY = 0,
8733
+ offsetX = 0;
8734
+ "bottom" === textBaseline ? offsetX = -totalHeight : "middle" === textBaseline && (offsetX = -totalHeight / 2), "center" === textAlign ? offsetY -= totalW / 2 : "right" === textAlign && (offsetY -= totalW), verticalList.forEach((verticalData, i) => {
8735
+ const currentW = verticalData.reduce((a, b) => a + (b.width || 0), 0),
8736
+ dw = totalW - currentW;
8737
+ let currentOffsetY = offsetY;
8738
+ "center" === textAlign ? currentOffsetY += dw / 2 : "right" === textAlign && (currentOffsetY += dw), verticalData.forEach(item => {
8739
+ const {
8740
+ text: text,
8741
+ width: width,
8742
+ direction: direction
8743
+ } = item;
8744
+ drawText(text, totalHeight - (i + 1) * lineHeight + offsetX, currentOffsetY, direction), currentOffsetY += width;
8745
+ });
8800
8746
  });
8801
- })));
8747
+ }
8748
+ } else if ("horizontal" === direction) {
8749
+ context.setTextStyle(text.attribute, textAttribute, z);
8750
+ const t = text.clipedText;
8751
+ let dy = 0;
8752
+ lineHeight !== fontSize && ("top" === textBaseline ? dy = (lineHeight - fontSize) / 2 : "middle" === textBaseline || "bottom" === textBaseline && (dy = -(lineHeight - fontSize) / 2)), drawText(t, 0, dy, 0);
8802
8753
  } else {
8803
8754
  text.tryUpdateAABBBounds();
8804
- const cache = text.cache,
8805
- {
8755
+ const cache = text.cache;
8756
+ if (cache) {
8757
+ context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);
8758
+ const {
8806
8759
  verticalList: verticalList
8807
8760
  } = cache;
8808
- context.textAlign = "left", context.textBaseline = "top";
8809
- const totalHeight = lineHeight * verticalList.length;
8810
- let totalW = 0;
8811
- verticalList.forEach(verticalData => {
8812
- const _w = verticalData.reduce((a, b) => a + (b.width || 0), 0);
8813
- totalW = max(_w, totalW);
8814
- });
8815
- let offsetY = 0,
8816
- offsetX = 0;
8817
- "bottom" === textBaseline ? offsetX = -totalHeight : "middle" === textBaseline && (offsetX = -totalHeight / 2), "center" === textAlign ? offsetY -= totalW / 2 : "right" === textAlign && (offsetY -= totalW), verticalList.forEach((verticalData, i) => {
8818
- const currentW = verticalData.reduce((a, b) => a + (b.width || 0), 0),
8819
- dw = totalW - currentW;
8820
- let currentOffsetY = offsetY;
8821
- "center" === textAlign ? currentOffsetY += dw / 2 : "right" === textAlign && (currentOffsetY += dw), verticalData.forEach(item => {
8761
+ let offsetY = 0;
8762
+ const totalW = verticalList[0].reduce((a, b) => a + (b.width || 0), 0);
8763
+ let offsetX = 0;
8764
+ "bottom" === textBaseline ? offsetX = -lineHeight : "middle" === textBaseline && (offsetX = -lineHeight / 2), "center" === textAlign ? offsetY -= totalW / 2 : "right" === textAlign && (offsetY -= totalW), context.textAlign = "left", context.textBaseline = "top", verticalList[0].forEach(item => {
8822
8765
  const {
8823
8766
  text: text,
8824
8767
  width: width,
8825
8768
  direction: direction
8826
8769
  } = item;
8827
- drawText(text, totalHeight - (i + 1) * lineHeight + offsetX, currentOffsetY, direction), currentOffsetY += width;
8770
+ drawText(text, offsetX, offsetY, direction), offsetY += width;
8828
8771
  });
8829
- });
8772
+ }
8830
8773
  }
8831
8774
  transform3dMatrixToContextMatrix && this.restoreTransformUseContext2d(text, textAttribute, z, context), this.afterRenderStep(text, context, x, y, doFill, doStroke, fVisible, sVisible, textAttribute, drawContext, fillCb, strokeCb);
8832
8775
  }
@@ -9541,6 +9484,28 @@ class CanvasTextLayout {
9541
9484
  }
9542
9485
  return bbox.yOffset = "top" === textBaseline ? 0 : "middle" === textBaseline ? bbox.height / -2 : "alphabetic" === textBaseline ? -.79 * bbox.height : -bbox.height, bbox;
9543
9486
  }
9487
+ GetLayout(str, width, height, textAlign, textBaseline, lineHeight, suffix, wordBreak, suffixPosition) {
9488
+ const linesLayout = [],
9489
+ bboxWH = [width, height],
9490
+ bboxOffset = [0, 0];
9491
+ for (; str.length > 0;) {
9492
+ const {
9493
+ str: clipText
9494
+ } = this.textMeasure.clipTextWithSuffix(str, this.textOptions, width, suffix, wordBreak, suffixPosition);
9495
+ linesLayout.push({
9496
+ str: clipText,
9497
+ width: this.textMeasure.measureTextWidth(clipText, this.textOptions)
9498
+ }), str = str.substring(clipText.length);
9499
+ }
9500
+ "left" === textAlign || "start" === textAlign || ("center" === textAlign ? bboxOffset[0] = bboxWH[0] / -2 : "right" !== textAlign && "end" !== textAlign || (bboxOffset[0] = -bboxWH[0])), "top" === textBaseline || ("middle" === textBaseline ? bboxOffset[1] = bboxWH[1] / -2 : "bottom" === textBaseline && (bboxOffset[1] = -bboxWH[1]));
9501
+ const bbox = {
9502
+ xOffset: bboxOffset[0],
9503
+ yOffset: bboxOffset[1],
9504
+ width: bboxWH[0],
9505
+ height: bboxWH[1]
9506
+ };
9507
+ return this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
9508
+ }
9544
9509
  GetLayoutByLines(lines, textAlign, textBaseline, lineHeight) {
9545
9510
  let suffix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
9546
9511
  let wordBreak = arguments.length > 5 ? arguments[5] : undefined;
@@ -9551,29 +9516,18 @@ class CanvasTextLayout {
9551
9516
  bboxWH = [0, 0];
9552
9517
  if ("number" == typeof lineWidth && lineWidth !== 1 / 0) {
9553
9518
  let width;
9554
- for (let i = 0, len = lines.length; i < len; i++) {
9555
- const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions);
9556
- width = Math.min(metrics.width, lineWidth), linesLayout.push({
9557
- str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
9558
- width: width,
9559
- ascent: metrics.ascent,
9560
- descent: metrics.descent
9561
- });
9562
- }
9519
+ for (let i = 0, len = lines.length; i < len; i++) width = Math.min(this.textMeasure.measureTextWidth(lines[i], this.textOptions), lineWidth), linesLayout.push({
9520
+ str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
9521
+ width: width
9522
+ });
9563
9523
  bboxWH[0] = lineWidth;
9564
9524
  } else {
9565
9525
  let width, text;
9566
9526
  lineWidth = 0;
9567
- for (let i = 0, len = lines.length; i < len; i++) {
9568
- text = lines[i];
9569
- const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions);
9570
- width = metrics.width, lineWidth = Math.max(lineWidth, width), linesLayout.push({
9571
- str: text,
9572
- width: width,
9573
- ascent: metrics.ascent,
9574
- descent: metrics.descent
9575
- });
9576
- }
9527
+ for (let i = 0, len = lines.length; i < len; i++) text = lines[i], width = this.textMeasure.measureTextWidth(text, this.textOptions), lineWidth = Math.max(lineWidth, width), linesLayout.push({
9528
+ str: text,
9529
+ width: width
9530
+ });
9577
9531
  bboxWH[0] = lineWidth;
9578
9532
  }
9579
9533
  bboxWH[1] = linesLayout.length * lineHeight, bboxWH[0] = linesLayout.reduce((a, b) => Math.max(a, b.width), 0);
@@ -9602,11 +9556,11 @@ class CanvasTextLayout {
9602
9556
  };
9603
9557
  }
9604
9558
  lineOffset(bbox, line, textAlign, textBaseline, lineHeight, origin) {
9605
- return "left" === textAlign || "start" === textAlign ? line.leftOffset = 0 : "center" === textAlign ? line.leftOffset = (bbox.width - line.width) / 2 : "right" !== textAlign && "end" !== textAlign || (line.leftOffset = bbox.width - line.width), line.topOffset = lineHeight / 2 + (line.ascent - line.descent) / 2 + origin[1], origin[1] += lineHeight, line;
9559
+ return "left" === textAlign || "start" === textAlign ? line.leftOffset = 0 : "center" === textAlign ? line.leftOffset = (bbox.width - line.width) / 2 : "right" !== textAlign && "end" !== textAlign || (line.leftOffset = bbox.width - line.width), line.topOffset = (lineHeight - this.textOptions.fontSize) / 2 + .79 * this.textOptions.fontSize + origin[1], origin[1] += lineHeight, line;
9606
9560
  }
9607
9561
  }
9608
9562
 
9609
- const TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "maxWidth", "textAlign", "textBaseline", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", "heightLimit", "lineClamp", ...GRAPHIC_UPDATE_TAG_KEY];
9563
+ const TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "textAlign", "textBaseline", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", "heightLimit", "lineClamp", ...GRAPHIC_UPDATE_TAG_KEY];
9610
9564
  class Text extends Graphic {
9611
9565
  get font() {
9612
9566
  const textTheme = this.getGraphicTheme();
@@ -9615,22 +9569,26 @@ class Text extends Graphic {
9615
9569
  get clipedText() {
9616
9570
  var _a;
9617
9571
  const attribute = this.attribute,
9618
- textTheme = this.getGraphicTheme(),
9619
- maxWidth = this.getMaxWidth(textTheme);
9620
- return Number.isFinite(maxWidth) ? (this.tryUpdateAABBBounds(), this.cache.clipedText) : (null !== (_a = attribute.text) && void 0 !== _a ? _a : textTheme.text).toString();
9572
+ textTheme = this.getGraphicTheme();
9573
+ if (!this.isSimplify()) return;
9574
+ const {
9575
+ maxLineWidth = textTheme.maxLineWidth
9576
+ } = attribute;
9577
+ return Number.isFinite(maxLineWidth) ? (this.tryUpdateAABBBounds(), this.cache.clipedText) : (null !== (_a = attribute.text) && void 0 !== _a ? _a : textTheme.text).toString();
9621
9578
  }
9622
9579
  get clipedWidth() {
9623
- return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
9580
+ if (this.isSimplify()) return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
9624
9581
  }
9625
9582
  get cliped() {
9626
9583
  var _a, _b;
9627
9584
  const textTheme = this.getGraphicTheme(),
9628
9585
  attribute = this.attribute,
9629
- maxWidth = this.getMaxWidth(textTheme);
9630
- if (!Number.isFinite(maxWidth)) return !1;
9631
- const {
9632
- text: text
9633
- } = this.attribute;
9586
+ {
9587
+ maxLineWidth = textTheme.maxLineWidth,
9588
+ text: text,
9589
+ whiteSpace = textTheme.whiteSpace
9590
+ } = attribute;
9591
+ if (!Number.isFinite(maxLineWidth)) return !1;
9634
9592
  if (this.tryUpdateAABBBounds(), null === (_b = null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData) || void 0 === _b ? void 0 : _b.lines) {
9635
9593
  let mergedText = "";
9636
9594
  this.cache.layoutData.lines.forEach(item => {
@@ -9641,7 +9599,10 @@ class Text extends Graphic {
9641
9599
  return "vertical" === attribute.direction && this.cache.verticalList && this.cache.verticalList[0] ? this.cache.verticalList[0].map(item => item.text).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString();
9642
9600
  }
9643
9601
  get multilineLayout() {
9644
- return this.tryUpdateAABBBounds(), this.cache.layoutData;
9602
+ if (this.isMultiLine) return this.tryUpdateAABBBounds(), this.cache.layoutData;
9603
+ }
9604
+ isSimplify() {
9605
+ return !this.isMultiLine && "vertical" !== this.attribute.direction;
9645
9606
  }
9646
9607
  get isMultiLine() {
9647
9608
  return Array.isArray(this.attribute.text) || "normal" === this.attribute.whiteSpace;
@@ -9714,63 +9675,8 @@ class Text extends Graphic {
9714
9675
  }
9715
9676
  return application.graphicService.combindShadowAABBBounds(aabbBounds, this), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds), transformBoundsWithMatrix(aabbBounds, aabbBounds, this.transMatrix), aabbBounds;
9716
9677
  }
9717
- updateSingallineAABBBounds(text) {
9718
- this.updateMultilineAABBBounds([text]);
9719
- const layoutData = this.cache.layoutData;
9720
- if (layoutData) {
9721
- const line = layoutData.lines[0];
9722
- this.cache.clipedText = line.str, this.cache.clipedWidth = line.width;
9723
- }
9724
- return this._AABBBounds;
9725
- }
9726
- updateMultilineAABBBounds(text) {
9727
- const textTheme = this.getGraphicTheme(),
9728
- {
9729
- direction = textTheme.direction,
9730
- underlineOffset = textTheme.underlineOffset
9731
- } = this.attribute,
9732
- b = "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
9733
- return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
9734
- }
9735
- updateHorizontalMultilineAABBBounds(text) {
9736
- var _a;
9737
- const textTheme = this.getGraphicTheme(),
9738
- attribute = this.attribute,
9739
- {
9740
- fontFamily = textTheme.fontFamily,
9741
- textAlign = textTheme.textAlign,
9742
- textBaseline = textTheme.textBaseline,
9743
- fontSize = textTheme.fontSize,
9744
- fontWeight = textTheme.fontWeight,
9745
- ellipsis = textTheme.ellipsis,
9746
- maxLineWidth: maxLineWidth,
9747
- stroke = textTheme.stroke,
9748
- wrap = textTheme.wrap,
9749
- ignoreBuf = textTheme.ignoreBuf,
9750
- lineWidth = textTheme.lineWidth,
9751
- whiteSpace = textTheme.whiteSpace,
9752
- suffixPosition = textTheme.suffixPosition
9753
- } = attribute,
9754
- buf = ignoreBuf ? 0 : 2,
9755
- lineHeight = this.getLineHeight(attribute, textTheme) + buf;
9756
- if ("normal" === whiteSpace || wrap) return this.updateWrapAABBBounds(text);
9757
- if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
9758
- const bbox = this.cache.layoutData.bbox;
9759
- return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
9760
- }
9761
- const textMeasure = application.graphicUtil.textMeasure,
9762
- layoutData = new CanvasTextLayout(fontFamily, {
9763
- fontSize: fontSize,
9764
- fontWeight: fontWeight,
9765
- fontFamily: fontFamily
9766
- }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, maxLineWidth, suffixPosition),
9767
- {
9768
- bbox: bbox
9769
- } = layoutData;
9770
- return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
9771
- }
9772
9678
  updateWrapAABBBounds(text) {
9773
- var _a, _b, _c;
9679
+ var _a, _b, _c, _d;
9774
9680
  const textTheme = this.getGraphicTheme(),
9775
9681
  {
9776
9682
  fontFamily = textTheme.fontFamily,
@@ -9788,19 +9694,18 @@ class Text extends Graphic {
9788
9694
  heightLimit = 0,
9789
9695
  lineClamp: lineClamp
9790
9696
  } = this.attribute,
9791
- buf = ignoreBuf ? 0 : 2,
9792
- lineHeight = this.getLineHeight(this.attribute, textTheme) + buf;
9793
- if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
9697
+ lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
9698
+ buf = ignoreBuf ? 0 : 2;
9699
+ if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
9794
9700
  const bbox = this.cache.layoutData.bbox;
9795
9701
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
9796
9702
  }
9797
9703
  const textMeasure = application.graphicUtil.textMeasure,
9798
- textOptions = {
9704
+ layoutObj = new CanvasTextLayout(fontFamily, {
9799
9705
  fontSize: fontSize,
9800
9706
  fontWeight: fontWeight,
9801
9707
  fontFamily: fontFamily
9802
- },
9803
- layoutObj = new CanvasTextLayout(fontFamily, textOptions, textMeasure),
9708
+ }, textMeasure),
9804
9709
  lines = isArray(text) ? text.map(l => l.toString()) : [text.toString()],
9805
9710
  linesLayout = [],
9806
9711
  bboxWH = [0, 0];
@@ -9810,33 +9715,29 @@ class Text extends Graphic {
9810
9715
  const str = lines[i];
9811
9716
  let needCut = !0;
9812
9717
  if (i === lineCountLimit - 1) {
9813
- const clip = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1),
9814
- matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);
9718
+ const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1);
9815
9719
  linesLayout.push({
9816
9720
  str: clip.str,
9817
- width: clip.width,
9818
- ascent: matrics.ascent,
9819
- descent: matrics.descent
9721
+ width: clip.width
9820
9722
  });
9821
9723
  break;
9822
9724
  }
9823
- const clip = textMeasure.clipText(str, textOptions, maxLineWidth, "break-word" === wordBreak);
9824
- if ("" !== str && "" === clip.str) {
9725
+ const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, "break-all" !== wordBreak, "keep-all" === wordBreak);
9726
+ if ("" !== str && "" === clip.str || clip.wordBreaked) {
9825
9727
  if (ellipsis) {
9826
- const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
9827
- clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
9728
+ const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
9729
+ clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
9828
9730
  } else clip.str = "", clip.width = 0;
9829
9731
  needCut = !1;
9830
9732
  }
9831
- const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);
9832
- if (linesLayout.push({
9733
+ linesLayout.push({
9833
9734
  str: clip.str,
9834
- width: clip.width,
9835
- ascent: matrics.ascent,
9836
- descent: matrics.descent
9837
- }), clip.str.length === str.length) ;else if (needCut) {
9838
- const newStr = str.substring(clip.str.length);
9839
- lines.splice(i + 1, 0, newStr);
9735
+ width: clip.width
9736
+ });
9737
+ let cutLength = clip.str.length;
9738
+ if (!clip.wordBreaked || "" !== str && "" === clip.str || (needCut = !0, cutLength = clip.wordBreaked), clip.str.length === str.length) ;else if (needCut) {
9739
+ let newStr = str.substring(cutLength);
9740
+ "keep-all" === wordBreak && (newStr = newStr.replace(/^\s+/g, "")), lines.splice(i + 1, 0, newStr);
9840
9741
  }
9841
9742
  }
9842
9743
  let maxWidth = 0;
@@ -9849,28 +9750,21 @@ class Text extends Graphic {
9849
9750
  lineWidth = 0;
9850
9751
  for (let i = 0, len = lines.length; i < len; i++) {
9851
9752
  if (i === lineCountLimit - 1) {
9852
- const clip = textMeasure.clipTextWithSuffix(lines[i], textOptions, maxLineWidth, ellipsis, !1, suffixPosition),
9853
- matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);
9753
+ const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
9854
9754
  linesLayout.push({
9855
9755
  str: clip.str,
9856
- width: clip.width,
9857
- ascent: matrics.ascent,
9858
- descent: matrics.descent
9756
+ width: clip.width
9859
9757
  }), lineWidth = Math.max(lineWidth, clip.width);
9860
9758
  break;
9861
9759
  }
9862
- text = lines[i], width = textMeasure.measureTextWidth(text, textOptions), lineWidth = Math.max(lineWidth, width);
9863
- const matrics = textMeasure.measureTextPixelADscentAndWidth(text, textOptions);
9864
- linesLayout.push({
9760
+ text = lines[i], width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, "break-word" === wordBreak), lineWidth = Math.max(lineWidth, width), linesLayout.push({
9865
9761
  str: text,
9866
- width: width,
9867
- ascent: matrics.ascent,
9868
- descent: matrics.descent
9762
+ width: width
9869
9763
  });
9870
9764
  }
9871
9765
  bboxWH[0] = lineWidth;
9872
9766
  }
9873
- bboxWH[1] = linesLayout.length * lineHeight;
9767
+ bboxWH[1] = linesLayout.length * (lineHeight + buf);
9874
9768
  const bbox = {
9875
9769
  xOffset: 0,
9876
9770
  yOffset: 0,
@@ -9881,12 +9775,210 @@ class Text extends Graphic {
9881
9775
  const layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
9882
9776
  return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
9883
9777
  }
9884
- updateVerticalMultilineAABBBounds(text) {
9778
+ updateSingallineAABBBounds(text) {
9779
+ const textTheme = this.getGraphicTheme(),
9780
+ {
9781
+ direction = textTheme.direction,
9782
+ underlineOffset = textTheme.underlineOffset
9783
+ } = this.attribute,
9784
+ b = "horizontal" === direction ? this.updateHorizontalSinglelineAABBBounds(text) : this.updateVerticalSinglelineAABBBounds(text);
9785
+ return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
9786
+ }
9787
+ updateMultilineAABBBounds(text) {
9788
+ const textTheme = this.getGraphicTheme(),
9789
+ {
9790
+ direction = textTheme.direction,
9791
+ underlineOffset = textTheme.underlineOffset
9792
+ } = this.attribute,
9793
+ b = "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
9794
+ return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
9795
+ }
9796
+ updateHorizontalSinglelineAABBBounds(text) {
9797
+ var _a, _b;
9798
+ const textTheme = this.getGraphicTheme(),
9799
+ {
9800
+ wrap = textTheme.wrap
9801
+ } = this.attribute;
9802
+ if (wrap) return this.updateWrapAABBBounds([text]);
9803
+ const textMeasure = application.graphicUtil.textMeasure;
9804
+ let width, str;
9805
+ const attribute = this.attribute,
9806
+ {
9807
+ maxLineWidth = textTheme.maxLineWidth,
9808
+ ellipsis = textTheme.ellipsis,
9809
+ textAlign = textTheme.textAlign,
9810
+ textBaseline = textTheme.textBaseline,
9811
+ fontFamily = textTheme.fontFamily,
9812
+ fontSize = textTheme.fontSize,
9813
+ fontWeight = textTheme.fontWeight,
9814
+ stroke = textTheme.stroke,
9815
+ lineWidth = textTheme.lineWidth,
9816
+ ignoreBuf = textTheme.ignoreBuf,
9817
+ whiteSpace = textTheme.whiteSpace,
9818
+ suffixPosition = textTheme.suffixPosition
9819
+ } = attribute;
9820
+ if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
9821
+ const buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
9822
+ textFontSize = attribute.fontSize || textTheme.fontSize,
9823
+ lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) && void 0 !== _a ? _a : textFontSize + buf;
9824
+ if (!this.shouldUpdateShape() && this.cache) {
9825
+ width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
9826
+ const dx = textDrawOffsetX(textAlign, width),
9827
+ dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
9828
+ return this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
9829
+ }
9830
+ if (Number.isFinite(maxLineWidth)) {
9831
+ if (ellipsis) {
9832
+ const strEllipsis = !0 === ellipsis ? textTheme.ellipsis : ellipsis,
9833
+ data = textMeasure.clipTextWithSuffix(text.toString(), {
9834
+ fontSize: fontSize,
9835
+ fontWeight: fontWeight,
9836
+ fontFamily: fontFamily
9837
+ }, maxLineWidth, strEllipsis, !1, suffixPosition);
9838
+ str = data.str, width = data.width;
9839
+ } else {
9840
+ const data = textMeasure.clipText(text.toString(), {
9841
+ fontSize: fontSize,
9842
+ fontWeight: fontWeight,
9843
+ fontFamily: fontFamily
9844
+ }, maxLineWidth, !1);
9845
+ str = data.str, width = data.width;
9846
+ }
9847
+ this.cache.clipedText = str, this.cache.clipedWidth = width;
9848
+ } else width = textMeasure.measureTextWidth(text.toString(), {
9849
+ fontSize: fontSize,
9850
+ fontWeight: fontWeight,
9851
+ fontFamily: fontFamily
9852
+ }), this.cache.clipedText = text.toString(), this.cache.clipedWidth = width;
9853
+ this.clearUpdateShapeTag();
9854
+ const dx = textDrawOffsetX(textAlign, width);
9855
+ let lh = lineHeight;
9856
+ application.global && application.global.isSafari() && (lh += .2 * fontSize);
9857
+ const dy = textLayoutOffsetY(textBaseline, lh, fontSize, buf);
9858
+ return this._AABBBounds.set(dx, dy, dx + width, dy + lh), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
9859
+ }
9860
+ getBaselineMapAlign() {
9861
+ return Text.baselineMapAlign;
9862
+ }
9863
+ getAlignMapBaseline() {
9864
+ return Text.alignMapBaseline;
9865
+ }
9866
+ updateVerticalSinglelineAABBBounds(text) {
9867
+ var _a, _b, _c;
9868
+ const textTheme = this.getGraphicTheme(),
9869
+ textMeasure = application.graphicUtil.textMeasure;
9870
+ let width;
9871
+ const attribute = this.attribute,
9872
+ {
9873
+ ignoreBuf = textTheme.ignoreBuf
9874
+ } = attribute,
9875
+ buf = ignoreBuf ? 0 : 2,
9876
+ {
9877
+ maxLineWidth = textTheme.maxLineWidth,
9878
+ ellipsis = textTheme.ellipsis,
9879
+ fontSize = textTheme.fontSize,
9880
+ fontWeight = textTheme.fontWeight,
9881
+ fontFamily = textTheme.fontFamily,
9882
+ stroke = textTheme.stroke,
9883
+ lineWidth = textTheme.lineWidth,
9884
+ verticalMode = textTheme.verticalMode,
9885
+ suffixPosition = textTheme.suffixPosition
9886
+ } = attribute,
9887
+ lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
9888
+ let {
9889
+ textAlign = textTheme.textAlign,
9890
+ textBaseline = textTheme.textBaseline
9891
+ } = attribute;
9892
+ if (!verticalMode) {
9893
+ const t = textAlign;
9894
+ textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
9895
+ }
9896
+ if (!this.shouldUpdateShape() && this.cache) {
9897
+ width = this.cache.clipedWidth;
9898
+ const dx = textDrawOffsetX(textAlign, width),
9899
+ dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
9900
+ return this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
9901
+ }
9902
+ let verticalList = [verticalLayout(text.toString())];
9903
+ if (Number.isFinite(maxLineWidth)) {
9904
+ if (ellipsis) {
9905
+ const strEllipsis = !0 === ellipsis ? textTheme.ellipsis : ellipsis,
9906
+ data = textMeasure.clipTextWithSuffixVertical(verticalList[0], {
9907
+ fontSize: fontSize,
9908
+ fontWeight: fontWeight,
9909
+ fontFamily: fontFamily
9910
+ }, maxLineWidth, strEllipsis, !1, suffixPosition);
9911
+ verticalList = [data.verticalList], width = data.width;
9912
+ } else {
9913
+ const data = textMeasure.clipTextVertical(verticalList[0], {
9914
+ fontSize: fontSize,
9915
+ fontWeight: fontWeight,
9916
+ fontFamily: fontFamily
9917
+ }, maxLineWidth, !1);
9918
+ verticalList = [data.verticalList], width = data.width;
9919
+ }
9920
+ this.cache.verticalList = verticalList, this.cache.clipedWidth = width;
9921
+ } else width = 0, verticalList[0].forEach(t => {
9922
+ const w = t.direction === TextDirection.HORIZONTAL ? fontSize : textMeasure.measureTextWidth(t.text, {
9923
+ fontSize: fontSize,
9924
+ fontWeight: fontWeight,
9925
+ fontFamily: fontFamily
9926
+ });
9927
+ width += w, t.width = w;
9928
+ }), this.cache.verticalList = verticalList, this.cache.clipedWidth = width;
9929
+ this.clearUpdateShapeTag();
9930
+ const dx = textDrawOffsetX(textAlign, width),
9931
+ dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
9932
+ return this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
9933
+ }
9934
+ updateHorizontalMultilineAABBBounds(text) {
9885
9935
  var _a, _b;
9936
+ const textTheme = this.getGraphicTheme(),
9937
+ {
9938
+ wrap = textTheme.wrap
9939
+ } = this.attribute;
9940
+ if (wrap) return this.updateWrapAABBBounds(text);
9941
+ const attribute = this.attribute,
9942
+ {
9943
+ fontFamily = textTheme.fontFamily,
9944
+ textAlign = textTheme.textAlign,
9945
+ textBaseline = textTheme.textBaseline,
9946
+ fontSize = textTheme.fontSize,
9947
+ fontWeight = textTheme.fontWeight,
9948
+ ellipsis = textTheme.ellipsis,
9949
+ maxLineWidth: maxLineWidth,
9950
+ stroke = textTheme.stroke,
9951
+ lineWidth = textTheme.lineWidth,
9952
+ whiteSpace = textTheme.whiteSpace,
9953
+ suffixPosition = textTheme.suffixPosition
9954
+ } = attribute,
9955
+ lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
9956
+ if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
9957
+ if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
9958
+ const bbox = this.cache.layoutData.bbox;
9959
+ return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
9960
+ }
9961
+ const textMeasure = application.graphicUtil.textMeasure,
9962
+ layoutData = new CanvasTextLayout(fontFamily, {
9963
+ fontSize: fontSize,
9964
+ fontWeight: fontWeight,
9965
+ fontFamily: fontFamily
9966
+ }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, maxLineWidth, suffixPosition),
9967
+ {
9968
+ bbox: bbox
9969
+ } = layoutData;
9970
+ return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
9971
+ }
9972
+ updateVerticalMultilineAABBBounds(text) {
9973
+ var _a, _b, _c;
9886
9974
  const textTheme = this.getGraphicTheme(),
9887
9975
  textMeasure = application.graphicUtil.textMeasure;
9888
9976
  let width;
9889
9977
  const attribute = this.attribute,
9978
+ {
9979
+ ignoreBuf = textTheme.ignoreBuf
9980
+ } = attribute,
9981
+ buf = ignoreBuf ? 0 : 2,
9890
9982
  {
9891
9983
  maxLineWidth = textTheme.maxLineWidth,
9892
9984
  ellipsis = textTheme.ellipsis,
@@ -9898,14 +9990,14 @@ class Text extends Graphic {
9898
9990
  verticalMode = textTheme.verticalMode,
9899
9991
  suffixPosition = textTheme.suffixPosition
9900
9992
  } = attribute,
9901
- lineHeight = this.getLineHeight(attribute, textTheme);
9993
+ lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
9902
9994
  let {
9903
9995
  textAlign = textTheme.textAlign,
9904
9996
  textBaseline = textTheme.textBaseline
9905
9997
  } = attribute;
9906
9998
  if (!verticalMode) {
9907
9999
  const t = textAlign;
9908
- textAlign = null !== (_a = Text.baselineMapAlign[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = Text.alignMapBaseline[t]) && void 0 !== _b ? _b : "top";
10000
+ textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
9909
10001
  }
9910
10002
  if (width = 0, !this.shouldUpdateShape() && this.cache) {
9911
10003
  this.cache.verticalList.forEach(item => {
@@ -9953,15 +10045,6 @@ class Text extends Graphic {
9953
10045
  dy = textLayoutOffsetY(textBaseline, height, fontSize);
9954
10046
  return this._AABBBounds.set(dy, dx, dy + height, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
9955
10047
  }
9956
- getMaxWidth(theme) {
9957
- var _a, _b;
9958
- const attribute = this.attribute;
9959
- return null !== (_b = null !== (_a = attribute.maxLineWidth) && void 0 !== _a ? _a : attribute.maxWidth) && void 0 !== _b ? _b : theme.maxWidth;
9960
- }
9961
- getLineHeight(attribute, textTheme) {
9962
- var _a;
9963
- return null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
9964
- }
9965
10048
  needUpdateTags(keys) {
9966
10049
  let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TEXT_UPDATE_TAG_KEY;
9967
10050
  return super.needUpdateTags(keys, k);
@@ -9976,12 +10059,6 @@ class Text extends Graphic {
9976
10059
  getNoWorkAnimateAttr() {
9977
10060
  return Text.NOWORK_ANIMATE_ATTR;
9978
10061
  }
9979
- getBaselineMapAlign() {
9980
- return Text.baselineMapAlign;
9981
- }
9982
- getAlignMapBaseline() {
9983
- return Text.alignMapBaseline;
9984
- }
9985
10062
  }
9986
10063
  Text.NOWORK_ANIMATE_ATTR = Object.assign({
9987
10064
  ellipsis: 1,
@@ -10060,9 +10137,7 @@ class WrapText extends Text {
10060
10137
  const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
10061
10138
  linesLayout.push({
10062
10139
  str: clip.str,
10063
- width: clip.width,
10064
- ascent: 0,
10065
- descent: 0
10140
+ width: clip.width
10066
10141
  });
10067
10142
  break;
10068
10143
  }
@@ -10076,9 +10151,7 @@ class WrapText extends Text {
10076
10151
  }
10077
10152
  if (linesLayout.push({
10078
10153
  str: clip.str,
10079
- width: clip.width,
10080
- ascent: 0,
10081
- descent: 0
10154
+ width: clip.width
10082
10155
  }), clip.str.length === str.length) ;else if (needCut) {
10083
10156
  const newStr = str.substring(clip.str.length);
10084
10157
  lines.splice(i + 1, 0, newStr);
@@ -10097,17 +10170,13 @@ class WrapText extends Text {
10097
10170
  const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
10098
10171
  linesLayout.push({
10099
10172
  str: clip.str,
10100
- width: clip.width,
10101
- ascent: 0,
10102
- descent: 0
10173
+ width: clip.width
10103
10174
  }), lineWidth = Math.max(lineWidth, clip.width);
10104
10175
  break;
10105
10176
  }
10106
10177
  text = lines[i], width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, "break-word" === wordBreak), lineWidth = Math.max(lineWidth, width), linesLayout.push({
10107
10178
  str: text,
10108
- width: width,
10109
- ascent: 0,
10110
- descent: 0
10179
+ width: width
10111
10180
  });
10112
10181
  }
10113
10182
  bboxWH[0] = lineWidth;
@@ -10151,6 +10220,9 @@ class BaseSymbol {
10151
10220
  bounds.x1 = -halfS, bounds.x2 = halfS, bounds.y1 = -halfS, bounds.y2 = halfS;
10152
10221
  } else bounds.x1 = -size[0] / 2, bounds.x2 = size[0] / 2, bounds.y1 = -size[1] / 2, bounds.y2 = size[1] / 2;
10153
10222
  }
10223
+ parseSize(size) {
10224
+ return isNumber(size) ? size : Math.min(size[0], size[1]);
10225
+ }
10154
10226
  }
10155
10227
 
10156
10228
  function circle(ctx, r, x, y, z) {
@@ -10161,13 +10233,13 @@ class CircleSymbol extends BaseSymbol {
10161
10233
  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
10234
  }
10163
10235
  draw(ctx, size, x, y, z) {
10164
- return circle(ctx, size / 2, x, y, z);
10236
+ return circle(ctx, this.parseSize(size) / 2, x, y, z);
10165
10237
  }
10166
10238
  drawOffset(ctx, size, x, y, offset, z) {
10167
- return circle(ctx, size / 2 + offset, x, y, z);
10239
+ return circle(ctx, this.parseSize(size) / 2 + offset, x, y, z);
10168
10240
  }
10169
10241
  drawToSvgPath(size, x, y, z) {
10170
- const r = size / 2;
10242
+ const r = this.parseSize(size) / 2;
10171
10243
  return `M ${x - r}, ${y} a ${r},${r} 0 1,0 ${2 * r},0 a ${r},${r} 0 1,0 -${2 * r},0`;
10172
10244
  }
10173
10245
  }
@@ -10184,10 +10256,10 @@ class CrossSymbol extends BaseSymbol {
10184
10256
  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
10257
  }
10186
10258
  draw(ctx, size, x, y, z) {
10187
- return cross(ctx, size / 6, x, y, z);
10259
+ return cross(ctx, this.parseSize(size) / 6, x, y, z);
10188
10260
  }
10189
10261
  drawOffset(ctx, size, x, y, offset, z) {
10190
- return crossOffset(ctx, size / 6, x, y, offset, z);
10262
+ return crossOffset(ctx, this.parseSize(size) / 6, x, y, offset, z);
10191
10263
  }
10192
10264
  }
10193
10265
  var cross$1 = new CrossSymbol();
@@ -10200,13 +10272,13 @@ class DiamondSymbol extends BaseSymbol {
10200
10272
  super(...arguments), this.type = "diamond", this.pathStr = "M-0.5,0L0,-0.5L0.5,0L0,0.5Z";
10201
10273
  }
10202
10274
  draw(ctx, size, x, y, z) {
10203
- return diamond(ctx, size / 2, x, y, z);
10275
+ return diamond(ctx, this.parseSize(size) / 2, x, y, z);
10204
10276
  }
10205
10277
  drawFitDir(ctx, size, x, y, z) {
10206
- return diamond(ctx, size / 2, x, y, z);
10278
+ return diamond(ctx, this.parseSize(size) / 2, x, y, z);
10207
10279
  }
10208
10280
  drawOffset(ctx, size, x, y, offset, z) {
10209
- return diamond(ctx, size / 2 + offset, x, y, z);
10281
+ return diamond(ctx, this.parseSize(size) / 2 + offset, x, y, z);
10210
10282
  }
10211
10283
  }
10212
10284
  var diamond$1 = new DiamondSymbol();
@@ -10220,10 +10292,10 @@ class SquareSymbol extends BaseSymbol {
10220
10292
  super(...arguments), this.type = "square", this.pathStr = "M-0.5,-0.5h1v1h-1Z";
10221
10293
  }
10222
10294
  draw(ctx, size, x, y) {
10223
- return square(ctx, size / 2, x, y);
10295
+ return square(ctx, this.parseSize(size) / 2, x, y);
10224
10296
  }
10225
10297
  drawOffset(ctx, size, x, y, offset) {
10226
- return square(ctx, size / 2 + offset, x, y);
10298
+ return square(ctx, this.parseSize(size) / 2 + offset, x, y);
10227
10299
  }
10228
10300
  }
10229
10301
  var square$1 = new SquareSymbol();
@@ -10237,10 +10309,10 @@ class TriangleUpSymbol extends BaseSymbol {
10237
10309
  super(...arguments), this.type = "triangleUp", this.pathStr = "M0.5,0.5 L-0.5,0.5 L0,-0.5 Z";
10238
10310
  }
10239
10311
  draw(ctx, size, x, y) {
10240
- return trianglUpOffset(ctx, size / 2, x, y);
10312
+ return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y);
10241
10313
  }
10242
10314
  drawOffset(ctx, size, x, y, offset) {
10243
- return trianglUpOffset(ctx, size / 2, x, y, offset);
10315
+ return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y, offset);
10244
10316
  }
10245
10317
  }
10246
10318
  var triangleUp = new TriangleUpSymbol();
@@ -10272,10 +10344,10 @@ class StarSymbol extends BaseSymbol {
10272
10344
  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
10345
  }
10274
10346
  draw(ctx, size, transX, transY) {
10275
- return star(ctx, size / 2, transX, transY);
10347
+ return star(ctx, this.parseSize(size) / 2, transX, transY);
10276
10348
  }
10277
10349
  drawOffset(ctx, size, transX, transY, offset) {
10278
- return star(ctx, size / 2 + offset, transX, transY);
10350
+ return star(ctx, this.parseSize(size) / 2 + offset, transX, transY);
10279
10351
  }
10280
10352
  }
10281
10353
  var star$1 = new StarSymbol();
@@ -10293,10 +10365,10 @@ class ArrowSymbol extends BaseSymbol {
10293
10365
  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
10366
  }
10295
10367
  draw(ctx, size, transX, transY) {
10296
- return arrow(ctx, size / 2, transX, transY);
10368
+ return arrow(ctx, this.parseSize(size) / 2, transX, transY);
10297
10369
  }
10298
10370
  drawOffset(ctx, size, transX, transY, offset) {
10299
- return arrow(ctx, size / 2 + offset, transX, transY);
10371
+ return arrow(ctx, this.parseSize(size) / 2 + offset, transX, transY);
10300
10372
  }
10301
10373
  }
10302
10374
  var arrow$1 = new ArrowSymbol();
@@ -10310,10 +10382,10 @@ class WedgeSymbol extends BaseSymbol {
10310
10382
  super(...arguments), this.type = "wedge", this.pathStr = "M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z";
10311
10383
  }
10312
10384
  draw(ctx, size, transX, transY) {
10313
- return wedge(ctx, size / 2, transX, transY);
10385
+ return wedge(ctx, this.parseSize(size) / 2, transX, transY);
10314
10386
  }
10315
10387
  drawOffset(ctx, size, transX, transY, offset) {
10316
- return wedge(ctx, size / 2 + offset, transX, transY);
10388
+ return wedge(ctx, this.parseSize(size) / 2 + offset, transX, transY);
10317
10389
  }
10318
10390
  }
10319
10391
  var wedge$1 = new WedgeSymbol();
@@ -10326,10 +10398,10 @@ class StrokeSymbol extends BaseSymbol {
10326
10398
  super(...arguments), this.type = "stroke", this.pathStr = "";
10327
10399
  }
10328
10400
  draw(ctx, size, transX, transY) {
10329
- return stroke(ctx, size / 2, transX, transY);
10401
+ return stroke(ctx, this.parseSize(size) / 2, transX, transY);
10330
10402
  }
10331
10403
  drawOffset(ctx, size, transX, transY, offset) {
10332
- return stroke(ctx, size / 2 + offset, transX, transY);
10404
+ return stroke(ctx, this.parseSize(size) / 2 + offset, transX, transY);
10333
10405
  }
10334
10406
  }
10335
10407
  var stroke$1 = new StrokeSymbol();
@@ -10351,10 +10423,10 @@ class WyeSymbol extends BaseSymbol {
10351
10423
  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
10424
  }
10353
10425
  draw(ctx, size, transX, transY) {
10354
- return wye(ctx, size / 2, transX, transY);
10426
+ return wye(ctx, this.parseSize(size) / 2, transX, transY);
10355
10427
  }
10356
10428
  drawOffset(ctx, size, transX, transY, offset) {
10357
- return wye(ctx, size / 2 + offset, transX, transY);
10429
+ return wye(ctx, this.parseSize(size) / 2 + offset, transX, transY);
10358
10430
  }
10359
10431
  }
10360
10432
  var wye$1 = new WyeSymbol();
@@ -10367,10 +10439,10 @@ class TriangleLeftSymbol extends BaseSymbol {
10367
10439
  super(...arguments), this.type = "triangleLeft", this.pathStr = "M-0.5,0 L0.5,0.5 L0.5,-0.5 Z";
10368
10440
  }
10369
10441
  draw(ctx, size, x, y) {
10370
- return trianglLeftOffset(ctx, size / 2, x, y, 0);
10442
+ return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, 0);
10371
10443
  }
10372
10444
  drawOffset(ctx, size, x, y, offset) {
10373
- return trianglLeftOffset(ctx, size / 2, x, y, offset);
10445
+ return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, offset);
10374
10446
  }
10375
10447
  }
10376
10448
  var triangleLeft = new TriangleLeftSymbol();
@@ -10384,10 +10456,10 @@ class TriangleRightSymbol extends BaseSymbol {
10384
10456
  super(...arguments), this.type = "triangleRight", this.pathStr = "M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z";
10385
10457
  }
10386
10458
  draw(ctx, size, x, y) {
10387
- return trianglRightOffset(ctx, size / 2, x, y);
10459
+ return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y);
10388
10460
  }
10389
10461
  drawOffset(ctx, size, x, y, offset) {
10390
- return trianglRightOffset(ctx, size / 2, x, y, offset);
10462
+ return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y, offset);
10391
10463
  }
10392
10464
  }
10393
10465
  var triangleRight = new TriangleRightSymbol();
@@ -10401,10 +10473,10 @@ class TriangleDownSymbol extends BaseSymbol {
10401
10473
  super(...arguments), this.type = "triangleDown", this.pathStr = "M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z";
10402
10474
  }
10403
10475
  draw(ctx, size, x, y) {
10404
- return trianglDownOffset(ctx, size / 2, x, y);
10476
+ return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y);
10405
10477
  }
10406
10478
  drawOffset(ctx, size, x, y, offset) {
10407
- return trianglDownOffset(ctx, size / 2, x, y, offset);
10479
+ return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y, offset);
10408
10480
  }
10409
10481
  }
10410
10482
  var triangleDown = new TriangleDownSymbol();
@@ -10419,10 +10491,10 @@ class ThinTriangleSymbol extends BaseSymbol {
10419
10491
  super(...arguments), this.type = "thinTriangle", this.pathStr = "M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z";
10420
10492
  }
10421
10493
  draw(ctx, size, x, y) {
10422
- return thinTriangle(ctx, size / 2 / sqrt3, x, y);
10494
+ return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3, x, y);
10423
10495
  }
10424
10496
  drawOffset(ctx, size, x, y, offset) {
10425
- return thinTriangle(ctx, size / 2 / sqrt3 + offset, x, y);
10497
+ return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3 + offset, x, y);
10426
10498
  }
10427
10499
  }
10428
10500
  var thinTriangle$1 = new ThinTriangleSymbol();
@@ -10436,10 +10508,10 @@ class Arrow2LeftSymbol extends BaseSymbol {
10436
10508
  super(...arguments), this.type = "arrow2Left", this.pathStr = "M 0.25 -0.5 L -0.25 0 l 0.25 0.5";
10437
10509
  }
10438
10510
  draw(ctx, size, transX, transY) {
10439
- return arrow2Left(ctx, size / 4, transX, transY);
10511
+ return arrow2Left(ctx, this.parseSize(size) / 4, transX, transY);
10440
10512
  }
10441
10513
  drawOffset(ctx, size, transX, transY, offset) {
10442
- return arrow2Left(ctx, size / 4 + offset, transX, transY);
10514
+ return arrow2Left(ctx, this.parseSize(size) / 4 + offset, transX, transY);
10443
10515
  }
10444
10516
  }
10445
10517
  var arrow2Left$1 = new Arrow2LeftSymbol();
@@ -10453,10 +10525,10 @@ class Arrow2RightSymbol extends BaseSymbol {
10453
10525
  super(...arguments), this.type = "arrow2Right", this.pathStr = "M -0.25 -0.5 l 0.25 0 l -0.25 0.5";
10454
10526
  }
10455
10527
  draw(ctx, size, transX, transY) {
10456
- return arrow2Right(ctx, size / 4, transX, transY);
10528
+ return arrow2Right(ctx, this.parseSize(size) / 4, transX, transY);
10457
10529
  }
10458
10530
  drawOffset(ctx, size, transX, transY, offset) {
10459
- return arrow2Right(ctx, size / 4 + offset, transX, transY);
10531
+ return arrow2Right(ctx, this.parseSize(size) / 4 + offset, transX, transY);
10460
10532
  }
10461
10533
  }
10462
10534
  var arrow2Right$1 = new Arrow2RightSymbol();
@@ -10470,10 +10542,10 @@ class Arrow2UpSymbol extends BaseSymbol {
10470
10542
  super(...arguments), this.type = "arrow2Up", this.pathStr = "M -0.5 0.25 L 0 -0.25 l 0.5 0.25";
10471
10543
  }
10472
10544
  draw(ctx, size, transX, transY) {
10473
- return arrow2Up(ctx, size / 4, transX, transY);
10545
+ return arrow2Up(ctx, this.parseSize(size) / 4, transX, transY);
10474
10546
  }
10475
10547
  drawOffset(ctx, size, transX, transY, offset) {
10476
- return arrow2Up(ctx, size / 4 + offset, transX, transY);
10548
+ return arrow2Up(ctx, this.parseSize(size) / 4 + offset, transX, transY);
10477
10549
  }
10478
10550
  }
10479
10551
  var arrow2Up$1 = new Arrow2UpSymbol();
@@ -10487,10 +10559,10 @@ class Arrow2DownSymbol extends BaseSymbol {
10487
10559
  super(...arguments), this.type = "arrow2Down", this.pathStr = "M -0.5 -0.25 L 0 0.25 l 0.5 -0.25";
10488
10560
  }
10489
10561
  draw(ctx, size, transX, transY) {
10490
- return arrow2Down(ctx, size / 4, transX, transY);
10562
+ return arrow2Down(ctx, this.parseSize(size) / 4, transX, transY);
10491
10563
  }
10492
10564
  drawOffset(ctx, size, transX, transY, offset) {
10493
- return arrow2Down(ctx, size / 4 + offset, transX, transY);
10565
+ return arrow2Down(ctx, this.parseSize(size) / 4 + offset, transX, transY);
10494
10566
  }
10495
10567
  }
10496
10568
  var arrow2Down$1 = new Arrow2DownSymbol();
@@ -10503,13 +10575,13 @@ class LineVSymbol extends BaseSymbol {
10503
10575
  super(...arguments), this.type = "lineV", this.pathStr = "M0,-0.5L0,0.5";
10504
10576
  }
10505
10577
  draw(ctx, size, x, y, z) {
10506
- return lineV(ctx, size / 2, x, y);
10578
+ return lineV(ctx, this.parseSize(size) / 2, x, y);
10507
10579
  }
10508
10580
  drawOffset(ctx, size, x, y, offset, z) {
10509
- return lineV(ctx, size / 2 + offset, x, y);
10581
+ return lineV(ctx, this.parseSize(size) / 2 + offset, x, y);
10510
10582
  }
10511
10583
  drawToSvgPath(size, x, y, z) {
10512
- const r = size / 2;
10584
+ const r = this.parseSize(size) / 2;
10513
10585
  return `M ${x}, ${y - r} L ${x},${y + r}`;
10514
10586
  }
10515
10587
  }
@@ -10523,13 +10595,13 @@ class LineHSymbol extends BaseSymbol {
10523
10595
  super(...arguments), this.type = "lineH", this.pathStr = "M-0.5,0L0.5,0";
10524
10596
  }
10525
10597
  draw(ctx, size, x, y, z) {
10526
- return lineH(ctx, size / 2, x, y);
10598
+ return lineH(ctx, this.parseSize(size) / 2, x, y);
10527
10599
  }
10528
10600
  drawOffset(ctx, size, x, y, offset, z) {
10529
- return lineH(ctx, size / 2 + offset, x, y);
10601
+ return lineH(ctx, this.parseSize(size) / 2 + offset, x, y);
10530
10602
  }
10531
10603
  drawToSvgPath(size, x, y, z) {
10532
- const r = size / 2;
10604
+ const r = this.parseSize(size) / 2;
10533
10605
  return `M ${x - r}, ${y} L ${x + r},${y}`;
10534
10606
  }
10535
10607
  }
@@ -10543,13 +10615,13 @@ class CloseSymbol extends BaseSymbol {
10543
10615
  super(...arguments), this.type = "close", this.pathStr = "M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5";
10544
10616
  }
10545
10617
  draw(ctx, size, x, y, z) {
10546
- return close(ctx, size / 2, x, y);
10618
+ return close(ctx, this.parseSize(size) / 2, x, y);
10547
10619
  }
10548
10620
  drawOffset(ctx, size, x, y, offset, z) {
10549
- return close(ctx, size / 2 + offset, x, y);
10621
+ return close(ctx, this.parseSize(size) / 2 + offset, x, y);
10550
10622
  }
10551
10623
  drawToSvgPath(size, x, y, z) {
10552
- const r = size / 2;
10624
+ const r = this.parseSize(size) / 2;
10553
10625
  return `M ${x - r}, ${y - r} L ${x + r},${y + r} M ${x + r}, ${y - r} L ${x - r},${y + r}`;
10554
10626
  }
10555
10627
  }
@@ -10583,15 +10655,18 @@ class CustomSymbolClass {
10583
10655
  this.pathStr = "", this.type = type, isArray(path) ? this.svgCache = path : this.path = path, this.isSvg = isSvg;
10584
10656
  }
10585
10657
  drawOffset(ctx, size, x, y, offset, z, cb) {
10586
- return this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
10658
+ return size = this.parseSize(size), this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
10587
10659
  ctx.beginPath(), renderCommandList(item.path.commandList, ctx, x, y, size, size), cb && cb(item.path, item.attribute);
10588
10660
  }), !1) : (renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset), !1);
10589
10661
  }
10590
10662
  draw(ctx, size, x, y, z, cb) {
10591
- return this.drawOffset(ctx, size, x, y, 0, z, cb);
10663
+ return size = this.parseSize(size), this.drawOffset(ctx, size, x, y, 0, z, cb);
10664
+ }
10665
+ parseSize(size) {
10666
+ return isNumber(size) ? size : Math.min(size[0], size[1]);
10592
10667
  }
10593
10668
  bounds(size, bounds) {
10594
- if (this.isSvg) {
10669
+ if (size = this.parseSize(size), this.isSvg) {
10595
10670
  if (!this.svgCache) return;
10596
10671
  return bounds.clear(), void this.svgCache.forEach(_ref => {
10597
10672
  let {
@@ -11095,7 +11170,11 @@ class Paragraph {
11095
11170
  case "sub":
11096
11171
  baseline += this.descent / 2;
11097
11172
  }
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();
11173
+ "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);
11174
+ const {
11175
+ lineWidth = 1
11176
+ } = this.character;
11177
+ 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
11178
  }
11100
11179
  getWidthWithEllips(direction) {
11101
11180
  let text = this.text;
@@ -13282,8 +13361,9 @@ class PickerBase {
13282
13361
  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
13362
  if (picked) return !0;
13284
13363
  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;
13364
+ pickStrokeBuffer = arcAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
13365
+ keepStrokeScale = arcAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
13366
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
13287
13367
  }), pickContext.highPerformanceRestore(), picked;
13288
13368
  }
13289
13369
  }
@@ -13505,8 +13585,9 @@ class RectPickerBase {
13505
13585
  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
13586
  if (picked) return !0;
13507
13587
  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;
13588
+ pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
13589
+ keepStrokeScale = rectAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
13590
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
13510
13591
  });else {
13511
13592
  const {
13512
13593
  fill = rectAttribute.fill,
@@ -13685,8 +13766,9 @@ class BaseLinePicker extends BaseRender {
13685
13766
  return this.canvasRenderer.drawShape(graphic, pickContext, x, y, {}, null, context => !!picked || (picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked), (context, lineAttribute, themeAttribute) => {
13686
13767
  if (picked) return !0;
13687
13768
  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;
13769
+ pickStrokeBuffer = lineAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
13770
+ keepStrokeScale = lineAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
13771
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
13690
13772
  }), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
13691
13773
  }
13692
13774
  }
@@ -13821,8 +13903,9 @@ let DefaultCanvasSymbolPicker = class extends Base3dPicker {
13821
13903
  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
13904
  if (picked) return !0;
13823
13905
  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;
13906
+ pickStrokeBuffer = symbolAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
13907
+ keepStrokeScale = symbolAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
13908
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
13826
13909
  }), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
13827
13910
  }
13828
13911
  };
@@ -13916,8 +13999,10 @@ let DefaultCanvasTextPicker = class extends Base3dPicker {
13916
13999
  } = text.attribute,
13917
14000
  bounds = text.AABBBounds,
13918
14001
  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;
14002
+ width = bounds.width(),
14003
+ offsetY = textLayoutOffsetY(textBaseline, height, fontSize),
14004
+ offsetX = textDrawOffsetX(textAlign, width);
14005
+ return context.rect(offsetX + x, offsetY + y, width, height, z), picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked;
13921
14006
  }, (context, symbolAttribute, themeAttribute) => picked), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
13922
14007
  }
13923
14008
  };
@@ -14467,6 +14552,288 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
14467
14552
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
14468
14553
  };
14469
14554
 
14555
+ var ScrollBarPlugin_1;
14556
+ let ScrollBarPlugin = ScrollBarPlugin_1 = class ScrollBarPlugin {
14557
+ constructor() {
14558
+ this.name = 'scrollbar';
14559
+ this.activeEvent = 'onRegister';
14560
+ this._uid = Generator.GenAutoIncrementId();
14561
+ this.key = this.name + this._uid;
14562
+ this.scroll = (e) => {
14563
+ var _a, _b;
14564
+ const graphic = e.target;
14565
+ const data = this.getScrollContainer(graphic);
14566
+ if (!data && !this.scrollContainer) {
14567
+ return;
14568
+ }
14569
+ if (!data && this.scrollContainer) {
14570
+ if (!this.scrollContainer.g.stage || this.scrollContainer.g.stage !== graphic.stage) {
14571
+ return;
14572
+ }
14573
+ const newScrollContainer = this.formatScrollContainer(this.scrollContainer.g);
14574
+ if (!newScrollContainer) {
14575
+ this.clearScrollbar(this.scrollContainer.g, 'all');
14576
+ return;
14577
+ }
14578
+ if (this.scrollContainer.showH && !newScrollContainer.showH) {
14579
+ this.clearScrollbar(this.scrollContainer.g, 'horizontal');
14580
+ }
14581
+ if (this.scrollContainer.showV && !newScrollContainer.showV) {
14582
+ this.clearScrollbar(this.scrollContainer.g, 'vertical');
14583
+ }
14584
+ this.scrollContainer = newScrollContainer;
14585
+ }
14586
+ else if (data && this.scrollContainer && data.g !== this.scrollContainer.g) {
14587
+ this.clearScrollbar(this.scrollContainer.g, 'all');
14588
+ }
14589
+ this.scrollContainer = data !== null && data !== void 0 ? data : this.scrollContainer;
14590
+ const scrollContainer = data.g;
14591
+ const { width, height, scrollX = 0, scrollY = 0 } = scrollContainer.attribute;
14592
+ let newScrollX = scrollX;
14593
+ let newScrollY = scrollY;
14594
+ let { showH, showV } = data;
14595
+ this.scrollContainerBounds = new Bounds().set(0, 0, scrollContainer.attribute.width, scrollContainer.attribute.height);
14596
+ if (showH && showH) {
14597
+ if (abs(e.deltaX) > abs(e.deltaY)) {
14598
+ showH = showH && true;
14599
+ showV = showV && false;
14600
+ }
14601
+ else {
14602
+ showH = showH && false;
14603
+ showV = showV && true;
14604
+ }
14605
+ }
14606
+ const childrenBounds = this.childrenBounds;
14607
+ childrenBounds.clear();
14608
+ childrenBounds.set(0, 0, scrollContainer.AABBBounds.width(), scrollContainer.AABBBounds.height());
14609
+ const scrollWidth = childrenBounds.width();
14610
+ const scrollHeight = childrenBounds.height();
14611
+ if (showH) {
14612
+ newScrollX = Math.max(Math.min(((_a = e.deltaX) !== null && _a !== void 0 ? _a : 0) - scrollX, scrollWidth - width), 0);
14613
+ }
14614
+ else {
14615
+ newScrollX = -scrollX;
14616
+ }
14617
+ if (showV) {
14618
+ newScrollY = Math.max(Math.min(((_b = e.deltaY) !== null && _b !== void 0 ? _b : 0) - scrollY, scrollHeight - height), 0);
14619
+ }
14620
+ else {
14621
+ newScrollY = -scrollY;
14622
+ }
14623
+ childrenBounds.translate(-newScrollX, -newScrollY);
14624
+ this.addOrUpdateScroll(showH, showV, scrollContainer.parent, scrollContainer);
14625
+ scrollContainer.setAttributes({
14626
+ scrollX: -newScrollX,
14627
+ scrollY: -newScrollY
14628
+ });
14629
+ };
14630
+ this.handleScrollBarChange = (params) => {
14631
+ if (!this.scrollContainer ||
14632
+ !this.scrollContainerBounds ||
14633
+ !this.childrenBounds ||
14634
+ !params ||
14635
+ !params.target ||
14636
+ !params.detail ||
14637
+ !params.detail.value) {
14638
+ return;
14639
+ }
14640
+ const scrollbar = params.target;
14641
+ const newRange = params.detail.value;
14642
+ if (scrollbar.attribute.direction === 'horizontal') {
14643
+ const scrollWidth = this.childrenBounds.width();
14644
+ this.scrollContainer.g.setAttributes({ scrollX: -newRange[0] * scrollWidth });
14645
+ }
14646
+ else {
14647
+ const scrollHeight = this.childrenBounds.height();
14648
+ this.scrollContainer.g.setAttributes({ scrollY: -newRange[0] * scrollHeight });
14649
+ }
14650
+ };
14651
+ }
14652
+ activate(context) {
14653
+ this.pluginService = context;
14654
+ const { stage } = this.pluginService;
14655
+ this.childrenBounds = new AABBBounds();
14656
+ stage.addEventListener('wheel', this.scroll);
14657
+ this.params = ScrollBarPlugin_1.defaultParams;
14658
+ }
14659
+ initEventOfScrollbar(scrollContainer, scrollbar, isHorozntal) {
14660
+ scrollContainer.addEventListener('pointerover', () => {
14661
+ scrollbar.setAttribute('visibleAll', true);
14662
+ });
14663
+ scrollContainer.addEventListener('pointermove', () => {
14664
+ scrollbar.setAttribute('visibleAll', true);
14665
+ });
14666
+ scrollContainer.addEventListener('pointerout', () => {
14667
+ scrollbar.setAttribute('visibleAll', false);
14668
+ });
14669
+ scrollbar.addEventListener('pointerover', () => {
14670
+ scrollbar.setAttribute('visibleAll', true);
14671
+ });
14672
+ scrollbar.addEventListener('pointerout', () => {
14673
+ scrollbar.setAttribute('visibleAll', true);
14674
+ });
14675
+ scrollbar.addEventListener('scrollUp', this.handleScrollBarChange);
14676
+ scrollbar.addEventListener(SCROLLBAR_EVENT, this.handleScrollBarChange);
14677
+ }
14678
+ addOrUpdateScroll(showH, showV, container, scrollContainer) {
14679
+ if (showH) {
14680
+ const { scrollBar: hScrollbar, isUpdate } = this.addOrUpdateHScroll(scrollContainer, container, true);
14681
+ if (!isUpdate) {
14682
+ this.initEventOfScrollbar(scrollContainer, hScrollbar, true);
14683
+ }
14684
+ }
14685
+ else {
14686
+ this.clearScrollbar(scrollContainer, 'horizontal');
14687
+ }
14688
+ if (showV) {
14689
+ const { scrollBar: vScrollbar, isUpdate } = this.addOrUpdateHScroll(scrollContainer, container, false);
14690
+ if (!isUpdate) {
14691
+ this.initEventOfScrollbar(scrollContainer, vScrollbar, false);
14692
+ }
14693
+ }
14694
+ else {
14695
+ this.clearScrollbar(scrollContainer, 'vertical');
14696
+ }
14697
+ }
14698
+ getDirection(isHorozntal) {
14699
+ return isHorozntal ? 'horizontal' : 'vertical';
14700
+ }
14701
+ addOrUpdateHScroll(scrollContainer, container, isHorozntal) {
14702
+ var _a;
14703
+ const direction = this.getDirection(isHorozntal);
14704
+ const name = `${(_a = scrollContainer.name) !== null && _a !== void 0 ? _a : scrollContainer._uid}_${this.getDirection(isHorozntal)}_${this.name}`;
14705
+ const scrollbars = container.children.filter((g) => g.name === name);
14706
+ let isUpdate = true;
14707
+ let scrollBar = scrollbars[0];
14708
+ const { y = 0, dy = 0, x = 0, dx = 0, height, width, zIndex = 0 } = this.scrollContainer.g.attribute;
14709
+ const attrs = {
14710
+ x: 0,
14711
+ y: 0,
14712
+ direction,
14713
+ zIndex: zIndex + 1,
14714
+ visibleAll: true,
14715
+ padding: [2, 0],
14716
+ railStyle: {
14717
+ fill: 'rgba(0, 0, 0, .1)'
14718
+ },
14719
+ range: [0, 0.05]
14720
+ };
14721
+ if (isHorozntal) {
14722
+ attrs.width = this.scrollContainerBounds.width();
14723
+ attrs.height = 12;
14724
+ }
14725
+ else {
14726
+ attrs.height = this.scrollContainerBounds.height();
14727
+ attrs.width = 12;
14728
+ }
14729
+ if (!scrollBar) {
14730
+ isUpdate = false;
14731
+ scrollBar = new ScrollBar(attrs);
14732
+ scrollBar.name = name;
14733
+ container.add(scrollBar);
14734
+ scrollBar.isScrollBar = true;
14735
+ }
14736
+ else if (scrollbars.length > 1) {
14737
+ scrollbars.forEach((child, index) => {
14738
+ var _a;
14739
+ if (index) {
14740
+ (_a = child.parent) === null || _a === void 0 ? void 0 : _a.removeChild(child);
14741
+ }
14742
+ });
14743
+ }
14744
+ const childrenBounds = this.childrenBounds;
14745
+ if (isHorozntal) {
14746
+ const ratio = Math.min(this.scrollContainerBounds.width() / childrenBounds.width(), 1);
14747
+ const start = Math.max(Math.min(this.childrenBounds.x1 / this.childrenBounds.width(), 0), ratio - 1);
14748
+ attrs.x = x + dx;
14749
+ attrs.y = y + dy + height - this.scrollContainerBounds.height();
14750
+ attrs.range = [-start, -start + ratio];
14751
+ }
14752
+ else {
14753
+ const ratio = Math.min(this.scrollContainerBounds.height() / childrenBounds.height(), 1);
14754
+ const start = Math.max(Math.min(this.childrenBounds.y1 / this.childrenBounds.height(), 0), ratio - 1);
14755
+ attrs.x = x + dx + width - this.scrollContainerBounds.width();
14756
+ attrs.y = y + dy;
14757
+ attrs.range = [-start, -start + ratio];
14758
+ }
14759
+ scrollBar.setAttributes(attrs);
14760
+ return {
14761
+ scrollBar,
14762
+ isUpdate
14763
+ };
14764
+ }
14765
+ clearScrollbar(scrollContainer, type) {
14766
+ if (!scrollContainer.parent) {
14767
+ return;
14768
+ }
14769
+ const scrollbarBars = scrollContainer.parent.children.filter((child) => {
14770
+ return child.isScrollBar && (type === 'all' || child.attribute.direction === type);
14771
+ });
14772
+ scrollbarBars.forEach((child) => {
14773
+ child.parent.removeChild(child);
14774
+ });
14775
+ }
14776
+ formatScrollContainer(g) {
14777
+ if (!g || g.type !== 'group' || !g.attribute) {
14778
+ return null;
14779
+ }
14780
+ const { overflow, width, height } = g.attribute;
14781
+ if (!overflow || overflow === 'hidden') {
14782
+ return null;
14783
+ }
14784
+ let showH = false;
14785
+ let showV = false;
14786
+ if (overflow === 'scroll') {
14787
+ showH = true;
14788
+ showV = true;
14789
+ }
14790
+ else {
14791
+ showH = overflow === 'scroll-x';
14792
+ showV = !showH;
14793
+ }
14794
+ if (!g.AABBBounds.empty()) {
14795
+ if (showH) {
14796
+ showH = width < g.AABBBounds.width();
14797
+ }
14798
+ if (showV) {
14799
+ showV = height < g.AABBBounds.height();
14800
+ }
14801
+ }
14802
+ return showH || showV ? { g: g, showH, showV } : null;
14803
+ }
14804
+ getScrollContainer(graphic) {
14805
+ let g = graphic;
14806
+ while (g) {
14807
+ const res = this.formatScrollContainer(g);
14808
+ if (res) {
14809
+ return res;
14810
+ }
14811
+ g = g.parent;
14812
+ }
14813
+ return null;
14814
+ }
14815
+ deactivate(context) {
14816
+ const { stage } = this.pluginService;
14817
+ stage.removeEventListener('wheel', this.scroll);
14818
+ }
14819
+ };
14820
+ ScrollBarPlugin.defaultParams = {
14821
+ timeout: 500
14822
+ };
14823
+ ScrollBarPlugin = ScrollBarPlugin_1 = __decorate([
14824
+ injectable()
14825
+ ], ScrollBarPlugin);
14826
+
14827
+ const scrollbarModule = new ContainerModule((bind, unbind, isBound, rebind) => {
14828
+ if (!isBound(ScrollBarPlugin)) {
14829
+ bind(ScrollBarPlugin).toSelf();
14830
+ bind(AutoEnablePlugins).toService(ScrollBarPlugin);
14831
+ }
14832
+ });
14833
+ function loadScrollbar() {
14834
+ container.load(scrollbarModule);
14835
+ }
14836
+
14470
14837
  function traverseGroup(group, cb) {
14471
14838
  group.forEachChildren(node => {
14472
14839
  const stopped = cb(node);
@@ -15924,24 +16291,29 @@ function defaultLabelPosition(type) {
15924
16291
  return DefaultPositions;
15925
16292
  }
15926
16293
  }
15927
- function clampText(text, width, height) {
16294
+ function clampText(text, width, height, padding = {}) {
15928
16295
  const { x1, x2, y1, y2 } = text.AABBBounds;
16296
+ const { top = 0, left = 0, right = 0, bottom = 0 } = padding;
15929
16297
  const minX = Math.min(x1, x2);
15930
16298
  const maxX = Math.max(x1, x2);
15931
16299
  const minY = Math.min(y1, y2);
15932
16300
  const maxY = Math.max(y1, y2);
16301
+ const minXWithPadding = 0 - left;
16302
+ const maxXWithPadding = width + right;
16303
+ const minYWithPadding = 0 - top;
16304
+ const maxYWithPadding = height + bottom;
15933
16305
  let dx = 0;
15934
16306
  let dy = 0;
15935
- if (minX < 0 && maxX - minX <= width) {
16307
+ if (minX < minXWithPadding && maxX - minX <= width) {
15936
16308
  dx = -minX;
15937
16309
  }
15938
- else if (maxX > width && minX - (maxX - width) >= 0) {
16310
+ else if (maxX > maxXWithPadding && minX - (maxX - width) >= minXWithPadding) {
15939
16311
  dx = width - maxX;
15940
16312
  }
15941
- if (minY < 0 && maxY - minY <= height) {
16313
+ if (minY < minYWithPadding && maxY - minY <= height) {
15942
16314
  dy = -minY;
15943
16315
  }
15944
- else if (maxY > height && minY - (maxY - height) >= 0) {
16316
+ else if (maxY > maxYWithPadding && minY - (maxY - height) >= minYWithPadding) {
15945
16317
  dy = height - maxY;
15946
16318
  }
15947
16319
  return { dx, dy };
@@ -16241,56 +16613,121 @@ function loadLabelComponent() {
16241
16613
  registerLine();
16242
16614
  }
16243
16615
 
16244
- function shiftY(texts, option = {}) {
16245
- const { maxIterations = 10, maxError = 0.1, padding = 1, maxY = Number.MAX_VALUE } = option;
16616
+ const isIntersect = (top, bottom) => {
16617
+ return Math.ceil(top) > Math.floor(bottom);
16618
+ };
16619
+ const isXIntersect = ([a, b], [c, d]) => {
16620
+ return d > a && b > c;
16621
+ };
16622
+ function getIntersectionLength(range1, range2) {
16623
+ const [start1, end1] = range1;
16624
+ const [start2, end2] = range2;
16625
+ const start = Math.max(start1, start2);
16626
+ const end = Math.min(end1, end2);
16627
+ return Math.max(0, end - start);
16628
+ }
16629
+ function shiftY(texts, option) {
16630
+ const { maxIterations = 10, maxError = 0.1, padding = 1, maxY = Number.MAX_VALUE, labelling } = option;
16246
16631
  const n = texts.length;
16247
16632
  if (n <= 1) {
16248
16633
  return texts;
16249
16634
  }
16250
- const isIntersect = ([a, b], [c, d]) => {
16251
- return d > a && b > c;
16252
- };
16635
+ const xMap = new Map();
16253
16636
  const textInformation = new Map();
16254
- const getY0 = (text) => textInformation.get(text).y0;
16255
- const getY = (text) => textInformation.get(text).y;
16637
+ const getY1Initial = (text) => textInformation.get(text).y1Initial;
16256
16638
  const getHeight = (text) => textInformation.get(text).height;
16639
+ const getY1 = (text) => textInformation.get(text).y1;
16640
+ const getY = (text) => textInformation.get(text).y;
16641
+ const getX = (text) => textInformation.get(text).x;
16257
16642
  const getX1 = (text) => textInformation.get(text).x1;
16258
16643
  const getX2 = (text) => textInformation.get(text).x2;
16259
- const setY = (text, y) => {
16260
- textInformation.get(text).y = y;
16644
+ const setY1 = (text, y) => {
16645
+ textInformation.get(text).y1 = y;
16261
16646
  };
16647
+ function adjustPositionInOneGroup(texts) {
16648
+ if (texts.length === 1) {
16649
+ return;
16650
+ }
16651
+ for (let i = texts.length - 1; i > 0; i--) {
16652
+ const curText = texts[i];
16653
+ const upperText = texts[i - 1];
16654
+ const lowerText = texts[i + 1];
16655
+ if (isIntersect(getY1(upperText) + getHeight(upperText), getY1(curText))) {
16656
+ const { y } = labelling(curText);
16657
+ if (!lowerText || !isIntersect(y + getHeight(curText) / 2, getY1(lowerText))) {
16658
+ if (y + getHeight(curText) / 2 <= maxY) {
16659
+ setY1(curText, getY1(curText) + y - getY(curText));
16660
+ }
16661
+ }
16662
+ }
16663
+ }
16664
+ }
16665
+ texts.sort((a, b) => a.attribute.x - b.attribute.x);
16262
16666
  for (const text of texts) {
16263
16667
  const { y1, y2, x1, x2 } = text.AABBBounds;
16264
- textInformation.set(text, { y0: y1, y: y1, height: y2 - y1, x1, x2 });
16668
+ const { x, y } = text.attribute;
16669
+ textInformation.set(text, { y1Initial: y1, y1, y2, y, height: y2 - y1, x1, x2, x });
16670
+ let hasRange = false;
16671
+ for (const [range, xGroupTexts] of xMap) {
16672
+ const { start, end } = range;
16673
+ if (x1 >= start && x2 <= end) {
16674
+ xGroupTexts.push(text);
16675
+ hasRange = true;
16676
+ }
16677
+ else if (isNumberClose(x, getX(xGroupTexts[0]), undefined, 5)) {
16678
+ const newRange = { start: Math.min(start, x1), end: Math.max(end, x2) };
16679
+ xGroupTexts.push(text);
16680
+ xMap.set(newRange, xGroupTexts);
16681
+ xMap.delete(range);
16682
+ hasRange = true;
16683
+ }
16684
+ else if (getIntersectionLength([start, end], [x1, x2]) / (end - start) > 0.5) {
16685
+ const newRange = { start: Math.min(start, x1), end: Math.max(end, x2) };
16686
+ xGroupTexts.push(text);
16687
+ xMap.set(newRange, xGroupTexts);
16688
+ xMap.delete(range);
16689
+ hasRange = true;
16690
+ }
16691
+ if (hasRange) {
16692
+ break;
16693
+ }
16694
+ }
16695
+ if (!hasRange) {
16696
+ xMap.set({ start: x1, end: x2 }, [text]);
16697
+ }
16698
+ }
16699
+ for (const xTexts of xMap.values()) {
16700
+ xTexts.sort((a, b) => getY1Initial(a) - getY1Initial(b));
16701
+ adjustPositionInOneGroup(xTexts);
16265
16702
  }
16266
16703
  for (let iter = 0; iter < maxIterations; iter++) {
16267
- texts.sort((a, b) => getY(a) - getY(b));
16704
+ texts.sort((a, b) => getY1(a) - getY1(b));
16268
16705
  let error = 0;
16269
16706
  for (let i = 0; i < n - 1; i++) {
16270
16707
  const curText = texts[i];
16271
16708
  let j = i + 1;
16272
16709
  let nextText;
16273
16710
  while ((nextText = texts[j]) &&
16274
- !isIntersect([getX1(curText), getX2(curText)], [getX1(nextText), getX2(nextText)])) {
16711
+ !isXIntersect([getX1(curText), getX2(curText)], [getX1(nextText), getX2(nextText)])) {
16275
16712
  j += 1;
16276
16713
  }
16277
16714
  if (nextText) {
16278
- const y0 = getY(curText);
16715
+ const y1 = getY1(curText);
16279
16716
  const h0 = getHeight(curText);
16280
- const y1 = getY(nextText);
16281
- const delta = y1 - (y0 + h0);
16717
+ const nextY1 = getY1(nextText);
16718
+ const delta = nextY1 - (y1 + h0);
16282
16719
  if (delta < padding) {
16283
16720
  const newDelta = (padding - delta) / 2;
16284
16721
  error = Math.max(error, newDelta);
16285
16722
  if (y1 + newDelta + getHeight(nextText) > maxY) {
16286
- setY(curText, y0 - (padding - delta));
16723
+ setY1(curText, y1 - (padding - delta));
16287
16724
  }
16288
- else if (y0 - newDelta < 0) {
16289
- setY(nextText, y1 + (padding - delta));
16725
+ else if (y1 - newDelta < 0) {
16726
+ setY1(nextText, nextY1 + (padding - delta));
16290
16727
  }
16291
16728
  else {
16292
- setY(curText, y0 - newDelta);
16293
- setY(nextText, y1 + newDelta);
16729
+ setY1(curText, y1 - newDelta);
16730
+ setY1(nextText, nextY1 + newDelta);
16294
16731
  }
16295
16732
  }
16296
16733
  }
@@ -16300,10 +16737,25 @@ function shiftY(texts, option = {}) {
16300
16737
  }
16301
16738
  }
16302
16739
  for (const text of texts) {
16303
- const finalY = text.attribute.y + getY(text) - getY0(text);
16740
+ const finalY = text.attribute.y + getY1(text) - getY1Initial(text);
16304
16741
  text.setAttribute('y', finalY);
16305
16742
  }
16306
- return texts;
16743
+ const result = [];
16744
+ texts.sort((a, b) => a.attribute.x - b.attribute.x);
16745
+ let start = 0;
16746
+ let end = texts.length - 1;
16747
+ while (start <= end) {
16748
+ if (start === end) {
16749
+ result.push(texts[start]);
16750
+ }
16751
+ else {
16752
+ result.push(texts[start]);
16753
+ result.push(texts[end]);
16754
+ }
16755
+ start++;
16756
+ end--;
16757
+ }
16758
+ return result;
16307
16759
  }
16308
16760
 
16309
16761
  loadLabelComponent();
@@ -16649,18 +17101,25 @@ class LabelBase extends AbstractComponent {
16649
17101
  if (clampForce) {
16650
17102
  for (let i = 0; i < result.length; i++) {
16651
17103
  const text = labels[i];
16652
- const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height);
17104
+ const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
16653
17105
  if (dx !== 0 || dy !== 0) {
16654
17106
  text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
17107
+ text._isClamped = true;
16655
17108
  }
16656
17109
  }
16657
17110
  }
16658
- result = shiftY(result, Object.assign({ maxY: bmpTool.height }, strategy));
17111
+ result = shiftY(result, Object.assign(Object.assign({ maxY: bmpTool.height }, strategy), { labelling: (text) => {
17112
+ const baseMark = this.getRelatedGraphic(text.attribute);
17113
+ const graphicBound = this._isCollectionBase
17114
+ ? this.getGraphicBounds(null, this._idToPoint.get(text.attribute.id))
17115
+ : this.getGraphicBounds(baseMark, text);
17116
+ return this.labeling(text.AABBBounds, graphicBound, 'bottom', this.attribute.offset);
17117
+ } }));
16659
17118
  for (let i = 0; i < result.length; i++) {
16660
17119
  const text = result[i];
16661
17120
  const bounds = text.AABBBounds;
16662
17121
  const range = boundToRange(bmpTool, bounds, true);
16663
- if (canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding)) {
17122
+ if (canPlace(bmpTool, bitmap, bounds, clampForce, text._isClamped ? 0 : overlapPadding)) {
16664
17123
  bitmap.setRange(range);
16665
17124
  }
16666
17125
  else {
@@ -16733,7 +17192,7 @@ class LabelBase extends AbstractComponent {
16733
17192
  }
16734
17193
  }
16735
17194
  if (!hasPlace && clampForce) {
16736
- const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height);
17195
+ const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
16737
17196
  if (dx === 0 && dy === 0) {
16738
17197
  if (canPlace(bmpTool, bitmap, text.AABBBounds)) {
16739
17198
  bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
@@ -17217,6 +17676,9 @@ class ArcLabel extends LabelBase {
17217
17676
  this._alignOffset = 0;
17218
17677
  }
17219
17678
  _overlapping(labels) {
17679
+ if (['inside', 'inside-center'].includes(this.attribute.position)) {
17680
+ return super._overlapping(labels);
17681
+ }
17220
17682
  return labels;
17221
17683
  }
17222
17684
  labeling(textBounds, graphicBounds, position = 'outside', offset = 0) {
@@ -29483,6 +29945,6 @@ EmptyTip.defaultAttributes = {
29483
29945
  }
29484
29946
  };
29485
29947
 
29486
- const version = "0.21.0-alpha.3";
29948
+ const version = "0.21.0-beta.0";
29487
29949
 
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 };
29950
+ 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 };