@visactor/vrender-components 0.22.0-vstory.11 → 0.22.0-vstory.14

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));
@@ -5441,7 +5466,7 @@ class Graphic extends Node {
5441
5466
  null != onStart && animate.onStart(onStart), null != onFrame && animate.onFrame(onFrame), null != onEnd && animate.onEnd(onEnd), null != onRemove && animate.onRemove(onRemove), animate.interpolateFunc = params.interpolate;
5442
5467
  }
5443
5468
  return this.animates.set(animate.id, animate), animate.onRemove(() => {
5444
- animate.stop(), this.animates.delete(animate.id);
5469
+ this.animates.delete(animate.id);
5445
5470
  }), animate;
5446
5471
  }
5447
5472
  onAttributeUpdate(context) {
@@ -5645,7 +5670,7 @@ class Graphic extends Node {
5645
5670
  if (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this.animates && this.animates.size) {
5646
5671
  const timeline = stage.getTimeline();
5647
5672
  this.animates.forEach(a => {
5648
- a.timeline === defaultTimeline && a.setTimeline(timeline);
5673
+ a.setTimeline(timeline);
5649
5674
  });
5650
5675
  }
5651
5676
  this._onSetStage && this._onSetStage(this, stage, layer), application.graphicService.onSetStage(this, stage);
@@ -5749,7 +5774,7 @@ class Graphic extends Node {
5749
5774
  return shadowRoot && (shadowRoot.shadowHost = this), this.shadowRoot = null != shadowRoot ? shadowRoot : application.graphicService.creator.shadowRoot(this), this.addUpdateBoundTag(), this.shadowRoot.setStage(this.stage, this.layer), this.shadowRoot;
5750
5775
  }
5751
5776
  detachShadow() {
5752
- this.shadowRoot && (this.addUpdateBoundTag(), this.shadowRoot.release(!0), this.shadowRoot = null);
5777
+ this.shadowRoot && (this.addUpdateBoundTag(), this.shadowRoot = null);
5753
5778
  }
5754
5779
  toJson() {
5755
5780
  return {
@@ -5801,7 +5826,7 @@ class Graphic extends Node {
5801
5826
  });
5802
5827
  }
5803
5828
  release() {
5804
- this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
5829
+ this.releaseStatus = "released", application.graphicService.onRelease(this);
5805
5830
  }
5806
5831
  _emitCustomEvent(type, context) {
5807
5832
  var _a, _b;
@@ -6295,11 +6320,6 @@ class Group extends Graphic {
6295
6320
  getNoWorkAnimateAttr() {
6296
6321
  return Group.NOWORK_ANIMATE_ATTR;
6297
6322
  }
6298
- release(all) {
6299
- all && this.forEachChildren(g => {
6300
- g.release(all);
6301
- }), super.release();
6302
- }
6303
6323
  }
6304
6324
  Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
6305
6325
  function createGroup(attributes) {
@@ -8488,7 +8508,7 @@ let Line$1 = class Line extends Graphic {
8488
8508
  } = attribute,
8489
8509
  b = aabbBounds;
8490
8510
  return points.forEach(p => {
8491
- !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);
8492
8512
  }), b;
8493
8513
  }
8494
8514
  updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds, graphic) {
@@ -8499,7 +8519,7 @@ let Line$1 = class Line extends Graphic {
8499
8519
  b = aabbBounds;
8500
8520
  return segments.forEach(s => {
8501
8521
  s.points.forEach(p => {
8502
- !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);
8503
8523
  });
8504
8524
  }), b;
8505
8525
  }
@@ -8751,16 +8771,20 @@ class Frame {
8751
8771
  }
8752
8772
 
8753
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);
8754
8778
  return {
8755
- left: Math.round(left),
8756
- top: Math.round(top),
8757
- right: Math.round(right),
8758
- 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
8759
8783
  };
8760
8784
  }
8761
8785
  class Paragraph {
8762
- constructor(text, newLine, character) {
8763
- 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;
8764
8788
  const lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
8765
8789
  this.lineHeight = "number" == typeof lineHeight ? lineHeight > this.fontSize ? lineHeight : this.fontSize : Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
8766
8790
  const {
@@ -8768,7 +8792,7 @@ class Paragraph {
8768
8792
  height: height,
8769
8793
  descent: descent,
8770
8794
  width: width
8771
- } = measureTextCanvas(text, character);
8795
+ } = measureTextCanvas(text, character, this.ascentDescentMode);
8772
8796
  let halfDetaHeight = 0,
8773
8797
  deltaAscent = 0,
8774
8798
  deltaDescent = 0;
@@ -8777,7 +8801,7 @@ class Paragraph {
8777
8801
  updateWidth() {
8778
8802
  const {
8779
8803
  width: width
8780
- } = measureTextCanvas(this.text, this.character);
8804
+ } = measureTextCanvas(this.text, this.character, this.ascentDescentMode);
8781
8805
  this.width = width, "vertical" === this.direction && (this.widthOrigin = this.width, this.width = this.heightOrigin, this.height = this.widthOrigin);
8782
8806
  }
8783
8807
  drawBackground(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
@@ -8794,16 +8818,24 @@ class Paragraph {
8794
8818
  if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
8795
8819
  const {
8796
8820
  width: width
8797
- } = measureTextCanvas(this.text.slice(index), this.character);
8821
+ } = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
8798
8822
  "vertical" === direction || (left -= this.ellipsisWidth - width);
8799
8823
  }
8800
8824
  }
8801
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);
8802
8837
  const lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + lineHeight);
