@visactor/vrender-components 0.22.0-vstory.9 → 0.22.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.
package/dist/index.es.js CHANGED
@@ -434,12 +434,15 @@ class Container {
434
434
  serviceIdentifier: injectIdentifier,
435
435
  constructorArgsMetadata: constructorArgsMetadata
436
436
  },
437
- request = {
437
+ bindings = (this._bindingDictionary.get(injectIdentifier) || []).filter(b => b.constraint(target));
438
+ if (bindings.length) {
439
+ const request = {
438
440
  injectIdentifier: injectIdentifier,
439
441
  metadata: constructorArgsMetadata,
440
- bindings: this._bindingDictionary.get(injectIdentifier).filter(b => b.constraint(target))
442
+ bindings: bindings
441
443
  };
442
- arr.push(request);
444
+ arr.push(request);
445
+ }
443
446
  }
444
447
  return arr;
445
448
  }
@@ -618,6 +621,12 @@ let DefaultGlobal = class {
618
621
  get env() {
619
622
  return this._env;
620
623
  }
624
+ get isImageAnonymous() {
625
+ return this._isImageAnonymous;
626
+ }
627
+ set isImageAnonymous(isImageAnonymous) {
628
+ this._isImageAnonymous = isImageAnonymous;
629
+ }
621
630
  get devicePixelRatio() {
622
631
  return this._env || this.setEnv("browser"), this.envContribution.getDevicePixelRatio();
623
632
  }
@@ -652,7 +661,7 @@ let DefaultGlobal = class {
652
661
  this._env || this.setEnv("browser"), this.envContribution.applyStyles = support;
653
662
  }
654
663
  constructor(contributions) {
655
- this.contributions = contributions, this.id = Generator.GenAutoIncrementId(), this.hooks = {
664
+ this.contributions = contributions, this._isImageAnonymous = !0, this.id = Generator.GenAutoIncrementId(), this.hooks = {
656
665
  onSetEnv: new SyncHook(["lastEnv", "env", "global"])
657
666
  }, this.measureTextMethod = "native", this.optimizeVisible = !1;
658
667
  }
@@ -1593,7 +1602,7 @@ let Step$1 = class Step {
1593
1602
  default:
1594
1603
  if (this._t <= 0) this.context.lineTo(this._x, y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined, p);else {
1595
1604
  const x1 = this._x * (1 - this._t) + x * this._t;
1596
- this.context.lineTo(x1, this._y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x1, y, !1 !== this._lastDefined && !1 !== p.defined, p);
1605
+ .5 === this._t ? this.context.lineTo(x1, this._y, !1 !== this._lastDefined, this.lastPoint) : this.context.lineTo(x1, this._y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x1, y, !1 !== this._lastDefined && !1 !== p.defined, p);
1597
1606
  }
1598
1607
  }
1599
1608
  this._lastDefined = p.defined, this._x = x, this._y = y, this.lastPoint = p;
@@ -2269,6 +2278,7 @@ const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
2269
2278
  texturePadding: 2,
2270
2279
  backgroundMode: "no-repeat",
2271
2280
  backgroundFit: !0,
2281
+ backgroundKeepAspectRatio: !1,
2272
2282
  backgroundClip: !0,
2273
2283
  backgroundScale: 1,
2274
2284
  backgroundOffsetX: 0,
@@ -2415,6 +2425,7 @@ const DefaultTextAttribute = Object.assign(Object.assign(Object.assign({}, Defau
2415
2425
  const DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), {
2416
2426
  editable: !1,
2417
2427
  editOptions: null,
2428
+ ascentDescentMode: "actual",
2418
2429
  width: 300,
2419
2430
  height: 300,
2420
2431
  ellipsis: !0,
@@ -2852,14 +2863,17 @@ function testLetter2(string, index) {
2852
2863
  return i + 1;
2853
2864
  }
2854
2865
  function measureTextCanvas(text, character) {
2866
+ let mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "actual";
2855
2867
  const measurement = application.graphicUtil.textMeasure.measureText(text, character),
2856
2868
  result = {
2857
2869
  ascent: 0,
2858
2870
  height: 0,
2859
2871
  descent: 0,
2860
2872
  width: 0
2861
- };
2862
- return "number" != typeof measurement.fontBoundingBoxAscent || "number" != typeof measurement.fontBoundingBoxDescent ? (result.width = measurement.width, result.height = character.fontSize || 0, result.ascent = result.height, result.descent = 0) : (result.width = measurement.width, result.height = Math.floor(measurement.fontBoundingBoxAscent + measurement.fontBoundingBoxDescent), result.ascent = Math.floor(measurement.fontBoundingBoxAscent), result.descent = result.height - result.ascent), result;
2873
+ },
2874
+ ascent = "actual" === mode ? measurement.actualBoundingBoxAscent : measurement.fontBoundingBoxAscent,
2875
+ descent = "actual" === mode ? measurement.actualBoundingBoxDescent : measurement.fontBoundingBoxDescent;
2876
+ return "number" != typeof ascent || "number" != typeof descent ? (result.width = Math.floor(measurement.width), result.height = character.fontSize || 0, result.ascent = result.height, result.descent = 0) : (result.width = Math.floor(measurement.width), result.height = Math.floor(ascent + descent), result.ascent = Math.floor(ascent), result.descent = result.height - result.ascent), result;
2863
2877
  }
2864
2878
 
2865
2879
  var __decorate$O = undefined && undefined.__decorate || function (decorators, target, key, desc) {
@@ -2885,6 +2899,9 @@ let ATextMeasure = class {
2885
2899
  }
2886
2900
  compatibleMetrics(metrics, options) {
2887
2901
  if (null == metrics.actualBoundingBoxAscent || null == metrics.actualBoundingBoxDescent || null == metrics.fontBoundingBoxAscent || null == metrics.fontBoundingBoxDescent) {
2902
+ metrics = {
2903
+ width: metrics.width
2904
+ };
2888
2905
  const {
2889
2906
  ascent: ascent,
2890
2907
  descent: descent
@@ -2892,6 +2909,13 @@ let ATextMeasure = class {
2892
2909
  metrics.actualBoundingBoxAscent = ascent, metrics.actualBoundingBoxDescent = descent, metrics.fontBoundingBoxAscent = ascent, metrics.fontBoundingBoxDescent = descent;
2893
2910
  }
2894
2911
  if (null == metrics.actualBoundingBoxLeft || null == metrics.actualBoundingBoxRight) {
2912
+ metrics = {
2913
+ width: metrics.width,
2914
+ actualBoundingBoxAscent: metrics.actualBoundingBoxAscent,
2915
+ actualBoundingBoxDescent: metrics.actualBoundingBoxDescent,
2916
+ fontBoundingBoxAscent: metrics.fontBoundingBoxAscent,
2917
+ fontBoundingBoxDescent: metrics.fontBoundingBoxDescent
2918
+ };
2895
2919
  const {
2896
2920
  left: left,
2897
2921
  right: right
@@ -4381,7 +4405,7 @@ class Animate {
4381
4405
  let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Generator.GenAutoIncrementId();
4382
4406
  let timeline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultTimeline;
4383
4407
  let slience = arguments.length > 2 ? arguments[2] : undefined;
4384
- this.id = id, this.timeline = timeline, this.status = AnimateStatus.INITIAL, this.tailAnimate = new SubAnimate(this), this.subAnimates = [this.tailAnimate], this.timeScale = 1, this.rawPosition = -1, this._startTime = 0, this._duringTime = 0, this.timeline.addAnimate(this), this.slience = slience;
4408
+ this.id = id, this.timeline = timeline || defaultTimeline, this.status = AnimateStatus.INITIAL, this.tailAnimate = new SubAnimate(this), this.subAnimates = [this.tailAnimate], this.timeScale = 1, this.rawPosition = -1, this._startTime = 0, this._duringTime = 0, this.timeline.addAnimate(this), this.slience = slience;
4385
4409
  }
4386
4410
  setTimeline(timeline) {
4387
4411
  timeline !== this.timeline && (this.timeline.removeAnimate(this, !1), timeline.addAnimate(this));
@@ -4829,7 +4853,8 @@ class IncreaseCount extends ACustomAnimate {
4829
4853
  }
4830
4854
  onEnd() {}
4831
4855
  onUpdate(end, ratio, out) {
4832
- !1 !== this.valid && (out.text = end ? this.toNumber : (this.fromNumber + (this.toNumber - this.fromNumber) * ratio).toFixed(this.decimalLength));
4856
+ var _a;
4857
+ !1 !== this.valid && (out.text = end ? null === (_a = this.to) || void 0 === _a ? void 0 : _a.text : (this.fromNumber + (this.toNumber - this.fromNumber) * ratio).toFixed(this.decimalLength));
4833
4858
  }
4834
4859
  }
4835
4860
  var Direction;
@@ -5045,7 +5070,7 @@ class ResourceLoader {
5045
5070
  }
5046
5071
  static GetFile(url, type) {
5047
5072
  let data = ResourceLoader.cache.get(url);
5048
- return data ? "init" === data.loadState || "fail" === data.loadState ? Promise.reject() : "loading" === data.loadState ? data.dataPromise.then(data => data.data) : Promise.resolve(data.data) : (data = {
5073
+ return data ? "fail" === data.loadState ? Promise.reject() : "init" === data.loadState || "loading" === data.loadState ? data.dataPromise.then(data => data.data) : Promise.resolve(data.data) : (data = {
5049
5074
  type: type,
5050
5075
  loadState: "init"
5051
5076
  }, ResourceLoader.cache.set(url, data), "arrayBuffer" === type ? data.dataPromise = application.global.loadArrayBuffer(url) : "blob" === type ? data.dataPromise = application.global.loadBlob(url) : "json" === type && (data.dataPromise = application.global.loadJson(url)), data.dataPromise.then(data => data.data));
@@ -8483,7 +8508,7 @@ let Line$1 = class Line extends Graphic {
8483
8508
  } = attribute,
8484
8509
  b = aabbBounds;
8485
8510
  return points.forEach(p => {
8486
- !1 === p.defined && "zero" !== connectedType && "connect" !== connectedType || b.add(p.x, p.y);
8511
+ !1 === p.defined && "connect" !== connectedType || b.add(p.x, p.y);
8487
8512
  }), b;
8488
8513
  }
8489
8514
  updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds, graphic) {
@@ -8494,7 +8519,7 @@ let Line$1 = class Line extends Graphic {
8494
8519
  b = aabbBounds;
8495
8520
  return segments.forEach(s => {
8496
8521
  s.points.forEach(p => {
8497
- !1 === p.defined && "zero" !== connectedType && "connect" !== connectedType || b.add(p.x, p.y);
8522
+ !1 === p.defined && "connect" !== connectedType || b.add(p.x, p.y);
8498
8523
  });
8499
8524
  }), b;
8500
8525
  }
@@ -8746,16 +8771,20 @@ class Frame {
8746
8771
  }
8747
8772
 
8748
8773
  function getFixedLRTB(left, right, top, bottom) {
8774
+ const leftInt = Math.round(left),
8775
+ topInt = Math.round(top),
8776
+ rightInt = Math.round(right),
8777
+ bottomInt = Math.round(bottom);
8749
8778
  return {
8750
- left: Math.round(left),
8751
- top: Math.round(top),
8752
- right: Math.round(right),
8753
- bottom: Math.round(bottom)
8779
+ left: left > leftInt ? leftInt : leftInt - .5,
8780
+ top: top > topInt ? topInt : topInt - .5,
8781
+ right: rightInt > right ? rightInt : rightInt + .5,
8782
+ bottom: bottomInt > bottom ? bottomInt : bottomInt + .5
8754
8783
  };
8755
8784
  }
8756
8785
  class Paragraph {
8757
- constructor(text, newLine, character) {
8758
- this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic";
8786
+ constructor(text, newLine, character, ascentDescentMode) {
8787
+ this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic", this.ascentDescentMode = ascentDescentMode;
8759
8788
  const lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
8760
8789
  this.lineHeight = "number" == typeof lineHeight ? lineHeight > this.fontSize ? lineHeight : this.fontSize : Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
8761
8790
  const {
@@ -8763,7 +8792,7 @@ class Paragraph {
8763
8792
  height: height,
8764
8793
  descent: descent,
8765
8794
  width: width
8766
- } = measureTextCanvas(text, character);
8795
+ } = measureTextCanvas(text, character, this.ascentDescentMode);
8767
8796
  let halfDetaHeight = 0,
8768
8797
  deltaAscent = 0,
8769
8798
  deltaDescent = 0;
@@ -8772,7 +8801,7 @@ class Paragraph {
8772
8801
  updateWidth() {
8773
8802
  const {
8774
8803
  width: width
8775
- } = measureTextCanvas(this.text, this.character);
8804
+ } = measureTextCanvas(this.text, this.character, this.ascentDescentMode);
8776
8805
  this.width = width, "vertical" === this.direction && (this.widthOrigin = this.width, this.width = this.heightOrigin, this.height = this.widthOrigin);
8777
8806
  }
8778
8807
  drawBackground(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
@@ -8789,16 +8818,24 @@ class Paragraph {
8789
8818
  if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
8790
8819
  const {
8791
8820
  width: width
8792
- } = measureTextCanvas(this.text.slice(index), this.character);
8821
+ } = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
8793
8822
  "vertical" === direction || (left -= this.ellipsisWidth - width);
8794
8823
  }
8795
8824
  }
8796
8825
  }
8826
+ switch (this.character.script) {
8827
+ case "super":
8828
+ baseline -= this.ascent * (1 / 3);
8829
+ break;
8830
+ case "sub":
8831
+ baseline += this.descent / 2;
8832
+ }
8833
+ "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);
8834
+ const fillStyle = ctx.fillStyle,
8835
+ globalAlpha = ctx.globalAlpha;
8836
+ ctx.fillStyle = this.character.background, void 0 !== this.character.backgroundOpacity && (ctx.globalAlpha = this.character.backgroundOpacity);
8797
8837
  const lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + lineHeight);
8798
- return Object.assign(Object.assign({}, lrtb), {
8799
- fillStyle: this.character.background,
8800
- globalAlpha: this.character.backgroundOpacity
8801
- });
8838
+ ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top), ctx.fillStyle = fillStyle, ctx.globalAlpha = globalAlpha;
8802
8839
  }
8803
8840
  draw(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
8804
8841
  let baseline = top + ascent,
@@ -8813,7 +8850,7 @@ class Paragraph {
8813
8850
  if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
8814
8851
  const {
8815
8852
  width: width
8816
- } = measureTextCanvas(this.text.slice(index), this.character);
8853
+ } = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
8817
8854
  "vertical" === direction || (left -= this.ellipsisWidth - width);
8818
8855
  }
8819
8856
  }
@@ -8833,21 +8870,21 @@ class Paragraph {
8833
8870
  if (this.character.underline) {
8834
8871
  const top = 1 + baseline,
8835
8872
  lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
8836
- ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);
8873
+ ctx.fillRect(lrtb.left, 1 + baseline, lrtb.right - lrtb.left, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
8837
8874
  }
8838
8875
  if (this.character.lineThrough) {
8839
8876
  const top = 1 + baseline - this.ascent / 2,
8840
8877
  lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
8841
- ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);
8878
+ ctx.fillRect(lrtb.left, 1 + baseline - this.ascent / 2, lrtb.right - lrtb.left, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
8842
8879
  }
8843
8880
  } else if ("underline" === this.character.textDecoration) {
8844
8881
  const top = 1 + baseline,
8845
8882
  lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
8846
- ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);
8883
+ ctx.fillRect(lrtb.left, 1 + baseline, lrtb.right - lrtb.left, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
8847
8884
  } else if ("line-through" === this.character.textDecoration) {
8848
8885
  const top = 1 + baseline - this.ascent / 2,
8849
8886
  lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
8850
- ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);
8887
+ ctx.fillRect(lrtb.left, 1 + baseline - this.ascent / 2, lrtb.right - lrtb.left, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
8851
8888
  }
8852
8889
  "vertical" === direction && ctx.restore();
8853
8890
  }
@@ -8861,7 +8898,7 @@ class Paragraph {
8861
8898
  text = text.slice(0, index), text += this.ellipsisStr;
8862
8899
  const {
8863
8900
  width: measureWidth
8864
- } = measureTextCanvas(this.text.slice(index), this.character);
8901
+ } = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
8865
8902
  return width + this.ellipsisWidth - measureWidth;
8866
8903
  }
8867
8904
  return width;
@@ -8870,7 +8907,7 @@ class Paragraph {
8870
8907
  function seperateParagraph(paragraph, index) {
8871
8908
  const text1 = paragraph.text.slice(0, index),
8872
8909
  text2 = paragraph.text.slice(index);
8873
- return [new Paragraph(text1, paragraph.newLine, paragraph.character), new Paragraph(text2, !0, paragraph.character)];
8910
+ return [new Paragraph(text1, paragraph.newLine, paragraph.character, paragraph.ascentDescentMode), new Paragraph(text2, !0, paragraph.character, paragraph.ascentDescentMode)];
8874
8911
  }
8875
8912
 
8876
8913
  const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", ...GRAPHIC_UPDATE_TAG_KEY];
@@ -9059,7 +9096,7 @@ class Line {
9059
9096
  paragraph.ellipsisStr = ellipsis;
9060
9097
  const {
9061
9098
  width: width
9062
- } = measureTextCanvas(ellipsis, paragraph.character),
9099
+ } = measureTextCanvas(ellipsis, paragraph.character, paragraph.ascentDescentMode),
9063
9100
  ellipsisWidth = width || 0;
9064
9101
  if (ellipsisWidth <= this.blankWidth + otherParagraphWidth) {
9065
9102
  lastLine && (paragraph.ellipsis = "add");
@@ -9072,19 +9109,8 @@ class Line {
9072
9109
  paragraph.ellipsis = "hide", otherParagraphWidth += paragraph.width;
9073
9110
  }
9074
9111
  }
9075
- let fillStyle = "",
9076
- globalAlpha = -1,
9077
- currBgList = [];
9078
- const bgList = [currBgList];
9079
9112
  this.paragraphs.forEach((paragraph, index) => {
9080
- if (paragraph instanceof RichTextIcon) return;
9081
- const data = paragraph.drawBackground(ctx, y, this.ascent, x, 0 === index, this.textAlign, this.height);
9082
- data && (fillStyle === data.fillStyle && globalAlpha === data.globalAlpha || (currBgList = [], bgList.push(currBgList), fillStyle = data.fillStyle, globalAlpha = data.globalAlpha), currBgList.push(data));
9083
- }), bgList.forEach(bg => {
9084
- if (0 === bg.length) return;
9085
- const data = bg[0],
9086
- end = bg[bg.length - 1];
9087
- ctx.fillStyle = data.fillStyle, ctx.globalAlpha = data.globalAlpha, ctx.fillRect(data.left, data.top, end.right - data.left, end.bottom - data.top);
9113
+ paragraph instanceof RichTextIcon || paragraph.drawBackground(ctx, y, this.ascent, x, 0 === index, this.textAlign, this.height);
9088
9114
  }), this.paragraphs.forEach((paragraph, index) => {
9089
9115
  if (paragraph instanceof RichTextIcon) return paragraph.setAttributes({
9090
9116
  x: x + paragraph._x,
@@ -9106,7 +9132,7 @@ class Line {
9106
9132
  if (paragraph instanceof RichTextIcon) break;
9107
9133
  const {
9108
9134
  width: width
9109
- } = measureTextCanvas(ellipsis, paragraph.character),
9135
+ } = measureTextCanvas(ellipsis, paragraph.character, paragraph.ascentDescentMode),
9110
9136
  ellipsisWidth = width || 0;
9111
9137
  if (ellipsisWidth <= this.blankWidth + otherParagraphWidth) {
9112
9138
  paragraph.ellipsis = "add", paragraph.ellipsisWidth = ellipsisWidth;
@@ -9159,6 +9185,12 @@ class Wrapper {
9159
9185
  }
9160
9186
  }
9161
9187
 
9188
+ let supportIntl = !1;
9189
+ try {
9190
+ supportIntl = Intl && "function" == typeof Intl.Segmenter;
9191
+ } catch (e) {
9192
+ supportIntl = !1;
9193
+ }
9162
9194
  const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", "fill", "stroke", "fontSize", "fontFamily", "fontStyle", "fontWeight", "lineWidth", "opacity", "fillOpacity", "strokeOpacity", ...GRAPHIC_UPDATE_TAG_KEY];
9163
9195
  class RichText extends Graphic {
9164
9196
  constructor(params) {
@@ -9247,13 +9279,17 @@ class RichText extends Graphic {
9247
9279
  }
9248
9280
  return cache.every(item => item.isComposing || !(item.text && isString(item.text) && RichText.splitText(item.text).length > 1));
9249
9281
  }
9250
- static splitEmoji(text) {
9251
- return [...new Intl.Segmenter().segment(text)].map(x => x.segment);
9252
- }
9253
9282
  static splitText(text) {
9254
- try {
9255
- return this.splitEmoji(text);
9256
- } catch (e) {}
9283
+ if (supportIntl) {
9284
+ const segmenter = new Intl.Segmenter(void 0, {
9285
+ granularity: "grapheme"
9286
+ }),
9287
+ segments = [];
9288
+ for (const {
9289
+ segment: segment
9290
+ } of segmenter.segment(text)) segments.push(segment);
9291
+ return segments;
9292
+ }
9257
9293
  return Array.from(text);
9258
9294
  }
9259
9295
  static TransformTextConfig2SingleCharacter(textConfig) {
@@ -9269,14 +9305,14 @@ class RichText extends Graphic {
9269
9305
  }), tc;
9270
9306
  }
9271
9307
  updateAABBBounds(attribute, richtextTheme, aabbBounds) {
9272
- var _a, _b;
9308
+ var _a, _b, _c, _d;
9273
9309
  const {
9274
9310
  width = richtextTheme.width,
9275
9311
  height = richtextTheme.height,
9276
9312
  maxWidth = richtextTheme.maxWidth,
9277
9313
  maxHeight = richtextTheme.maxHeight,
9278
9314
  textAlign = richtextTheme.textAlign,
9279
- textBaseline = richtextTheme.textBaseline,
9315
+ verticalDirection = null !== (_b = null !== (_a = attribute.textBaseline) && void 0 !== _a ? _a : richtextTheme.textBaseline) && void 0 !== _b ? _b : richtextTheme.verticalDirection,
9280
9316
  editOptions: editOptions
9281
9317
  } = attribute;
9282
9318
  if (width > 0 && height > 0) aabbBounds.set(0, 0, width, height);else {
@@ -9289,9 +9325,9 @@ class RichText extends Graphic {
9289
9325
  contentHeight = height || actualHeight || 0;
9290
9326
  contentHeight = "number" == typeof maxHeight && contentHeight > maxHeight ? maxHeight : contentHeight || 0, contentWidth = "number" == typeof maxWidth && contentWidth > maxWidth ? maxWidth : contentWidth || 0, aabbBounds.set(0, 0, contentWidth, contentHeight);
9291
9327
  }
9292
- editOptions && editOptions.keepHeightWhileEmpty && !aabbBounds.height() && !(null === (_a = attribute.textConfig) || void 0 === _a ? void 0 : _a.length) && (aabbBounds.y2 = aabbBounds.y1 + (null !== (_b = attribute.fontSize) && void 0 !== _b ? _b : 12), aabbBounds.x2 = aabbBounds.x1 + 2);
9328
+ editOptions && editOptions.keepHeightWhileEmpty && !aabbBounds.height() && !(null === (_c = attribute.textConfig) || void 0 === _c ? void 0 : _c.length) && (aabbBounds.y2 = aabbBounds.y1 + (null !== (_d = attribute.fontSize) && void 0 !== _d ? _d : 12), aabbBounds.x2 = aabbBounds.x1 + 2);
9293
9329
  let deltaY = 0;
9294
- switch (textBaseline) {
9330
+ switch (verticalDirection) {
9295
9331
  case "top":
9296
9332
  deltaY = 0;
9297
9333
  break;
@@ -9379,7 +9415,8 @@ class RichText extends Graphic {
9379
9415
  layoutDirection: layoutDirection,
9380
9416
  singleLine: singleLine,
9381
9417
  disableAutoWrapLine: disableAutoWrapLine,
9382
- editable: editable
9418
+ editable: editable,
9419
+ ascentDescentMode: ascentDescentMode
9383
9420
  } = this.attribute;
9384
9421
  let {
9385
9422
  textConfig: _tc = []
@@ -9402,8 +9439,8 @@ class RichText extends Graphic {
9402
9439
  const richTextConfig = this.combinedStyleToCharacter(textConfig[i]);
9403
9440
  if (isNumber(richTextConfig.text) && (richTextConfig.text = `${richTextConfig.text}`), richTextConfig.text && richTextConfig.text.includes("\n")) {
9404
9441
  const textParts = richTextConfig.text.split("\n");
9405
- for (let j = 0; j < textParts.length; j++) paragraphs.push(new Paragraph(textParts[j], 0 !== j, richTextConfig));
9406
- } else richTextConfig.text && paragraphs.push(new Paragraph(richTextConfig.text, !1, richTextConfig));
9442
+ for (let j = 0; j < textParts.length; j++) paragraphs.push(new Paragraph(textParts[j], 0 !== j, richTextConfig, ascentDescentMode));
9443
+ } else richTextConfig.text && paragraphs.push(new Paragraph(richTextConfig.text, !1, richTextConfig, ascentDescentMode));
9407
9444
  }
9408
9445
  const maxWidthFinite = "number" == typeof maxWidth && Number.isFinite(maxWidth) && maxWidth > 0,
9409
9446
  maxHeightFinite = "number" == typeof maxHeight && Number.isFinite(maxHeight) && maxHeight > 0,
@@ -10137,6 +10174,7 @@ class DefaultBaseBackgroundRenderContribution {
10137
10174
  opacity = graphicAttribute.opacity,
10138
10175
  backgroundMode = graphicAttribute.backgroundMode,
10139
10176
  backgroundFit = graphicAttribute.backgroundFit,
10177
+ backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
10140
10178
  backgroundScale = graphicAttribute.backgroundScale,
10141
10179
  backgroundOffsetX = graphicAttribute.backgroundOffsetX,
10142
10180
  backgroundOffsetY = graphicAttribute.backgroundOffsetY,
@@ -10158,6 +10196,7 @@ class DefaultBaseBackgroundRenderContribution {
10158
10196
  context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, this.doDrawImage(context, res.data, b, {
10159
10197
  backgroundMode: backgroundMode,
10160
10198
  backgroundFit: backgroundFit,
10199
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio,
10161
10200
  backgroundScale: backgroundScale,
10162
10201
  backgroundOffsetX: backgroundOffsetX,
10163
10202
  backgroundOffsetY: backgroundOffsetY
@@ -10168,6 +10207,7 @@ class DefaultBaseBackgroundRenderContribution {
10168
10207
  const {
10169
10208
  backgroundMode: backgroundMode,
10170
10209
  backgroundFit: backgroundFit,
10210
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio,
10171
10211
  backgroundScale = 1,
10172
10212
  backgroundOffsetX = 0,
10173
10213
  backgroundOffsetY = 0
@@ -10177,7 +10217,12 @@ class DefaultBaseBackgroundRenderContribution {
10177
10217
  let w = targetW,
10178
10218
  h = targetH;
10179
10219
  if ("no-repeat" === backgroundMode) {
10180
- if (backgroundFit) context.drawImage(data, b.x1, b.y1, b.width(), b.height());else {
10220
+ if (backgroundFit) {
10221
+ if (backgroundKeepAspectRatio) {
10222
+ const maxScale = Math.max(targetW / data.width, targetH / data.height);
10223
+ context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, data.width * maxScale * backgroundScale, data.height * maxScale * backgroundScale);
10224
+ } else context.drawImage(data, b.x1, b.y1, b.width(), b.height());
10225
+ } else {
10181
10226
  const resW = data.width * backgroundScale,
10182
10227
  resH = data.height * backgroundScale;
10183
10228
  context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, resW, resH);
@@ -10483,6 +10528,7 @@ class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRend
10483
10528
  background: background,
10484
10529
  backgroundMode = graphicAttribute.backgroundMode,
10485
10530
  backgroundFit = graphicAttribute.backgroundFit,
10531
+ backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
10486
10532
  backgroundScale = graphicAttribute.backgroundScale,
10487
10533
  backgroundOffsetX = graphicAttribute.backgroundOffsetX,
10488
10534
  backgroundOffsetY = graphicAttribute.backgroundOffsetY
@@ -10495,6 +10541,7 @@ class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRend
10495
10541
  this.doDrawImage(context, res.data, b, {
10496
10542
  backgroundMode: backgroundMode,
10497
10543
  backgroundFit: backgroundFit,
10544
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio,
10498
10545
  backgroundScale: backgroundScale,
10499
10546
  backgroundOffsetX: backgroundOffsetX,
10500
10547
  backgroundOffsetY: backgroundOffsetY
@@ -10676,8 +10723,8 @@ class DefaultImageRenderContribution extends DefaultRectRenderContribution {
10676
10723
  constructor() {
10677
10724
  super(...arguments), this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
10678
10725
  }
10679
- drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
10680
- return super.drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
10726
+ drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
10727
+ return super.drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
10681
10728
  }
10682
10729
  }
10683
10730
  const defaultImageRenderContribution = new DefaultImageRenderContribution();
@@ -11140,7 +11187,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
11140
11187
  this._draw(line, lineAttribute, !1, drawContext, params);
11141
11188
  }
11142
11189
  drawSegmentItem(context, cache, fill, stroke, fillOpacity, strokeOpacity, attribute, defaultAttribute, clipRange, clipRangeByDimension, offsetX, offsetY, line, fillCb, strokeCb) {
11143
- var _a, _b, _c, _d, _e;
11190
+ var _a;
11144
11191
  if (!cache) return;
11145
11192
  context.beginPath();
11146
11193
  const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
@@ -11153,27 +11200,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
11153
11200
  x: originX = 0,
11154
11201
  x: originY = 0
11155
11202
  } = attribute;
11156
- !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.stroke()));
11157
- let {
11158
- connectedType: connectedType,
11159
- connectedX: connectedX,
11160
- connectedY: connectedY,
11161
- connectedStyle: connectedStyle
11162
- } = attribute;
11163
- if (isArray(defaultAttribute) ? (connectedType = null !== (_b = null != connectedType ? connectedType : defaultAttribute[0].connectedType) && void 0 !== _b ? _b : defaultAttribute[1].connectedType, connectedX = null !== (_c = null != connectedX ? connectedX : defaultAttribute[0].connectedX) && void 0 !== _c ? _c : defaultAttribute[1].connectedX, connectedY = null !== (_d = null != connectedY ? connectedY : defaultAttribute[0].connectedY) && void 0 !== _d ? _d : defaultAttribute[1].connectedY, connectedStyle = null !== (_e = null != connectedStyle ? connectedStyle : defaultAttribute[0].connectedStyle) && void 0 !== _e ? _e : defaultAttribute[1].connectedStyle) : (connectedType = null != connectedType ? connectedType : defaultAttribute.connectedType, connectedX = null != connectedX ? connectedX : defaultAttribute.connectedX, connectedY = null != connectedY ? connectedY : defaultAttribute.connectedY, connectedStyle = null != connectedStyle ? connectedStyle : defaultAttribute.connectedStyle), "connect" !== connectedType && "zero" !== connectedType && (connectedType = "none"), "none" !== connectedType) {
11164
- context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, cache, clipRange, clipRangeByDimension, {
11165
- offsetX: offsetX,
11166
- offsetY: offsetY,
11167
- offsetZ: z,
11168
- drawConnect: !0,
11169
- mode: connectedType,
11170
- zeroX: connectedX,
11171
- zeroY: connectedY
11172
- });
11173
- const da = [];
11174
- isArray(defaultAttribute) ? defaultAttribute.forEach(i => da.push(i)) : da.push(defaultAttribute), da.push(attribute), !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da), context.stroke()));
11175
- }
11176
- return !1;
11203
+ return !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.stroke())), !1;
11177
11204
  }
11178
11205
  drawLinearLineHighPerformance(line, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, lineAttribute, drawContext, params, fillCb, strokeCb) {
11179
11206
  var _a;
@@ -11205,7 +11232,8 @@ let DefaultCanvasLineRender = class extends BaseRender {
11205
11232
  segments: segments,
11206
11233
  points: points,
11207
11234
  closePath: closePath,
11208
- curveTension = lineAttribute.curveTension
11235
+ curveTension = lineAttribute.curveTension,
11236
+ connectedType = lineAttribute.connectedType
11209
11237
  } = line.attribute;
11210
11238
  if (!this.valid(line, lineAttribute, fillCb, strokeCb)) return;
11211
11239
  let {
@@ -11217,6 +11245,9 @@ let DefaultCanvasLineRender = class extends BaseRender {
11217
11245
  clipRangeByDimension = lineAttribute.clipRangeByDimension
11218
11246
  } = line.attribute;
11219
11247
  if (1 === clipRange && !segments && !points.some(p => !1 === p.defined) && "linear" === curveType) return this.drawLinearLineHighPerformance(line, context, !!fill, !!stroke, fillOpacity, strokeOpacity, x, y, lineAttribute, drawContext, params, fillCb, strokeCb);
11248
+ function parsePoint(points, connectedType) {
11249
+ return "none" === connectedType ? points : points.filter(p => !1 !== p.defined);
11250
+ }
11220
11251
  if (line.shouldUpdateShape()) {
11221
11252
  const {
11222
11253
  points: points,
@@ -11238,7 +11269,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
11238
11269
  y: lastSeg.endY,
11239
11270
  defined: lastSeg.curves[lastSeg.curves.length - 1].defined
11240
11271
  } : index > 1 && (startPoint.x = lastSeg.endX, startPoint.y = lastSeg.endY, startPoint.defined = lastSeg.curves[lastSeg.curves.length - 1].defined);
11241
- const data = calcLineCache(seg.points, curveType, {
11272
+ const data = calcLineCache(parsePoint(seg.points, connectedType), curveType, {
11242
11273
  startPoint: startPoint,
11243
11274
  curveTension: curveTension
11244
11275
  });
@@ -11257,7 +11288,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
11257
11288
  }
11258
11289
  } else {
11259
11290
  if (!points || !points.length) return line.cache = null, void line.clearUpdateShapeTag();
11260
- line.cache = calcLineCache(_points, curveType, {
11291
+ line.cache = calcLineCache(parsePoint(_points, connectedType), curveType, {
11261
11292
  curveTension: curveTension
11262
11293
  });
11263
11294
  }
@@ -11289,11 +11320,6 @@ DefaultCanvasLineRender = __decorate$E([injectable()], DefaultCanvasLineRender);
11289
11320
 
11290
11321
  function drawAreaSegments(path, segPath, percent, params) {
11291
11322
  var _a;
11292
- const {
11293
- drawConnect = !1,
11294
- mode = "none"
11295
- } = params || {};
11296
- if (drawConnect && "none" === mode) return;
11297
11323
  const {
11298
11324
  top: top,
11299
11325
  bottom: bottom
@@ -11303,34 +11329,11 @@ function drawAreaSegments(path, segPath, percent, params) {
11303
11329
  const topList = [],
11304
11330
  bottomList = [];
11305
11331
  let lastDefined = !0;
11306
- if (drawConnect) {
11307
- let lastCurve,
11308
- lastBottomCurve,
11309
- defined0 = !0;
11310
- const n = top.curves.length;
11311
- top.curves.forEach((curve, i) => {
11312
- const bototmCurve = bottom.curves[n - i - 1];
11313
- let currentTopCurve = curve,
11314
- currentBottomCurve = bototmCurve;
11315
- if (curve.originP1 === curve.originP2) return lastCurve = curve, void (lastBottomCurve = bototmCurve);
11316
- if (lastCurve && lastCurve.originP1 === lastCurve.originP2 && (currentTopCurve = lastCurve, currentBottomCurve = lastBottomCurve), curve.defined) defined0 || (topList.push(currentTopCurve), bottomList.push(currentBottomCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0, defined0 = !defined0);else {
11317
- const {
11318
- originP1: originP1,
11319
- originP2: originP2
11320
- } = curve;
11321
- let validTopCurve, validBottomCurve;
11322
- originP1 && !1 !== originP1.defined ? (validTopCurve = currentTopCurve, validBottomCurve = currentBottomCurve) : originP1 && !1 !== originP2.defined && (validTopCurve = curve, validBottomCurve = bototmCurve), defined0 ? (defined0 = !defined0, topList.push(validTopCurve || curve), bottomList.push(validBottomCurve || bototmCurve)) : validTopCurve && (defined0 = !defined0, topList.push(validTopCurve || curve), bottomList.push(validBottomCurve || bototmCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0);
11323
- }
11324
- lastCurve = curve;
11325
- }), drawAreaConnectBlock(path, topList, bottomList, params);
11326
- } else {
11327
- for (let i = 0, n = top.curves.length; i < n; i++) {
11328
- const topCurve = top.curves[i];
11329
- lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1])), lastDefined = !lastDefined) : lastDefined && (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1]));
11330
- }
11331
- drawAreaBlock(path, topList, bottomList, params);
11332
+ for (let i = 0, n = top.curves.length; i < n; i++) {
11333
+ const topCurve = top.curves[i];
11334
+ lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1])), lastDefined = !lastDefined) : lastDefined && (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1]));
11332
11335
  }
11333
- return;
11336
+ return void drawAreaBlock(path, topList, bottomList, params);
11334
11337
  }
11335
11338
  if (percent <= 0) return;
11336
11339
  let {
@@ -11348,51 +11351,17 @@ function drawAreaSegments(path, segPath, percent, params) {
11348
11351
  lastDefined = !0;
11349
11352
  const topList = [],
11350
11353
  bottomList = [];
11351
- let lastTopCurve,
11352
- lastBottomCurve,
11353
- defined0 = !0;
11354
11354
  for (let i = 0, n = top.curves.length; i < n; i++) {
11355
11355
  const topCurve = top.curves[i],
11356
11356
  curCurveLength = topCurve.getLength(direction),
11357
11357
  percent = (totalDrawLength - drawedLengthUntilLast) / curCurveLength;
11358
11358
  if (percent < 0) break;
11359
- if (drawedLengthUntilLast += curCurveLength, drawConnect) {
11360
- const bototmCurve = bottom.curves[n - i - 1];
11361
- let currentTopCurve = topCurve,
11362
- currentBottomCurve = bototmCurve;
11363
- if (topCurve.originP1 === topCurve.originP2) {
11364
- lastTopCurve = topCurve, lastBottomCurve = bototmCurve;
11365
- continue;
11366
- }
11367
- if (lastTopCurve && lastTopCurve.originP1 === lastTopCurve.originP2 && (currentTopCurve = lastTopCurve, currentBottomCurve = lastBottomCurve), topCurve.defined) defined0 || (topList.push(currentTopCurve), bottomList.push(currentBottomCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0, defined0 = !defined0);else {
11368
- const {
11369
- originP1: originP1,
11370
- originP2: originP2
11371
- } = topCurve;
11372
- let validTopCurve, validBottomCurve;
11373
- originP1 && !1 !== originP1.defined ? (validTopCurve = currentTopCurve, validBottomCurve = currentBottomCurve) : originP1 && !1 !== originP2.defined && (validTopCurve = topCurve, validBottomCurve = bototmCurve), defined0 ? (defined0 = !defined0, topList.push(validTopCurve || topCurve), bottomList.push(validBottomCurve || bototmCurve)) : validTopCurve && (defined0 = !defined0, topList.push(validTopCurve || topCurve), bottomList.push(validBottomCurve || bototmCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0);
11374
- }
11375
- lastTopCurve = topCurve;
11376
- } else {
11377
- let tc = null,
11378
- bc = null;
11379
- lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (tc = topCurve, bc = bottom.curves[n - i - 1]), lastDefined = !lastDefined) : lastDefined && (tc = topCurve, bc = bottom.curves[n - i - 1]), tc && bc && (percent < 1 && (tc = tc.p2 && tc.p3 ? divideCubic(tc, percent)[0] : divideLinear(tc, percent)[0], bc = bc.p2 && bc.p3 ? divideCubic(bc, 1 - percent)[1] : divideLinear(bc, 1 - percent)[1]), tc.defined = lastDefined, bc.defined = lastDefined, topList.push(tc), bottomList.push(bc)), tc = null, bc = null;
11380
- }
11359
+ drawedLengthUntilLast += curCurveLength;
11360
+ let tc = null,
11361
+ bc = null;
11362
+ lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (tc = topCurve, bc = bottom.curves[n - i - 1]), lastDefined = !lastDefined) : lastDefined && (tc = topCurve, bc = bottom.curves[n - i - 1]), tc && bc && (percent < 1 && (tc = tc.p2 && tc.p3 ? divideCubic(tc, percent)[0] : divideLinear(tc, percent)[0], bc = bc.p2 && bc.p3 ? divideCubic(bc, 1 - percent)[1] : divideLinear(bc, 1 - percent)[1]), tc.defined = lastDefined, bc.defined = lastDefined, topList.push(tc), bottomList.push(bc)), tc = null, bc = null;
11381
11363
  }
11382
- drawConnect ? drawAreaConnectBlock(path, topList, bottomList, params) : drawAreaBlock(path, topList, bottomList, params);
11383
- }
11384
- function drawAreaConnectBlock(path, topList, bottomList, params) {
11385
- if (topList.length < 2) return;
11386
- const {
11387
- offsetX = 0,
11388
- offsetY = 0,
11389
- offsetZ = 0,
11390
- mode: mode
11391
- } = params || {};
11392
- let curve = topList[0];
11393
- path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), curve = topList[topList.length - 1];
11394
- let end = curve.p3 || curve.p1;
11395
- path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ), curve = bottomList[bottomList.length - 1], path.lineTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), curve = bottomList[0], end = curve.p3 || curve.p1, path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ), path.closePath();
11364
+ drawAreaBlock(path, topList, bottomList, params);
11396
11365
  }
11397
11366
  function drawAreaBlock(path, topList, bottomList, params) {
11398
11367
  const {
@@ -11493,7 +11462,8 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11493
11462
  fillOpacity = areaAttribute.fillOpacity,
11494
11463
  z = areaAttribute.z,
11495
11464
  strokeOpacity = areaAttribute.strokeOpacity,
11496
- curveTension = areaAttribute.curveTension
11465
+ curveTension = areaAttribute.curveTension,
11466
+ connectedType = areaAttribute.connectedType
11497
11467
  } = area.attribute,
11498
11468
  data = this.valid(area, areaAttribute, fillCb, strokeCb);
11499
11469
  if (!data) return;
@@ -11510,6 +11480,9 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11510
11480
  let {
11511
11481
  curveType = areaAttribute.curveType
11512
11482
  } = area.attribute;
11483
+ function parsePoint(points, connectedType) {
11484
+ return "connect" !== connectedType ? points : points.filter(p => !1 !== p.defined);
11485
+ }
11513
11486
  if (closePath && "linear" === curveType && (curveType = "linearClosed"), 1 === clipRange && !segments && !points.some(p => !1 === p.defined) && "linear" === curveType) return this.drawLinearAreaHighPerformance(area, context, !!fill, doStroke, fillOpacity, strokeOpacity, x, y, areaAttribute, drawContext, params, fillCb, strokeCb);
11514
11487
  if (area.shouldUpdateShape()) {
11515
11488
  if (segments && segments.length) {
@@ -11523,7 +11496,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11523
11496
  x: lastTopSeg.endX,
11524
11497
  y: lastTopSeg.endY
11525
11498
  } : index > 1 && (startPoint.x = lastTopSeg.endX, startPoint.y = lastTopSeg.endY);
11526
- const data = calcLineCache(seg.points, curveType, {
11499
+ const data = calcLineCache(parsePoint(seg.points, connectedType), curveType, {
11527
11500
  startPoint: startPoint,
11528
11501
  curveTension: curveTension
11529
11502
  });
@@ -11546,7 +11519,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11546
11519
  y: null !== (_d = endPoint.y1) && void 0 !== _d ? _d : endPoint.y
11547
11520
  });
11548
11521
  }
11549
- bottomPoints.length > 1 && (lastBottomSeg = calcLineCache(bottomPoints, "stepBefore" === curveType ? "stepAfter" : "stepAfter" === curveType ? "stepBefore" : curveType, {
11522
+ bottomPoints.length > 1 && (lastBottomSeg = calcLineCache(parsePoint(bottomPoints, connectedType), "stepBefore" === curveType ? "stepAfter" : "stepAfter" === curveType ? "stepBefore" : curveType, {
11550
11523
  curveTension: curveTension
11551
11524
  }), bottomCaches.unshift(lastBottomSeg));
11552
11525
  }
@@ -11557,11 +11530,11 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11557
11530
  } else {
11558
11531
  if (!points || !points.length) return area.cacheArea = null, void area.clearUpdateShapeTag();
11559
11532
  {
11560
- const topPoints = points,
11533
+ const topPoints = parsePoint(points, connectedType),
11561
11534
  bottomPoints = [];
11562
- for (let i = points.length - 1; i >= 0; i--) bottomPoints.push({
11563
- x: null !== (_e = points[i].x1) && void 0 !== _e ? _e : points[i].x,
11564
- y: null !== (_f = points[i].y1) && void 0 !== _f ? _f : points[i].y
11535
+ for (let i = topPoints.length - 1; i >= 0; i--) bottomPoints.push({
11536
+ x: null !== (_e = topPoints[i].x1) && void 0 !== _e ? _e : topPoints[i].x,
11537
+ y: null !== (_f = topPoints[i].y1) && void 0 !== _f ? _f : topPoints[i].y
11565
11538
  });
11566
11539
  const topCache = calcLineCache(topPoints, curveType, {
11567
11540
  curveTension: curveTension
@@ -11603,20 +11576,10 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11603
11576
  this._draw(area, areaAttribute, !1, drawContext, params);
11604
11577
  }
11605
11578
  drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb) {
11606
- let ret = !1;
11607
- return ret = ret || this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, !1, fillCb, strokeCb), ret = ret || this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, !0, fillCb, strokeCb), ret;
11579
+ return this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb);
11608
11580
  }
11609
- _drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, connect, fillCb, strokeCb) {
11610
- var _a, _b, _c, _d;
11581
+ _drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb) {
11611
11582
  if (!(cache && cache.top && cache.bottom && cache.top.curves && cache.top.curves.length && cache.bottom.curves && cache.bottom.curves.length)) return;
11612
- let {
11613
- connectedType: connectedType,
11614
- connectedX: connectedX,
11615
- connectedY: connectedY,
11616
- connectedStyle: connectedStyle
11617
- } = attribute;
11618
- const da = [];
11619
- if (connect && (isArray(defaultAttribute) ? (connectedType = null !== (_a = null != connectedType ? connectedType : defaultAttribute[0].connectedType) && void 0 !== _a ? _a : defaultAttribute[1].connectedType, connectedX = null !== (_b = null != connectedX ? connectedX : defaultAttribute[0].connectedX) && void 0 !== _b ? _b : defaultAttribute[1].connectedX, connectedY = null !== (_c = null != connectedY ? connectedY : defaultAttribute[0].connectedY) && void 0 !== _c ? _c : defaultAttribute[1].connectedY, connectedStyle = null !== (_d = null != connectedStyle ? connectedStyle : defaultAttribute[0].connectedStyle) && void 0 !== _d ? _d : defaultAttribute[1].connectedStyle) : (connectedType = null != connectedType ? connectedType : defaultAttribute.connectedType, connectedX = null != connectedX ? connectedX : defaultAttribute.connectedX, connectedY = null != connectedY ? connectedY : defaultAttribute.connectedY, connectedStyle = null != connectedStyle ? connectedStyle : defaultAttribute.connectedStyle), "connect" !== connectedType && "zero" !== connectedType && (connectedType = "none"), isArray(defaultAttribute) ? defaultAttribute.forEach(i => da.push(i)) : da.push(defaultAttribute), da.push(attribute)), connect && "none" === connectedType) return !1;
11620
11583
  context.beginPath();
11621
11584
  const {
11622
11585
  points: points,
@@ -11635,11 +11598,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11635
11598
  offsetX: offsetX,
11636
11599
  offsetY: offsetY,
11637
11600
  offsetZ: offsetZ,
11638
- direction: direction,
11639
- drawConnect: connect,
11640
- mode: connectedType,
11641
- zeroX: connectedX,
11642
- zeroY: connectedY
11601
+ direction: direction
11643
11602
  }), this.beforeRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
11644
11603
  attribute: attribute
11645
11604
  }), context.setShadowBlendStyle && context.setShadowBlendStyle(area, attribute, defaultAttribute);
@@ -11647,7 +11606,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11647
11606
  x: originX = 0,
11648
11607
  x: originY = 0
11649
11608
  } = attribute;
11650
- return !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.fill())), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
11609
+ return !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.fill())), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
11651
11610
  attribute: attribute
11652
11611
  }), (() => {
11653
11612
  if (!1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute);else {
@@ -11657,12 +11616,8 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11657
11616
  isArray(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1] && (context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, stroke[0] ? cache.top : cache.bottom, clipRange, direction === Direction$1.ROW ? "x" : "y", {
11658
11617
  offsetX: offsetX,
11659
11618
  offsetY: offsetY,
11660
- offsetZ: offsetZ,
11661
- drawConnect: connect,
11662
- mode: connectedType,
11663
- zeroX: connectedX,
11664
- zeroY: connectedY
11665
- })), context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.stroke();
11619
+ offsetZ: offsetZ
11620
+ })), context.setStrokeStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.stroke();
11666
11621
  }
11667
11622
  })(), !1;