8803
- return Object.assign(Object.assign({}, lrtb), {
8804
- fillStyle: this.character.background,
8805
- globalAlpha: this.character.backgroundOpacity
8806
- });
8838
+ ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top), ctx.fillStyle = fillStyle, ctx.globalAlpha = globalAlpha;
8807
8839
  }
8808
8840
  draw(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
8809
8841
  let baseline = top + ascent,
@@ -8818,7 +8850,7 @@ class Paragraph {
8818
8850
  if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
8819
8851
  const {
8820
8852
  width: width
8821
- } = measureTextCanvas(this.text.slice(index), this.character);
8853
+ } = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
8822
8854
  "vertical" === direction || (left -= this.ellipsisWidth - width);
8823
8855
  }
8824
8856
  }
@@ -8838,21 +8870,21 @@ class Paragraph {
8838
8870
  if (this.character.underline) {
8839
8871
  const top = 1 + baseline,
8840
8872
  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);
8873
+ ctx.fillRect(lrtb.left, 1 + baseline, lrtb.right - lrtb.left, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
8842
8874
  }
8843
8875
  if (this.character.lineThrough) {
8844
8876
  const top = 1 + baseline - this.ascent / 2,
8845
8877
  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);
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);
8847
8879
  }
8848
8880
  } else if ("underline" === this.character.textDecoration) {
8849
8881
  const top = 1 + baseline,
8850
8882
  lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
8851
- 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);
8852
8884
  } else if ("line-through" === this.character.textDecoration) {
8853
8885
  const top = 1 + baseline - this.ascent / 2,
8854
8886
  lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
8855
- 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);
8856
8888
  }
8857
8889
  "vertical" === direction && ctx.restore();
8858
8890
  }
@@ -8866,7 +8898,7 @@ class Paragraph {
8866
8898
  text = text.slice(0, index), text += this.ellipsisStr;
8867
8899
  const {
8868
8900
  width: measureWidth
8869
- } = measureTextCanvas(this.text.slice(index), this.character);
8901
+ } = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
8870
8902
  return width + this.ellipsisWidth - measureWidth;
8871
8903
  }
8872
8904
  return width;
@@ -8875,7 +8907,7 @@ class Paragraph {
8875
8907
  function seperateParagraph(paragraph, index) {
8876
8908
  const text1 = paragraph.text.slice(0, index),
8877
8909
  text2 = paragraph.text.slice(index);
8878
- 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)];
8879
8911
  }
8880
8912
 
8881
8913
  const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", ...GRAPHIC_UPDATE_TAG_KEY];
@@ -9064,7 +9096,7 @@ class Line {
9064
9096
  paragraph.ellipsisStr = ellipsis;
9065
9097
  const {
9066
9098
  width: width
9067
- } = measureTextCanvas(ellipsis, paragraph.character),
9099
+ } = measureTextCanvas(ellipsis, paragraph.character, paragraph.ascentDescentMode),
9068
9100
  ellipsisWidth = width || 0;
9069
9101
  if (ellipsisWidth <= this.blankWidth + otherParagraphWidth) {
9070
9102
  lastLine && (paragraph.ellipsis = "add");
@@ -9077,19 +9109,8 @@ class Line {
9077
9109
  paragraph.ellipsis = "hide", otherParagraphWidth += paragraph.width;
9078
9110
  }
9079
9111
  }
9080
- let fillStyle = "",
9081
- globalAlpha = -1,
9082
- currBgList = [];
9083
- const bgList = [currBgList];
9084
9112
  this.paragraphs.forEach((paragraph, index) => {
9085
- if (paragraph instanceof RichTextIcon) return;
9086
- const data = paragraph.drawBackground(ctx, y, this.ascent, x, 0 === index, this.textAlign, this.height);
9087
- data && (fillStyle === data.fillStyle && globalAlpha === data.globalAlpha || (currBgList = [], bgList.push(currBgList), fillStyle = data.fillStyle, globalAlpha = data.globalAlpha), currBgList.push(data));
9088
- }), bgList.forEach(bg => {
9089
- if (0 === bg.length) return;
9090
- const data = bg[0],
9091
- end = bg[bg.length - 1];
9092
- 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);
9093
9114
  }), this.paragraphs.forEach((paragraph, index) => {
9094
9115
  if (paragraph instanceof RichTextIcon) return paragraph.setAttributes({
9095
9116
  x: x + paragraph._x,
@@ -9111,7 +9132,7 @@ class Line {
9111
9132
  if (paragraph instanceof RichTextIcon) break;
9112
9133
  const {
9113
9134
  width: width
9114
- } = measureTextCanvas(ellipsis, paragraph.character),
9135
+ } = measureTextCanvas(ellipsis, paragraph.character, paragraph.ascentDescentMode),
9115
9136
  ellipsisWidth = width || 0;
9116
9137
  if (ellipsisWidth <= this.blankWidth + otherParagraphWidth) {
9117
9138
  paragraph.ellipsis = "add", paragraph.ellipsisWidth = ellipsisWidth;
@@ -9164,6 +9185,12 @@ class Wrapper {
9164
9185
  }
9165
9186
  }
9166
9187
 
9188
+ let supportIntl = !1;
9189
+ try {
9190
+ supportIntl = Intl && "function" == typeof Intl.Segmenter;
9191
+ } catch (e) {
9192
+ supportIntl = !1;
9193
+ }
9167
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];
9168
9195
  class RichText extends Graphic {
9169
9196
  constructor(params) {
@@ -9252,13 +9279,17 @@ class RichText extends Graphic {
9252
9279
  }
9253
9280
  return cache.every(item => item.isComposing || !(item.text && isString(item.text) && RichText.splitText(item.text).length > 1));
9254
9281
  }
9255
- static splitEmoji(text) {
9256
- return [...new Intl.Segmenter().segment(text)].map(x => x.segment);
9257
- }
9258
9282
  static splitText(text) {
9259
- try {
9260
- return this.splitEmoji(text);
9261
- } 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
+ }
9262
9293
  return Array.from(text);
9263
9294
  }
9264
9295
  static TransformTextConfig2SingleCharacter(textConfig) {
@@ -9274,14 +9305,14 @@ class RichText extends Graphic {
9274
9305
  }), tc;
9275
9306
  }
9276
9307
  updateAABBBounds(attribute, richtextTheme, aabbBounds) {
9277
- var _a, _b;
9308
+ var _a, _b, _c, _d;
9278
9309
  const {
9279
9310
  width = richtextTheme.width,
9280
9311
  height = richtextTheme.height,
9281
9312
  maxWidth = richtextTheme.maxWidth,
9282
9313
  maxHeight = richtextTheme.maxHeight,
9283
9314
  textAlign = richtextTheme.textAlign,
9284
- textBaseline = richtextTheme.textBaseline,
9315
+ verticalDirection = null !== (_b = null !== (_a = attribute.textBaseline) && void 0 !== _a ? _a : richtextTheme.textBaseline) && void 0 !== _b ? _b : richtextTheme.verticalDirection,
9285
9316
  editOptions: editOptions
9286
9317
  } = attribute;
9287
9318
  if (width > 0 && height > 0) aabbBounds.set(0, 0, width, height);else {
@@ -9294,9 +9325,9 @@ class RichText extends Graphic {
9294
9325
  contentHeight = height || actualHeight || 0;
9295
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);
9296
9327
  }
9297
- 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);
9298
9329
  let deltaY = 0;
9299
- switch (textBaseline) {
9330
+ switch (verticalDirection) {
9300
9331
  case "top":
9301
9332
  deltaY = 0;
9302
9333
  break;
@@ -9384,7 +9415,8 @@ class RichText extends Graphic {
9384
9415
  layoutDirection: layoutDirection,
9385
9416
  singleLine: singleLine,
9386
9417
  disableAutoWrapLine: disableAutoWrapLine,
9387
- editable: editable
9418
+ editable: editable,
9419
+ ascentDescentMode: ascentDescentMode
9388
9420
  } = this.attribute;
9389
9421
  let {
9390
9422
  textConfig: _tc = []
@@ -9407,8 +9439,8 @@ class RichText extends Graphic {
9407
9439
  const richTextConfig = this.combinedStyleToCharacter(textConfig[i]);
9408
9440
  if (isNumber(richTextConfig.text) && (richTextConfig.text = `${richTextConfig.text}`), richTextConfig.text && richTextConfig.text.includes("\n")) {
9409
9441
  const textParts = richTextConfig.text.split("\n");
9410
- for (let j = 0; j < textParts.length; j++) paragraphs.push(new Paragraph(textParts[j], 0 !== j, richTextConfig));
9411
- } 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));
9412
9444
  }
9413
9445
  const maxWidthFinite = "number" == typeof maxWidth && Number.isFinite(maxWidth) && maxWidth > 0,
9414
9446
  maxHeightFinite = "number" == typeof maxHeight && Number.isFinite(maxHeight) && maxHeight > 0,
@@ -10142,6 +10174,7 @@ class DefaultBaseBackgroundRenderContribution {
10142
10174
  opacity = graphicAttribute.opacity,
10143
10175
  backgroundMode = graphicAttribute.backgroundMode,
10144
10176
  backgroundFit = graphicAttribute.backgroundFit,
10177
+ backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
10145
10178
  backgroundScale = graphicAttribute.backgroundScale,
10146
10179
  backgroundOffsetX = graphicAttribute.backgroundOffsetX,
10147
10180
  backgroundOffsetY = graphicAttribute.backgroundOffsetY,
@@ -10163,6 +10196,7 @@ class DefaultBaseBackgroundRenderContribution {
10163
10196
  context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, this.doDrawImage(context, res.data, b, {
10164
10197
  backgroundMode: backgroundMode,
10165
10198
  backgroundFit: backgroundFit,
10199
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio,
10166
10200
  backgroundScale: backgroundScale,
10167
10201
  backgroundOffsetX: backgroundOffsetX,
10168
10202
  backgroundOffsetY: backgroundOffsetY
@@ -10173,6 +10207,7 @@ class DefaultBaseBackgroundRenderContribution {
10173
10207
  const {
10174
10208
  backgroundMode: backgroundMode,
10175
10209
  backgroundFit: backgroundFit,
10210
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio,
10176
10211
  backgroundScale = 1,
10177
10212
  backgroundOffsetX = 0,
10178
10213
  backgroundOffsetY = 0
@@ -10182,7 +10217,12 @@ class DefaultBaseBackgroundRenderContribution {
10182
10217
  let w = targetW,
10183
10218
  h = targetH;
10184
10219
  if ("no-repeat" === backgroundMode) {
10185
- 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 {
10186
10226
  const resW = data.width * backgroundScale,
10187
10227
  resH = data.height * backgroundScale;
10188
10228
  context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, resW, resH);
@@ -10488,6 +10528,7 @@ class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRend
10488
10528
  background: background,
10489
10529
  backgroundMode = graphicAttribute.backgroundMode,
10490
10530
  backgroundFit = graphicAttribute.backgroundFit,
10531
+ backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
10491
10532
  backgroundScale = graphicAttribute.backgroundScale,
10492
10533
  backgroundOffsetX = graphicAttribute.backgroundOffsetX,
10493
10534
  backgroundOffsetY = graphicAttribute.backgroundOffsetY
@@ -10500,6 +10541,7 @@ class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRend
10500
10541
  this.doDrawImage(context, res.data, b, {
10501
10542
  backgroundMode: backgroundMode,
10502
10543
  backgroundFit: backgroundFit,
10544
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio,
10503
10545
  backgroundScale: backgroundScale,
10504
10546
  backgroundOffsetX: backgroundOffsetX,
10505
10547
  backgroundOffsetY: backgroundOffsetY
@@ -10681,8 +10723,8 @@ class DefaultImageRenderContribution extends DefaultRectRenderContribution {
10681
10723
  constructor() {
10682
10724
  super(...arguments), this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
10683
10725
  }
10684
- drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
10685
- 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);
10686
10728
  }
10687
10729
  }
10688
10730
  const defaultImageRenderContribution = new DefaultImageRenderContribution();
@@ -11145,7 +11187,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
11145
11187
  this._draw(line, lineAttribute, !1, drawContext, params);
11146
11188
  }
11147
11189
  drawSegmentItem(context, cache, fill, stroke, fillOpacity, strokeOpacity, attribute, defaultAttribute, clipRange, clipRangeByDimension, offsetX, offsetY, line, fillCb, strokeCb) {
11148
- var _a, _b, _c, _d, _e;
11190
+ var _a;
11149
11191
  if (!cache) return;
11150
11192
  context.beginPath();
11151
11193
  const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
@@ -11158,27 +11200,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
11158
11200
  x: originX = 0,
11159
11201
  x: originY = 0
11160
11202
  } = attribute;
11161
- !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()));
11162
- let {
11163
- connectedType: connectedType,
11164
- connectedX: connectedX,
11165
- connectedY: connectedY,
11166
- connectedStyle: connectedStyle
11167
- } = attribute;
11168
- 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) {
11169
- context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, cache, clipRange, clipRangeByDimension, {
11170
- offsetX: offsetX,
11171
- offsetY: offsetY,
11172
- offsetZ: z,
11173
- drawConnect: !0,
11174
- mode: connectedType,
11175
- zeroX: connectedX,
11176
- zeroY: connectedY
11177
- });
11178
- const da = [];
11179
- 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()));
11180
- }
11181
- 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;
11182
11204
  }
11183
11205
  drawLinearLineHighPerformance(line, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, lineAttribute, drawContext, params, fillCb, strokeCb) {
11184
11206
  var _a;
@@ -11210,7 +11232,8 @@ let DefaultCanvasLineRender = class extends BaseRender {
11210
11232
  segments: segments,
11211
11233
  points: points,
11212
11234
  closePath: closePath,
11213
- curveTension = lineAttribute.curveTension
11235
+ curveTension = lineAttribute.curveTension,
11236
+ connectedType = lineAttribute.connectedType
11214
11237
  } = line.attribute;
11215
11238
  if (!this.valid(line, lineAttribute, fillCb, strokeCb)) return;
11216
11239
  let {
@@ -11222,6 +11245,9 @@ let DefaultCanvasLineRender = class extends BaseRender {
11222
11245
  clipRangeByDimension = lineAttribute.clipRangeByDimension
11223
11246
  } = line.attribute;
11224
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
+ }
11225
11251
  if (line.shouldUpdateShape()) {
11226
11252
  const {
11227
11253
  points: points,
@@ -11243,7 +11269,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
11243
11269
  y: lastSeg.endY,
11244
11270
  defined: lastSeg.curves[lastSeg.curves.length - 1].defined
11245
11271
  } : index > 1 && (startPoint.x = lastSeg.endX, startPoint.y = lastSeg.endY, startPoint.defined = lastSeg.curves[lastSeg.curves.length - 1].defined);
11246
- const data = calcLineCache(seg.points, curveType, {
11272
+ const data = calcLineCache(parsePoint(seg.points, connectedType), curveType, {
11247
11273
  startPoint: startPoint,
11248
11274
  curveTension: curveTension
11249
11275
  });
@@ -11262,7 +11288,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
11262
11288
  }
11263
11289
  } else {
11264
11290
  if (!points || !points.length) return line.cache = null, void line.clearUpdateShapeTag();
11265
- line.cache = calcLineCache(_points, curveType, {
11291
+ line.cache = calcLineCache(parsePoint(_points, connectedType), curveType, {
11266
11292
  curveTension: curveTension
11267
11293
  });
11268
11294
  }
@@ -11294,11 +11320,6 @@ DefaultCanvasLineRender = __decorate$E([injectable()], DefaultCanvasLineRender);
11294
11320
 
11295
11321
  function drawAreaSegments(path, segPath, percent, params) {
11296
11322
  var _a;
11297
- const {
11298
- drawConnect = !1,
11299
- mode = "none"
11300
- } = params || {};
11301
- if (drawConnect && "none" === mode) return;
11302
11323
  const {
11303
11324
  top: top,
11304
11325
  bottom: bottom
@@ -11308,34 +11329,11 @@ function drawAreaSegments(path, segPath, percent, params) {
11308
11329
  const topList = [],
11309
11330
  bottomList = [];
11310
11331
  let lastDefined = !0;
11311
- if (drawConnect) {
11312
- let lastCurve,
11313
- lastBottomCurve,
11314
- defined0 = !0;
11315
- const n = top.curves.length;
11316
- top.curves.forEach((curve, i) => {
11317
- const bototmCurve = bottom.curves[n - i - 1];
11318
- let currentTopCurve = curve,
11319
- currentBottomCurve = bototmCurve;
11320
- if (curve.originP1 === curve.originP2) return lastCurve = curve, void (lastBottomCurve = bototmCurve);
11321
- 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 {
11322
- const {
11323
- originP1: originP1,
11324
- originP2: originP2
11325
- } = curve;
11326
- let validTopCurve, validBottomCurve;
11327
- 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);
11328
- }
11329
- lastCurve = curve;
11330
- }), drawAreaConnectBlock(path, topList, bottomList, params);
11331
- } else {
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]));
11335
- }
11336
- 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]));
11337
11335
  }
11338
- return;
11336
+ return void drawAreaBlock(path, topList, bottomList, params);
11339
11337
  }
11340
11338
  if (percent <= 0) return;
11341
11339
  let {
@@ -11353,51 +11351,17 @@ function drawAreaSegments(path, segPath, percent, params) {
11353
11351
  lastDefined = !0;
11354
11352
  const topList = [],
11355
11353
  bottomList = [];
11356
- let lastTopCurve,
11357
- lastBottomCurve,
11358
- defined0 = !0;
11359
11354
  for (let i = 0, n = top.curves.length; i < n; i++) {
11360
11355
  const topCurve = top.curves[i],
11361
11356
  curCurveLength = topCurve.getLength(direction),
11362
11357
  percent = (totalDrawLength - drawedLengthUntilLast) / curCurveLength;
11363
11358
  if (percent < 0) break;
11364
- if (drawedLengthUntilLast += curCurveLength, drawConnect) {
11365
- const bototmCurve = bottom.curves[n - i - 1];
11366
- let currentTopCurve = topCurve,
11367
- currentBottomCurve = bototmCurve;
11368
- if (topCurve.originP1 === topCurve.originP2) {
11369
- lastTopCurve = topCurve, lastBottomCurve = bototmCurve;
11370
- continue;
11371
- }
11372
- 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 {
11373
- const {
11374
- originP1: originP1,
11375
- originP2: originP2
11376
- } = topCurve;
11377
- let validTopCurve, validBottomCurve;
11378
- 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);
11379
- }
11380
- lastTopCurve = topCurve;
11381
- } else {
11382
- let tc = null,
11383
- bc = null;
11384
- 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;
11385
- }
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;
11386
11363
  }
11387
- drawConnect ? drawAreaConnectBlock(path, topList, bottomList, params) : drawAreaBlock(path, topList, bottomList, params);
11388
- }
11389
- function drawAreaConnectBlock(path, topList, bottomList, params) {
11390
- if (topList.length < 2) return;
11391
- const {
11392
- offsetX = 0,
11393
- offsetY = 0,
11394
- offsetZ = 0,
11395
- mode: mode
11396
- } = params || {};
11397
- let curve = topList[0];
11398
- path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), curve = topList[topList.length - 1];
11399
- let end = curve.p3 || curve.p1;
11400
- 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);
11401
11365
  }