11668
11623
  }
@@ -11918,7 +11873,8 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
11918
11873
  var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
11919
11874
  const {
11920
11875
  backgroundMode = graphicAttribute.backgroundMode,
11921
- backgroundFit = graphicAttribute.backgroundFit
11876
+ backgroundFit = graphicAttribute.backgroundFit,
11877
+ backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio
11922
11878
  } = graphic.attribute;
11923
11879
  let matrix,
11924
11880
  {
@@ -11957,7 +11913,8 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
11957
11913
  if ("success" !== res.state || !res.data) return void restore();
11958
11914
  context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, {
11959
11915
  backgroundMode: backgroundMode,
11960
- backgroundFit: backgroundFit
11916
+ backgroundFit: backgroundFit,
11917
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio
11961
11918
  }), context.highPerformanceRestore(), context.setTransformForCurrent();
11962
11919
  } else {
11963
11920
  const {
@@ -13074,7 +13031,7 @@ var __decorate$q = undefined && undefined.__decorate || function (decorators, ta
13074
13031
  };
13075
13032
  let DefaultDrawContribution = class {
13076
13033
  constructor(contributions, drawItemInterceptorContributions) {
13077
- this.contributions = contributions, this.drawItemInterceptorContributions = drawItemInterceptorContributions, this.currentRenderMap = new Map(), this.defaultRenderMap = new Map(), this.styleRenderMap = new Map(), this.dirtyBounds = new Bounds(), this.backupDirtyBounds = new Bounds(), this.global = application.global, this.layerService = application.layerService, this.init();
13034
+ this.contributions = contributions, this.drawItemInterceptorContributions = drawItemInterceptorContributions, this.currentRenderMap = new Map(), this.defaultRenderMap = new Map(), this.styleRenderMap = new Map(), this.dirtyBounds = new Bounds(), this.backupDirtyBounds = new Bounds(), this.global = application.global, this.layerService = application.layerService, isArray(this.contributions) || (this.contributions = [this.contributions]), this.init();
13078
13035
  }
13079
13036
  init() {
13080
13037
  this.contributions.forEach(item => {
@@ -13877,6 +13834,7 @@ class PickerBase {
13877
13834
  contains(graphic, point, params) {
13878
13835
  if (!graphic.AABBBounds.containsPoint(point)) return !1;
13879
13836
  if ("imprecise" === graphic.attribute.pickMode) return !0;
13837
+ if (!this.canvasRenderer) return !0;
13880
13838
  const {
13881
13839
  pickContext: pickContext
13882
13840
  } = null != params ? params : {};
@@ -20581,15 +20539,19 @@ class LabelBase extends AbstractComponent {
20581
20539
  if (isFunction(dataFilter)) {
20582
20540
  data = dataFilter(data);
20583
20541
  }
20542
+ if (data && data.length) {
20543
+ const seenIds = new Set();
20544
+ data = data.filter(d => !seenIds.has(d.id) && seenIds.add(d.id));
20545
+ }
20584
20546
  let labels = this._initText(data);
20585
20547
  if (isFunction(customLayoutFunc)) {
20586
- labels = customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null);
20548
+ labels = customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null, this);
20587
20549
  }
20588
20550
  else {
20589
20551
  labels = this._layout(labels);
20590
20552
  }
20591
20553
  if (isFunction(customOverlapFunc)) {
20592
- labels = customOverlapFunc(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null);
20554
+ labels = customOverlapFunc(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null, this);
20593
20555
  }
20594
20556
  else {
20595
20557
  if (overlap !== false) {
@@ -20597,7 +20559,7 @@ class LabelBase extends AbstractComponent {
20597
20559
  }
20598
20560
  }
20599
20561
  if (isFunction(this.attribute.onAfterOverlapping)) {
20600
- this.attribute.onAfterOverlapping(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null);
20562
+ this.attribute.onAfterOverlapping(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null, this);
20601
20563
  }
20602
20564
  if (labels && labels.length) {
20603
20565
  labels.forEach(label => {
@@ -24699,34 +24661,23 @@ class MarkArea extends Marker {
24699
24661
  }
24700
24662
  getPointAttrByPosition(position) {
24701
24663
  const { x1, x2, y1, y2 } = this._area.AABBBounds;
24664
+ const result = {
24665
+ x: (x1 + x2) / 2,
24666
+ y: (y1 + y2) / 2
24667
+ };
24702
24668
  if (position.includes('left') || position.includes('Left')) {
24703
- return {
24704
- x: x1,
24705
- y: (y1 + y2) / 2
24706
- };
24669
+ result.x = x1;
24707
24670
  }
24708
24671
  if (position.includes('right') || position.includes('Right')) {
24709
- return {
24710
- x: x2,
24711
- y: (y1 + y2) / 2
24712
- };
24672
+ result.x = x2;
24713
24673
  }
24714
24674
  if (position.includes('top') || position.includes('Top')) {
24715
- return {
24716
- x: (x1 + x2) / 2,
24717
- y: y1
24718
- };
24675
+ result.y = y1;
24719
24676
  }
24720
24677
  if (position.includes('bottom') || position.includes('Bottom')) {
24721
- return {
24722
- x: (x1 + x2) / 2,
24723
- y: y2
24724
- };
24678
+ result.y = y2;
24725
24679
  }
24726
- return {
24727
- x: (x1 + x2) / 2,
24728
- y: (y1 + y2) / 2
24729
- };
24680
+ return result;
24730
24681
  }
24731
24682
  setLabelPos() {
24732
24683
  var _a;
@@ -28156,35 +28107,36 @@ class Title extends AbstractComponent {
28156
28107
  this.name = 'title';
28157
28108
  }
28158
28109
  render() {
28159
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
28110
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
28160
28111
  const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute;
28161
28112
  const parsedPadding = normalizePadding(padding);
28162
28113
  const group = this.createOrUpdateChild('title-container', { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 }, 'group');
28114
+ const fixedMainTitleHeight = (_a = textStyle.height) !== null && _a !== void 0 ? _a : height;
28163
28115
  if (this.attribute.visible !== false && textStyle.visible !== false) {
28164
- const { width: mainTitleWidth, height: mainTitleHeight, maxHeight: mainTitleMaxHeight, maxWidth: mainTitleMaxWidth, x = 0, y = 0, ellipsis = true, wordBreak = 'break-word', maxWidth, lineClamp } = textStyle;
28116
+ const { width: mainTitleWidth, maxHeight: mainTitleMaxHeight, maxWidth: mainTitleMaxWidth, x = 0, y = 0, ellipsis = true, wordBreak = 'break-word', maxWidth, lineClamp } = textStyle;
28165
28117
  if (textType === 'rich' || isValid(textStyle.character)) {
28166
28118
  const attr = Object.assign({ x,
28167
- y, width: (_a = mainTitleWidth !== null && mainTitleWidth !== void 0 ? mainTitleWidth : width) !== null && _a !== void 0 ? _a : 0, height: (_b = mainTitleHeight !== null && mainTitleHeight !== void 0 ? mainTitleHeight : height) !== null && _b !== void 0 ? _b : 0, ellipsis: ellipsis !== null && ellipsis !== void 0 ? ellipsis : true, wordBreak: wordBreak !== null && wordBreak !== void 0 ? wordBreak : 'break-word', maxHeight: mainTitleMaxHeight !== null && mainTitleMaxHeight !== void 0 ? mainTitleMaxHeight : maxHeight, maxWidth: mainTitleMaxWidth !== null && mainTitleMaxWidth !== void 0 ? mainTitleMaxWidth : maxWidth, textConfig: (_c = textStyle.character) !== null && _c !== void 0 ? _c : text }, textStyle);
28119
+ y, width: (_b = mainTitleWidth !== null && mainTitleWidth !== void 0 ? mainTitleWidth : width) !== null && _b !== void 0 ? _b : 0, height: fixedMainTitleHeight !== null && fixedMainTitleHeight !== void 0 ? fixedMainTitleHeight : 0, ellipsis: ellipsis !== null && ellipsis !== void 0 ? ellipsis : true, wordBreak: wordBreak !== null && wordBreak !== void 0 ? wordBreak : 'break-word', maxHeight: mainTitleMaxHeight !== null && mainTitleMaxHeight !== void 0 ? mainTitleMaxHeight : maxHeight, maxWidth: mainTitleMaxWidth !== null && mainTitleMaxWidth !== void 0 ? mainTitleMaxWidth : maxWidth, textConfig: (_c = textStyle.character) !== null && _c !== void 0 ? _c : text }, textStyle);
28168
28120
  this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
28169
28121
  }
28170
28122
  else if (textType === 'html') {
28171
28123
  const attr = Object.assign({ html: Object.assign(Object.assign({ dom: text }, DEFAULT_HTML_TEXT_SPEC), textStyle), x,
28172
- y, width: (_d = mainTitleWidth !== null && mainTitleWidth !== void 0 ? mainTitleWidth : width) !== null && _d !== void 0 ? _d : 0, height: (_e = mainTitleHeight !== null && mainTitleHeight !== void 0 ? mainTitleHeight : height) !== null && _e !== void 0 ? _e : 0, ellipsis,
28124
+ y, width: (_d = mainTitleWidth !== null && mainTitleWidth !== void 0 ? mainTitleWidth : width) !== null && _d !== void 0 ? _d : 0, height: fixedMainTitleHeight !== null && fixedMainTitleHeight !== void 0 ? fixedMainTitleHeight : 0, ellipsis,
28173
28125
  wordBreak, maxHeight: mainTitleMaxHeight !== null && mainTitleMaxHeight !== void 0 ? mainTitleMaxHeight : maxHeight, maxWidth: mainTitleMaxWidth !== null && mainTitleMaxWidth !== void 0 ? mainTitleMaxWidth : maxWidth, textConfig: [] }, textStyle);
28174
28126
  this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
28175
28127
  }
28176
28128
  else if (isValid(text)) {
28177
- this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: isArray(text) ? text : [text], whiteSpace: 'normal' }, textStyle), { maxLineWidth: (_g = (_f = textStyle.maxLineWidth) !== null && _f !== void 0 ? _f : mainTitleWidth) !== null && _g !== void 0 ? _g : width, heightLimit: mainTitleHeight !== null && mainTitleHeight !== void 0 ? mainTitleHeight : maxHeight, lineClamp,
28129
+ this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: isArray(text) ? text : [text], whiteSpace: 'normal' }, textStyle), { maxLineWidth: (_f = (_e = textStyle.maxLineWidth) !== null && _e !== void 0 ? _e : mainTitleWidth) !== null && _f !== void 0 ? _f : width, heightLimit: (_g = textStyle.height) !== null && _g !== void 0 ? _g : maxHeight, lineClamp,
28178
28130
  ellipsis,
28179
28131
  x,
28180
28132
  y }), 'text');
28181
28133
  }
28182
28134
  }
28183
- const maintextHeight = this._mainTitle ? this._mainTitle.AABBBounds.height() : 0;
28184
- const maintextWidth = this._mainTitle ? this._mainTitle.AABBBounds.width() : 0;
28135
+ const mainTextBoundsHeight = this._mainTitle ? this._mainTitle.AABBBounds.height() : 0;
28136
+ const mainTextBoundsWidth = this._mainTitle ? this._mainTitle.AABBBounds.width() : 0;
28185
28137
  if (this.attribute.visible !== false && subtextStyle.visible !== false) {
28186
28138
  const { width: subTitleWidth, height: subTitleHeight, maxWidth: subTitleMaxWidth, maxHeight: subTitleMaxHeight, x = 0, y = 0, ellipsis = true, wordBreak = 'break-word', lineClamp } = subtextStyle;
28187
- const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - maintextHeight);
28139
+ const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - mainTextBoundsHeight);
28188
28140
  if (subtextType === 'rich' || isValid(subtextStyle.character)) {
28189
28141
  const attr = Object.assign({ x,
28190
28142
  y, width: (_h = subTitleWidth !== null && subTitleWidth !== void 0 ? subTitleWidth : width) !== null && _h !== void 0 ? _h : 0, height: (_j = subTitleHeight !== null && subTitleHeight !== void 0 ? subTitleHeight : height) !== null && _j !== void 0 ? _j : 0, ellipsis,
@@ -28199,47 +28151,43 @@ class Title extends AbstractComponent {
28199
28151
  }
28200
28152
  else if (isValid(subtext)) {
28201
28153
  this._subTitle = group.createOrUpdateChild('subTitle', Object.assign(Object.assign({ text: isArray(subtext) ? subtext : [subtext], whiteSpace: 'normal' }, subtextStyle), { maxLineWidth: (_o = subtextStyle.maxLineWidth) !== null && _o !== void 0 ? _o : width, heightLimit: (_p = subtextStyle.heightLimit) !== null && _p !== void 0 ? _p : maxSubTextHeight, lineClamp,
28202
- ellipsis, x: 0, y: maintextHeight }), 'text');
28154
+ ellipsis, x: 0, y: mainTextBoundsHeight }), 'text');
28203
28155
  }
28204
28156
  }
28205
- const subtextHeight = this._subTitle ? this._subTitle.AABBBounds.height() : 0;
28206
- const subtextWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;
28207
- let titleWidth = Math.max(maintextWidth, subtextWidth);
28208
- let titleHeight = maintextHeight + ((_q = subtextStyle.height) !== null && _q !== void 0 ? _q : subtextHeight);
28157
+ const subTextBoundsHeight = this._subTitle ? this._subTitle.AABBBounds.height() : 0;
28158
+ const subTextBoundsWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;
28159
+ let totalWidth = Math.max(mainTextBoundsWidth, subTextBoundsWidth);
28160
+ let totalHeight = mainTextBoundsHeight + ((_q = subtextStyle.height) !== null && _q !== void 0 ? _q : subTextBoundsHeight);
28209
28161
  if (isValid(width)) {
28210
- titleWidth = width;
28162
+ totalWidth = width;
28211
28163
  }
28212
28164
  if (isValid(height)) {
28213
- titleHeight = height;
28165
+ totalHeight = height;
28214
28166
  }
28215
- if (isValid(minWidth) && titleWidth < minWidth) {
28216
- titleWidth = minWidth;
28167
+ if (isValid(minWidth) && totalWidth < minWidth) {
28168
+ totalWidth = minWidth;
28217
28169
  }
28218
28170
  if (isValid(maxWidth)) {
28219
- if (titleWidth > maxWidth) {
28220
- titleWidth = maxWidth;
28171
+ if (totalWidth > maxWidth) {
28172
+ totalWidth = maxWidth;
28221
28173
  }
28222
28174
  }
28223
- if (isValid(minHeight) && titleHeight < minHeight) {
28224
- titleHeight = minHeight;
28175
+ if (isValid(minHeight) && totalHeight < minHeight) {
28176
+ totalHeight = minHeight;
28225
28177
  }
28226
28178
  if (isValid(maxHeight)) {
28227
- if (titleHeight > maxHeight) {
28228
- titleHeight = maxHeight;
28179
+ if (totalHeight > maxHeight) {
28180
+ totalHeight = maxHeight;
28229
28181
  }
28230
28182
  }
28231
- group.attribute.width = titleWidth;
28232
- group.attribute.height = titleHeight;
28183
+ group.attribute.width = totalWidth;
28184
+ group.attribute.height = totalHeight;
28233
28185
  group.attribute.boundsPadding = parsedPadding;
28234
28186
  if (this._mainTitle) {
28235
28187
  if (isValid(align) || isValid(textStyle.align)) {
28236
28188
  const mainTitleAlign = textStyle.align ? textStyle.align : align;
28237
- const mainTitleWidth = (_r = textStyle.width) !== null && _r !== void 0 ? _r : maintextWidth;
28238
- if (mainTitleAlign === 'left') {
28239
- this._mainTitle.setAttribute('x', 0);
28240
- this._mainTitle.setAttribute('textAlign', 'left');
28241
- }
28242
- else if (mainTitleAlign === 'center') {
28189
+ const mainTitleWidth = (_r = textStyle.width) !== null && _r !== void 0 ? _r : totalWidth;
28190
+ if (mainTitleAlign === 'center') {
28243
28191
  this._mainTitle.setAttribute('x', mainTitleWidth / 2);
28244
28192
  this._mainTitle.setAttribute('textAlign', 'center');
28245
28193
  }
@@ -28247,33 +28195,31 @@ class Title extends AbstractComponent {
28247
28195
  this._mainTitle.setAttribute('x', mainTitleWidth);
28248
28196
  this._mainTitle.setAttribute('textAlign', 'right');
28249
28197
  }
28250
- }
28251
- if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {
28252
- const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign;
28253
- const mainTitleHeight = textStyle.height ? textStyle.height : titleHeight;
28254
- if (mainTitleVerticalAlign === 'top') {
28255
- this._mainTitle.setAttribute('y', 0);
28256
- this._mainTitle.setAttribute('textBaseline', 'top');
28257
- }
28258
- else if (mainTitleVerticalAlign === 'middle') {
28259
- this._mainTitle.setAttribute('y', mainTitleHeight / 2);
28260
- this._mainTitle.setAttribute('textBaseline', 'middle');
28261
- }
28262
- else if (mainTitleVerticalAlign === 'bottom') {
28263
- this._mainTitle.setAttribute('y', mainTitleHeight);
28264
- this._mainTitle.setAttribute('textBaseline', 'bottom');
28198
+ else {
28199
+ this._mainTitle.setAttribute('x', 0);
28200
+ this._mainTitle.setAttribute('textAlign', 'left');
28265
28201
  }
28266
28202
  }
28203
+ const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign;
28204
+ const mainTitleHeight = fixedMainTitleHeight !== null && fixedMainTitleHeight !== void 0 ? fixedMainTitleHeight : (this._mainTitle.AABBBounds.empty() ? 0 : this._mainTitle.AABBBounds.height());
28205
+ if (mainTitleVerticalAlign === 'middle') {
28206
+ this._mainTitle.setAttribute('y', mainTitleHeight / 2);
28207
+ this._mainTitle.setAttribute('textBaseline', 'middle');
28208
+ }
28209
+ else if (mainTitleVerticalAlign === 'bottom') {
28210
+ this._mainTitle.setAttribute('y', mainTitleHeight);
28211
+ this._mainTitle.setAttribute('textBaseline', 'bottom');
28212
+ }
28213
+ else {
28214
+ this._mainTitle.setAttribute('y', 0);
28215
+ this._mainTitle.setAttribute('textBaseline', 'top');
28216
+ }
28267
28217
  }
28268
28218
  if (this._subTitle) {
28269
28219
  if (isValid(align) || isValid(subtextStyle.align)) {
28270
28220
  const subTitleAlign = subtextStyle.align ? subtextStyle.align : align;
28271
- const subTitleWidth = (_s = subtextStyle.width) !== null && _s !== void 0 ? _s : subtextWidth;
28272
- if (subTitleAlign === 'left') {
28273
- this._subTitle.setAttribute('x', 0);
28274
- this._subTitle.setAttribute('textAlign', 'left');
28275
- }
28276
- else if (subTitleAlign === 'center') {
28221
+ const subTitleWidth = (_t = (_s = subtextStyle.width) !== null && _s !== void 0 ? _s : textStyle.width) !== null && _t !== void 0 ? _t : totalWidth;
28222
+ if (subTitleAlign === 'center') {
28277
28223
  this._subTitle.setAttribute('x', subTitleWidth / 2);
28278
28224
  this._subTitle.setAttribute('textAlign', 'center');
28279
28225
  }
@@ -28281,24 +28227,32 @@ class Title extends AbstractComponent {
28281
28227
  this._subTitle.setAttribute('x', subTitleWidth);
28282
28228
  this._subTitle.setAttribute('textAlign', 'right');
28283
28229
  }
28284
- }
28285
- if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {
28286
- const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign;
28287
- const subTitleYStart = maintextHeight;
28288
- const subTitleHeight = (_t = subtextStyle.height) !== null && _t !== void 0 ? _t : 0;
28289
- if (subTitleVerticalAlign === 'top') {
28290
- this._subTitle.setAttribute('y', subTitleYStart);
28291
- this._subTitle.setAttribute('textBaseline', 'top');
28292
- }
28293
- else if (subTitleVerticalAlign === 'middle') {
28294
- this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight / 2);
28295
- this._subTitle.setAttribute('textBaseline', 'middle');
28296
- }
28297
- else if (subTitleVerticalAlign === 'bottom') {
28298
- this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight);
28299
- this._subTitle.setAttribute('textBaseline', 'bottom');
28230
+ else {
28231
+ this._subTitle.setAttribute('x', 0);
28232
+ this._subTitle.setAttribute('textAlign', 'left');
28300
28233
  }
28301
28234
  }
28235
+ const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign;
28236
+ const subTitleYStart = this._mainTitle
28237
+ ? isValid(fixedMainTitleHeight)
28238
+ ?
28239
+ this._mainTitle.AABBBounds.y1 +
28240
+ Math.max(this._mainTitle.AABBBounds.empty() ? 0 : this._mainTitle.AABBBounds.height(), fixedMainTitleHeight)
28241
+ : this._mainTitle.AABBBounds.y2
28242
+ : 0;
28243
+ const subTitleHeight = (_v = (_u = subtextStyle.height) !== null && _u !== void 0 ? _u : height) !== null && _v !== void 0 ? _v : (this._subTitle.AABBBounds.empty() ? 0 : this._subTitle.AABBBounds.height());
28244
+ if (subTitleVerticalAlign === 'middle') {
28245
+ this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight / 2);
28246
+ this._subTitle.setAttribute('textBaseline', 'middle');
28247
+ }
28248
+ else if (subTitleVerticalAlign === 'bottom') {
28249
+ this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight);
28250
+ this._subTitle.setAttribute('textBaseline', 'bottom');
28251
+ }
28252
+ else {
28253
+ this._subTitle.setAttribute('y', subTitleYStart);
28254
+ this._subTitle.setAttribute('textBaseline', 'top');
28255
+ }
28302
28256
  }
28303
28257
  }
28304
28258
  }
@@ -31301,6 +31255,6 @@ StoryLabelItem.defaultAttributes = {
31301
31255
  theme: 'default'
31302
31256
  };
31303
31257
 
31304
- const version = "0.22.0-vstory.9";
31258
+ const version = "0.22.0";
31305
31259
 
31306
31260
  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, PolygonSectorCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, StoryLabelItem, Switch, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, WeatherBox, 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 };