11402
11366
  function drawAreaBlock(path, topList, bottomList, params) {
11403
11367
  const {
@@ -11498,7 +11462,8 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11498
11462
  fillOpacity = areaAttribute.fillOpacity,
11499
11463
  z = areaAttribute.z,
11500
11464
  strokeOpacity = areaAttribute.strokeOpacity,
11501
- curveTension = areaAttribute.curveTension
11465
+ curveTension = areaAttribute.curveTension,
11466
+ connectedType = areaAttribute.connectedType
11502
11467
  } = area.attribute,
11503
11468
  data = this.valid(area, areaAttribute, fillCb, strokeCb);
11504
11469
  if (!data) return;
@@ -11515,6 +11480,9 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11515
11480
  let {
11516
11481
  curveType = areaAttribute.curveType
11517
11482
  } = area.attribute;
11483
+ function parsePoint(points, connectedType) {
11484
+ return "connect" !== connectedType ? points : points.filter(p => !1 !== p.defined);
11485
+ }
11518
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);
11519
11487
  if (area.shouldUpdateShape()) {
11520
11488
  if (segments && segments.length) {
@@ -11528,7 +11496,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11528
11496
  x: lastTopSeg.endX,
11529
11497
  y: lastTopSeg.endY
11530
11498
  } : index > 1 && (startPoint.x = lastTopSeg.endX, startPoint.y = lastTopSeg.endY);
11531
- const data = calcLineCache(seg.points, curveType, {
11499
+ const data = calcLineCache(parsePoint(seg.points, connectedType), curveType, {
11532
11500
  startPoint: startPoint,
11533
11501
  curveTension: curveTension
11534
11502
  });
@@ -11551,7 +11519,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11551
11519
  y: null !== (_d = endPoint.y1) && void 0 !== _d ? _d : endPoint.y
11552
11520
  });
11553
11521
  }
11554
- 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, {
11555
11523
  curveTension: curveTension
11556
11524
  }), bottomCaches.unshift(lastBottomSeg));
11557
11525
  }
@@ -11562,11 +11530,11 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11562
11530
  } else {
11563
11531
  if (!points || !points.length) return area.cacheArea = null, void area.clearUpdateShapeTag();
11564
11532
  {
11565
- const topPoints = points,
11533
+ const topPoints = parsePoint(points, connectedType),
11566
11534
  bottomPoints = [];
11567
- for (let i = points.length - 1; i >= 0; i--) bottomPoints.push({
11568
- x: null !== (_e = points[i].x1) && void 0 !== _e ? _e : points[i].x,
11569
- 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
11570
11538
  });
11571
11539
  const topCache = calcLineCache(topPoints, curveType, {
11572
11540
  curveTension: curveTension
@@ -11608,20 +11576,10 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11608
11576
  this._draw(area, areaAttribute, !1, drawContext, params);
11609
11577
  }
11610
11578
  drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb) {
11611
- let ret = !1;
11612
- 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);
11613
11580
  }
11614
- _drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, connect, fillCb, strokeCb) {
11615
- var _a, _b, _c, _d;
11581
+ _drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb) {
11616
11582
  if (!(cache && cache.top && cache.bottom && cache.top.curves && cache.top.curves.length && cache.bottom.curves && cache.bottom.curves.length)) return;
11617
- let {
11618
- connectedType: connectedType,
11619
- connectedX: connectedX,
11620
- connectedY: connectedY,
11621
- connectedStyle: connectedStyle
11622
- } = attribute;
11623
- const da = [];
11624
- 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;
11625
11583
  context.beginPath();
11626
11584
  const {
11627
11585
  points: points,
@@ -11640,11 +11598,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11640
11598
  offsetX: offsetX,
11641
11599
  offsetY: offsetY,
11642
11600
  offsetZ: offsetZ,
11643
- direction: direction,
11644
- drawConnect: connect,
11645
- mode: connectedType,
11646
- zeroX: connectedX,
11647
- zeroY: connectedY
11601
+ direction: direction
11648
11602
  }), this.beforeRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
11649
11603
  attribute: attribute
11650
11604
  }), context.setShadowBlendStyle && context.setShadowBlendStyle(area, attribute, defaultAttribute);
@@ -11652,7 +11606,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11652
11606
  x: originX = 0,
11653
11607
  x: originY = 0
11654
11608
  } = attribute;
11655
- 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, {
11656
11610
  attribute: attribute
11657
11611
  }), (() => {
11658
11612
  if (!1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute);else {
@@ -11662,12 +11616,8 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11662
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", {
11663
11617
  offsetX: offsetX,
11664
11618
  offsetY: offsetY,
11665
- offsetZ: offsetZ,
11666
- drawConnect: connect,
11667
- mode: connectedType,
11668
- zeroX: connectedX,
11669
- zeroY: connectedY
11670
- })), 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();
11671
11621
  }
11672
11622
  })(), !1;
11673
11623
  }
@@ -11923,7 +11873,8 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
11923
11873
  var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
11924
11874
  const {
11925
11875
  backgroundMode = graphicAttribute.backgroundMode,
11926
- backgroundFit = graphicAttribute.backgroundFit
11876
+ backgroundFit = graphicAttribute.backgroundFit,
11877
+ backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio
11927
11878
  } = graphic.attribute;
11928
11879
  let matrix,
11929
11880
  {
@@ -11962,7 +11913,8 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
11962
11913
  if ("success" !== res.state || !res.data) return void restore();
11963
11914
  context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, {
11964
11915
  backgroundMode: backgroundMode,
11965
- backgroundFit: backgroundFit
11916
+ backgroundFit: backgroundFit,
11917
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio
11966
11918
  }), context.highPerformanceRestore(), context.setTransformForCurrent();
11967
11919
  } else {
11968
11920
  const {
@@ -13079,7 +13031,7 @@ var __decorate$q = undefined && undefined.__decorate || function (decorators, ta
13079
13031
  };
13080
13032
  let DefaultDrawContribution = class {
13081
13033
  constructor(contributions, drawItemInterceptorContributions) {
13082
- 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();
13083
13035
  }
13084
13036
  init() {
13085
13037
  this.contributions.forEach(item => {
@@ -13882,6 +13834,7 @@ class PickerBase {
13882
13834
  contains(graphic, point, params) {
13883
13835
  if (!graphic.AABBBounds.containsPoint(point)) return !1;
13884
13836
  if ("imprecise" === graphic.attribute.pickMode) return !0;
13837
+ if (!this.canvasRenderer) return !0;
13885
13838
  const {
13886
13839
  pickContext: pickContext
13887
13840
  } = null != params ? params : {};
@@ -20586,15 +20539,19 @@ class LabelBase extends AbstractComponent {
20586
20539
  if (isFunction(dataFilter)) {
20587
20540
  data = dataFilter(data);
20588
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
+ }
20589
20546
  let labels = this._initText(data);
20590
20547
  if (isFunction(customLayoutFunc)) {
20591
- 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);
20592
20549
  }
20593
20550
  else {
20594
20551
  labels = this._layout(labels);
20595
20552
  }
20596
20553
  if (isFunction(customOverlapFunc)) {
20597
- 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);
20598
20555
  }
20599
20556
  else {
20600
20557
  if (overlap !== false) {
@@ -20602,7 +20559,7 @@ class LabelBase extends AbstractComponent {
20602
20559
  }
20603
20560
  }
20604
20561
  if (isFunction(this.attribute.onAfterOverlapping)) {
20605
- 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);
20606
20563
  }
20607
20564
  if (labels && labels.length) {
20608
20565
  labels.forEach(label => {
@@ -24704,34 +24661,23 @@ class MarkArea extends Marker {
24704
24661
  }
24705
24662
  getPointAttrByPosition(position) {
24706
24663
  const { x1, x2, y1, y2 } = this._area.AABBBounds;
24664
+ const result = {
24665
+ x: (x1 + x2) / 2,
24666
+ y: (y1 + y2) / 2
24667
+ };
24707
24668
  if (position.includes('left') || position.includes('Left')) {
24708
- return {
24709
- x: x1,
24710
- y: (y1 + y2) / 2
24711
- };
24669
+ result.x = x1;
24712
24670
  }
24713
24671
  if (position.includes('right') || position.includes('Right')) {
24714
- return {
24715
- x: x2,
24716
- y: (y1 + y2) / 2
24717
- };
24672
+ result.x = x2;
24718
24673
  }
24719
24674
  if (position.includes('top') || position.includes('Top')) {
24720
- return {
24721
- x: (x1 + x2) / 2,
24722
- y: y1
24723
- };
24675
+ result.y = y1;
24724
24676
  }
24725
24677
  if (position.includes('bottom') || position.includes('Bottom')) {
24726
- return {
24727
- x: (x1 + x2) / 2,
24728
- y: y2
24729
- };
24678
+ result.y = y2;
24730
24679
  }
24731
- return {
24732
- x: (x1 + x2) / 2,
24733
- y: (y1 + y2) / 2
24734
- };
24680
+ return result;
24735
24681
  }
24736
24682
  setLabelPos() {
24737
24683
  var _a;
@@ -28161,35 +28107,36 @@ class Title extends AbstractComponent {
28161
28107
  this.name = 'title';
28162
28108
  }
28163
28109
  render() {
28164
- 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;
28165
28111
  const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute;
28166
28112
  const parsedPadding = normalizePadding(padding);
28167
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;
28168
28115
  if (this.attribute.visible !== false && textStyle.visible !== false) {
28169
- 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;
28170
28117
  if (textType === 'rich' || isValid(textStyle.character)) {
28171
28118
  const attr = Object.assign({ x,
28172
- 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);
28173
28120
  this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
28174
28121
  }
28175
28122
  else if (textType === 'html') {
28176
28123
  const attr = Object.assign({ html: Object.assign(Object.assign({ dom: text }, DEFAULT_HTML_TEXT_SPEC), textStyle), x,
28177
- 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,
28178
28125
  wordBreak, maxHeight: mainTitleMaxHeight !== null && mainTitleMaxHeight !== void 0 ? mainTitleMaxHeight : maxHeight, maxWidth: mainTitleMaxWidth !== null && mainTitleMaxWidth !== void 0 ? mainTitleMaxWidth : maxWidth, textConfig: [] }, textStyle);
28179
28126
  this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
28180
28127
  }
28181
28128
  else if (isValid(text)) {
28182
- 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,
28183
28130
  ellipsis,
28184
28131
  x,
28185
28132
  y }), 'text');
28186
28133
  }
28187
28134
  }
28188
- const maintextHeight = this._mainTitle ? this._mainTitle.AABBBounds.height() : 0;
28189
- 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;
28190
28137
  if (this.attribute.visible !== false && subtextStyle.visible !== false) {
28191
28138
  const { width: subTitleWidth, height: subTitleHeight, maxWidth: subTitleMaxWidth, maxHeight: subTitleMaxHeight, x = 0, y = 0, ellipsis = true, wordBreak = 'break-word', lineClamp } = subtextStyle;
28192
- const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - maintextHeight);
28139
+ const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - mainTextBoundsHeight);
28193
28140
  if (subtextType === 'rich' || isValid(subtextStyle.character)) {
28194
28141
  const attr = Object.assign({ x,
28195
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,
@@ -28204,47 +28151,43 @@ class Title extends AbstractComponent {
28204
28151
  }
28205
28152
  else if (isValid(subtext)) {
28206
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,
28207
- ellipsis, x: 0, y: maintextHeight }), 'text');
28154
+ ellipsis, x: 0, y: mainTextBoundsHeight }), 'text');
28208
28155
  }
28209
28156
  }
28210
- const subtextHeight = this._subTitle ? this._subTitle.AABBBounds.height() : 0;
28211
- const subtextWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;
28212
- let titleWidth = Math.max(maintextWidth, subtextWidth);
28213
- 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);
28214
28161
  if (isValid(width)) {
28215
- titleWidth = width;
28162
+ totalWidth = width;
28216
28163
  }
28217
28164
  if (isValid(height)) {
28218
- titleHeight = height;
28165
+ totalHeight = height;
28219
28166
  }
28220
- if (isValid(minWidth) && titleWidth < minWidth) {
28221
- titleWidth = minWidth;
28167
+ if (isValid(minWidth) && totalWidth < minWidth) {
28168
+ totalWidth = minWidth;
28222
28169
  }
28223
28170
  if (isValid(maxWidth)) {
28224
- if (titleWidth > maxWidth) {
28225
- titleWidth = maxWidth;
28171
+ if (totalWidth > maxWidth) {
28172
+ totalWidth = maxWidth;
28226
28173
  }
28227
28174
  }
28228
- if (isValid(minHeight) && titleHeight < minHeight) {
28229
- titleHeight = minHeight;
28175
+ if (isValid(minHeight) && totalHeight < minHeight) {
28176
+ totalHeight = minHeight;
28230
28177
  }
28231
28178
  if (isValid(maxHeight)) {
28232
- if (titleHeight > maxHeight) {
28233
- titleHeight = maxHeight;
28179
+ if (totalHeight > maxHeight) {
28180
+ totalHeight = maxHeight;
28234
28181
  }
28235
28182
  }
28236
- group.attribute.width = titleWidth;
28237
- group.attribute.height = titleHeight;
28183
+ group.attribute.width = totalWidth;
28184
+ group.attribute.height = totalHeight;
28238
28185
  group.attribute.boundsPadding = parsedPadding;
28239
28186
  if (this._mainTitle) {
28240
28187
  if (isValid(align) || isValid(textStyle.align)) {
28241
28188
  const mainTitleAlign = textStyle.align ? textStyle.align : align;
28242
- const mainTitleWidth = (_r = textStyle.width) !== null && _r !== void 0 ? _r : maintextWidth;
28243
- if (mainTitleAlign === 'left') {
28244
- this._mainTitle.setAttribute('x', 0);
28245
- this._mainTitle.setAttribute('textAlign', 'left');
28246
- }
28247
- else if (mainTitleAlign === 'center') {
28189
+ const mainTitleWidth = (_r = textStyle.width) !== null && _r !== void 0 ? _r : totalWidth;
28190
+ if (mainTitleAlign === 'center') {
28248
28191
  this._mainTitle.setAttribute('x', mainTitleWidth / 2);
28249
28192
  this._mainTitle.setAttribute('textAlign', 'center');
28250
28193
  }
@@ -28252,33 +28195,31 @@ class Title extends AbstractComponent {
28252
28195
  this._mainTitle.setAttribute('x', mainTitleWidth);
28253
28196
  this._mainTitle.setAttribute('textAlign', 'right');
28254
28197
  }
28255
- }
28256
- if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {
28257
- const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign;
28258
- const mainTitleHeight = textStyle.height ? textStyle.height : titleHeight;
28259
- if (mainTitleVerticalAlign === 'top') {
28260
- this._mainTitle.setAttribute('y', 0);
28261
- this._mainTitle.setAttribute('textBaseline', 'top');
28262
- }
28263
- else if (mainTitleVerticalAlign === 'middle') {
28264
- this._mainTitle.setAttribute('y', mainTitleHeight / 2);
28265
- this._mainTitle.setAttribute('textBaseline', 'middle');
28266
- }
28267
- else if (mainTitleVerticalAlign === 'bottom') {
28268
- this._mainTitle.setAttribute('y', mainTitleHeight);
28269
- this._mainTitle.setAttribute('textBaseline', 'bottom');
28198
+ else {
28199
+ this._mainTitle.setAttribute('x', 0);
28200
+ this._mainTitle.setAttribute('textAlign', 'left');
28270
28201
  }
28271
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
+ }
28272
28217
  }
28273
28218
  if (this._subTitle) {
28274
28219
  if (isValid(align) || isValid(subtextStyle.align)) {
28275
28220
  const subTitleAlign = subtextStyle.align ? subtextStyle.align : align;
28276
- const subTitleWidth = (_s = subtextStyle.width) !== null && _s !== void 0 ? _s : subtextWidth;
28277
- if (subTitleAlign === 'left') {
28278
- this._subTitle.setAttribute('x', 0);
28279
- this._subTitle.setAttribute('textAlign', 'left');
28280
- }
28281
- 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') {
28282
28223
  this._subTitle.setAttribute('x', subTitleWidth / 2);
28283
28224
  this._subTitle.setAttribute('textAlign', 'center');
28284
28225
  }
@@ -28286,24 +28227,32 @@ class Title extends AbstractComponent {
28286
28227
  this._subTitle.setAttribute('x', subTitleWidth);
28287
28228
  this._subTitle.setAttribute('textAlign', 'right');
28288
28229
  }
28289
- }
28290
- if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {
28291
- const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign;
28292
- const subTitleYStart = maintextHeight;
28293
- const subTitleHeight = (_t = subtextStyle.height) !== null && _t !== void 0 ? _t : 0;
28294
- if (subTitleVerticalAlign === 'top') {
28295
- this._subTitle.setAttribute('y', subTitleYStart);
28296
- this._subTitle.setAttribute('textBaseline', 'top');
28297
- }
28298
- else if (subTitleVerticalAlign === 'middle') {
28299
- this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight / 2);
28300
- this._subTitle.setAttribute('textBaseline', 'middle');
28301
- }
28302
- else if (subTitleVerticalAlign === 'bottom') {
28303
- this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight);
28304
- this._subTitle.setAttribute('textBaseline', 'bottom');
28230
+ else {
28231
+ this._subTitle.setAttribute('x', 0);
28232
+ this._subTitle.setAttribute('textAlign', 'left');
28305
28233
  }
28306
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
+ }
28307
28256
  }
28308
28257
  }
28309
28258
  }
@@ -31306,6 +31255,6 @@ StoryLabelItem.defaultAttributes = {
31306
31255
  theme: 'default'
31307
31256
  };
31308
31257
 
31309
- const version = "0.22.0-vstory.11";
31258
+ const version = "0.22.0-vstory.14";
31310
31259
 
31311
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 };