@visactor/vchart-extension 1.12.15 → 1.13.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/build/index.js CHANGED
@@ -1533,6 +1533,11 @@
1533
1533
  }
1534
1534
  }
1535
1535
 
1536
+ var MeasureModeEnum;
1537
+ !function (MeasureModeEnum) {
1538
+ MeasureModeEnum[MeasureModeEnum.estimate = 0] = "estimate", MeasureModeEnum[MeasureModeEnum.actualBounding = 1] = "actualBounding", MeasureModeEnum[MeasureModeEnum.fontBounding = 2] = "fontBounding";
1539
+ }(MeasureModeEnum || (MeasureModeEnum = {}));
1540
+
1536
1541
  const circleThreshold = vutils.tau - 1e-8;
1537
1542
  class BoundsContext {
1538
1543
  constructor(bounds) {
@@ -2789,6 +2794,7 @@
2789
2794
  const DefaultTextStyle = {
2790
2795
  text: "",
2791
2796
  maxLineWidth: 1 / 0,
2797
+ maxWidth: 1 / 0,
2792
2798
  textAlign: "left",
2793
2799
  textBaseline: "alphabetic",
2794
2800
  fontSize: 16,
@@ -2812,7 +2818,9 @@
2812
2818
  suffixPosition: "end",
2813
2819
  underlineDash: [],
2814
2820
  underlineOffset: 0,
2815
- disableAutoClipedPoptip: void 0
2821
+ disableAutoClipedPoptip: void 0,
2822
+ measureMode: MeasureModeEnum.fontBounding,
2823
+ keepCenterInLine: !1
2816
2824
  };
2817
2825
  const DefaultPickStyle = {
2818
2826
  pickStrokeBuffer: 0
@@ -3298,19 +3306,19 @@
3298
3306
  }
3299
3307
  insertBefore(newNode, referenceNode) {
3300
3308
  if (!referenceNode) return this.appendChild(newNode);
3301
- if (this._uid === newNode._uid) return null;
3309
+ if (this === newNode || newNode === referenceNode) return null;
3302
3310
  if (newNode.isAncestorsOf(this)) throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");
3303
3311
  return referenceNode.parent !== this ? null : (newNode.parent && newNode.parent.removeChild(newNode), newNode.parent = this, newNode._prev = referenceNode._prev, referenceNode._prev ? referenceNode._prev._next = newNode : this._firstChild = newNode, referenceNode._prev = newNode, newNode._next = referenceNode, this._idMap || (this._idMap = new Map()), this._idMap.set(newNode._uid, newNode), this._structEdit = !0, this.setCount(newNode.count), newNode);
3304
3312
  }
3305
3313
  insertAfter(newNode, referenceNode) {
3306
3314
  if (!referenceNode) return this.appendChild(newNode);
3307
- if (this._uid === newNode._uid) return null;
3315
+ if (this === newNode || newNode === referenceNode) return null;
3308
3316
  if (newNode.isAncestorsOf(this)) throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");
3309
3317
  return referenceNode.parent !== this ? null : (newNode.parent && newNode.parent.removeChild(newNode), newNode.parent = this, referenceNode._next ? (referenceNode._next._prev = newNode, newNode._next = referenceNode._next) : this._lastChild = newNode, referenceNode._next = newNode, newNode._prev = referenceNode, this._idMap || (this._idMap = new Map()), this._idMap.set(newNode._uid, newNode), this._structEdit = !0, this.setCount(newNode.count), newNode);
3310
3318
  }
3311
3319
  insertInto(newNode, idx) {
3312
3320
  if (!this._ignoreWarn && this._nodeList && vutils.Logger.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"), idx >= this.childrenCount) return this.appendChild(newNode);
3313
- if (this._uid === newNode._uid) return null;
3321
+ if (this === newNode) return null;
3314
3322
  if (newNode.isAncestorsOf(this)) throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");
3315
3323
  if (newNode.parent && newNode.parent.removeChild(newNode), newNode.parent = this, 0 === idx) newNode._next = this._firstChild, this._firstChild && (this._firstChild._prev = newNode), newNode._prev = null, this._firstChild = newNode;else {
3316
3324
  let child = this._firstChild;
@@ -4184,12 +4192,16 @@
4184
4192
  }
4185
4193
  return points;
4186
4194
  }
4187
- const calculateLineHeight = (lineHeight, fontSize) => {
4195
+ const _calculateLineHeight = (lineHeight, fontSize) => {
4188
4196
  if (vutils.isString(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
4189
4197
  return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
4190
4198
  }
4191
4199
  return lineHeight;
4192
4200
  };
4201
+ const calculateLineHeight = (lineHeight, fontSize) => {
4202
+ const _lh = _calculateLineHeight(lineHeight, fontSize);
4203
+ return isNaN(_lh) ? _lh : Math.max(fontSize, _lh);
4204
+ };
4193
4205
 
4194
4206
  var ColorType;
4195
4207
  !function (ColorType) {
@@ -5471,14 +5483,21 @@
5471
5483
  width: width,
5472
5484
  height: height,
5473
5485
  path: path,
5474
- clip = groupTheme.clip,
5475
- display: display
5486
+ clip = groupTheme.clip
5476
5487
  } = attribute;
5477
- return path && path.length ? path.forEach(g => {
5488
+ if (path && path.length ? path.forEach(g => {
5478
5489
  aabbBounds.union(g.AABBBounds);
5479
- }) : null != width && null != height && aabbBounds.set(0, 0, Math.max(0, width), Math.max(0, height)), clip || this.forEachChildren(node => {
5480
- aabbBounds.union(node.AABBBounds);
5481
- }), application.graphicService.updateTempAABBBounds(aabbBounds), application.graphicService.transformAABBBounds(attribute, aabbBounds, groupTheme, !1, this), originalAABBBounds.copy(aabbBounds), originalAABBBounds;
5490
+ }) : null != width && null != height && aabbBounds.set(0, 0, Math.max(0, width), Math.max(0, height)), !clip) {
5491
+ this.forEachChildren(node => {
5492
+ aabbBounds.union(node.AABBBounds);
5493
+ });
5494
+ const {
5495
+ scrollX = 0,
5496
+ scrollY = 0
5497
+ } = attribute;
5498
+ aabbBounds.translate(scrollX, scrollY);
5499
+ }
5500
+ return application.graphicService.updateTempAABBBounds(aabbBounds), application.graphicService.transformAABBBounds(attribute, aabbBounds, groupTheme, !1, this), originalAABBBounds.copy(aabbBounds), originalAABBBounds;
5482
5501
  }
5483
5502
  doUpdateAABBBounds() {
5484
5503
  this.updateAABBBoundsStamp++;
@@ -5826,7 +5845,8 @@
5826
5845
  onAddIncremental: new SyncHook(["graphic", "group", "stage"]),
5827
5846
  onClearIncremental: new SyncHook(["graphic", "group", "stage"]),
5828
5847
  beforeUpdateAABBBounds: new SyncHook(["graphic", "stage", "willUpdate", "aabbBounds"]),
5829
- afterUpdateAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds", "globalAABBBounds", "selfChange"])
5848
+ afterUpdateAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds", "globalAABBBounds", "selfChange"]),
5849
+ clearAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds"])
5830
5850
  }, this.tempAABBBounds1 = new vutils.AABBBounds(), this.tempAABBBounds2 = new vutils.AABBBounds();
5831
5851
  }
5832
5852
  onAttributeUpdate(graphic) {
@@ -5853,6 +5873,9 @@
5853
5873
  afterUpdateAABBBounds(graphic, stage, bounds, params, selfChange) {
5854
5874
  this.hooks.afterUpdateAABBBounds.taps.length && this.hooks.afterUpdateAABBBounds.call(graphic, stage, bounds, params, selfChange);
5855
5875
  }
5876
+ clearAABBBounds(graphic, stage, b) {
5877
+ this.hooks.clearAABBBounds.taps.length && this.hooks.clearAABBBounds.call(graphic, stage, b);
5878
+ }
5856
5879
  updatePathProxyAABBBounds(aabbBounds, graphic) {
5857
5880
  const path = "function" == typeof graphic.pathProxy ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;
5858
5881
  if (!path) return !1;
@@ -5915,12 +5938,11 @@
5915
5938
  validCheck(attribute, theme, aabbBounds, graphic) {
5916
5939
  if (!graphic) return !0;
5917
5940
  if (null != attribute.forceBoundsHeight || null != attribute.forceBoundsWidth) return !0;
5918
- if (graphic.shadowRoot) return !0;
5919
- if (!graphic.valid) return aabbBounds.clear(), !1;
5941
+ if (graphic.shadowRoot || graphic.isContainer) return !0;
5920
5942
  const {
5921
5943
  visible = theme.visible
5922
5944
  } = attribute;
5923
- return !!visible || (aabbBounds.clear(), !1);
5945
+ return !(!graphic.valid || !visible) || (aabbBounds.empty() || (graphic.parent && aabbBounds.transformWithMatrix(graphic.parent.globalTransMatrix), application.graphicService.clearAABBBounds(graphic, graphic.stage, aabbBounds), aabbBounds.clear()), !1);
5924
5946
  }
5925
5947
  updateTempAABBBounds(aabbBounds) {
5926
5948
  const tb1 = this.tempAABBBounds1,
@@ -6804,58 +6826,64 @@
6804
6826
  constructor(fontFamily, options, textMeasure) {
6805
6827
  this.fontFamily = fontFamily, this.textOptions = options, this.textMeasure = textMeasure;
6806
6828
  }
6807
- LayoutBBox(bbox, textAlign, textBaseline) {
6808
- if ("left" === textAlign || "start" === textAlign) bbox.xOffset = 0;else if ("center" === textAlign) bbox.xOffset = bbox.width / -2;else {
6809
- if ("right" !== textAlign && "end" !== textAlign) throw new Error("非法的textAlign");
6810
- bbox.xOffset = -bbox.width;
6811
- }
6812
- return bbox.yOffset = "top" === textBaseline ? 0 : "middle" === textBaseline ? bbox.height / -2 : "alphabetic" === textBaseline ? -.79 * bbox.height : -bbox.height, bbox;
6813
- }
6814
- GetLayout(str, width, height, textAlign, textBaseline, lineHeight, suffix, wordBreak, suffixPosition) {
6815
- const linesLayout = [],
6816
- bboxWH = [width, height],
6817
- bboxOffset = [0, 0];
6818
- for (; str.length > 0;) {
6819
- const {
6820
- str: clipText
6821
- } = this.textMeasure.clipTextWithSuffix(str, this.textOptions, width, suffix, wordBreak, suffixPosition);
6822
- linesLayout.push({
6823
- str: clipText,
6824
- width: this.textMeasure.measureTextWidth(clipText, this.textOptions)
6825
- }), str = str.substring(clipText.length);
6826
- }
6827
- "left" === textAlign || "start" === textAlign || ("center" === textAlign ? bboxOffset[0] = bboxWH[0] / -2 : "right" !== textAlign && "end" !== textAlign || (bboxOffset[0] = -bboxWH[0])), "top" === textBaseline || ("middle" === textBaseline ? bboxOffset[1] = bboxWH[1] / -2 : "bottom" === textBaseline && (bboxOffset[1] = -bboxWH[1]));
6828
- const bbox = {
6829
- xOffset: bboxOffset[0],
6830
- yOffset: bboxOffset[1],
6831
- width: bboxWH[0],
6832
- height: bboxWH[1]
6833
- };
6834
- return this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
6829
+ LayoutBBox(bbox, textAlign, textBaseline, linesLayout) {
6830
+ if (bbox.xOffset = "left" === textAlign || "start" === textAlign ? 0 : "center" === textAlign ? bbox.width / -2 : "right" === textAlign || "end" === textAlign ? -bbox.width : 0, "top" === textBaseline) bbox.yOffset = 0;else if ("middle" === textBaseline) bbox.yOffset = bbox.height / -2;else if ("alphabetic" === textBaseline) {
6831
+ let percent = .79;
6832
+ if (1 === linesLayout.length) {
6833
+ const lineInfo = linesLayout[0];
6834
+ percent = lineInfo.ascent / (lineInfo.ascent + lineInfo.descent);
6835
+ }
6836
+ bbox.yOffset = bbox.height * -percent;
6837
+ } else bbox.yOffset = -bbox.height;
6838
+ return bbox;
6835
6839
  }
6836
6840
  GetLayoutByLines(lines, textAlign, textBaseline, lineHeight) {
6837
6841
  let suffix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
6838
6842
  let wordBreak = arguments.length > 5 ? arguments[5] : undefined;
6839
- let lineWidth = arguments.length > 6 ? arguments[6] : undefined;
6840
- let suffixPosition = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : "end";
6843
+ let params = arguments.length > 6 ? arguments[6] : undefined;
6844
+ const {
6845
+ lineWidth: lineWidth,
6846
+ suffixPosition = "end",
6847
+ measureMode = MeasureModeEnum.actualBounding,
6848
+ keepCenterInLine = !1
6849
+ } = null != params ? params : {};
6841
6850
  lines = lines.map(l => l.toString());
6842
6851
  const linesLayout = [],
6843
6852
  bboxWH = [0, 0];
6844
6853
  if ("number" == typeof lineWidth && lineWidth !== 1 / 0) {
6845
6854
  let width;
6846
- for (let i = 0, len = lines.length; i < len; i++) width = Math.min(this.textMeasure.measureTextWidth(lines[i], this.textOptions), lineWidth), linesLayout.push({
6847
- str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
6848
- width: width
6849
- });
6855
+ for (let i = 0, len = lines.length; i < len; i++) {
6856
+ const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions, measureMode);
6857
+ let str = lines[i].toString();
6858
+ if (metrics.width > lineWidth) {
6859
+ const data = this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, lineWidth, suffix, wordBreak, suffixPosition);
6860
+ str = data.str, width = data.width;
6861
+ } else width = metrics.width;
6862
+ linesLayout.push({
6863
+ str: str,
6864
+ width: width,
6865
+ ascent: metrics.ascent,
6866
+ descent: metrics.descent,
6867
+ keepCenterInLine: keepCenterInLine
6868
+ });
6869
+ }
6850
6870
  bboxWH[0] = lineWidth;
6851
6871
  } else {
6852
- let width, text;
6853
- lineWidth = 0;
6854
- for (let i = 0, len = lines.length; i < len; i++) text = lines[i], width = this.textMeasure.measureTextWidth(text, this.textOptions), lineWidth = Math.max(lineWidth, width), linesLayout.push({
6855
- str: text,
6856
- width: width
6857
- });
6858
- bboxWH[0] = lineWidth;
6872
+ let width,
6873
+ text,
6874
+ _lineWidth = 0;
6875
+ for (let i = 0, len = lines.length; i < len; i++) {
6876
+ text = lines[i];
6877
+ const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions, measureMode);
6878
+ width = metrics.width, _lineWidth = Math.max(_lineWidth, width), linesLayout.push({
6879
+ str: text,
6880
+ width: width,
6881
+ ascent: metrics.ascent,
6882
+ descent: metrics.descent,
6883
+ keepCenterInLine: keepCenterInLine
6884
+ });
6885
+ }
6886
+ bboxWH[0] = _lineWidth;
6859
6887
  }
6860
6888
  bboxWH[1] = linesLayout.length * lineHeight, bboxWH[0] = linesLayout.reduce((a, b) => Math.max(a, b.width), 0);
6861
6889
  const bbox = {
@@ -6864,7 +6892,7 @@
6864
6892
  width: bboxWH[0],
6865
6893
  height: bboxWH[1]
6866
6894
  };
6867
- return this.LayoutBBox(bbox, textAlign, textBaseline), this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
6895
+ return this.LayoutBBox(bbox, textAlign, textBaseline, linesLayout), this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
6868
6896
  }
6869
6897
  layoutWithBBox(bbox, lines, textAlign, textBaseline, lineHeight) {
6870
6898
  const origin = [0, 0],
@@ -6883,11 +6911,19 @@
6883
6911
  };
6884
6912
  }
6885
6913
  lineOffset(bbox, line, textAlign, textBaseline, lineHeight, origin) {
6886
- return "left" === textAlign || "start" === textAlign ? line.leftOffset = 0 : "center" === textAlign ? line.leftOffset = (bbox.width - line.width) / 2 : "right" !== textAlign && "end" !== textAlign || (line.leftOffset = bbox.width - line.width), line.topOffset = (lineHeight - this.textOptions.fontSize) / 2 + .79 * this.textOptions.fontSize + origin[1], origin[1] += lineHeight, line;
6914
+ if ("left" === textAlign || "start" === textAlign ? line.leftOffset = 0 : "center" === textAlign ? line.leftOffset = (bbox.width - line.width) / 2 : "right" !== textAlign && "end" !== textAlign || (line.leftOffset = bbox.width - line.width), line.topOffset = lineHeight / 2 + (line.ascent - line.descent) / 2 + origin[1], !line.keepCenterInLine) {
6915
+ const buf = 0,
6916
+ actualHeightWithBuf = line.ascent + line.descent + buf;
6917
+ if (actualHeightWithBuf < lineHeight - buf && ("bottom" === textBaseline ? line.topOffset += (lineHeight - actualHeightWithBuf) / 2 : "top" === textBaseline && (line.topOffset -= (lineHeight - actualHeightWithBuf) / 2)), "alphabetic" === textBaseline) {
6918
+ const ratio = lineHeight / (line.ascent + line.descent);
6919
+ line.topOffset = lineHeight / 2 + (line.ascent - line.descent) / 2 * ratio + origin[1];
6920
+ }
6921
+ }
6922
+ return origin[1] += lineHeight, line;
6887
6923
  }
6888
6924
  }
6889
6925
 
6890
- const TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "textAlign", "textBaseline", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", "heightLimit", "lineClamp", ...GRAPHIC_UPDATE_TAG_KEY];
6926
+ const TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "maxWidth", "textAlign", "textBaseline", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", "heightLimit", "lineClamp", ...GRAPHIC_UPDATE_TAG_KEY];
6891
6927
  class Text extends Graphic {
6892
6928
  get font() {
6893
6929
  const textTheme = this.getGraphicTheme();
@@ -6896,26 +6932,22 @@
6896
6932
  get clipedText() {
6897
6933
  var _a;
6898
6934
  const attribute = this.attribute,
6899
- textTheme = this.getGraphicTheme();
6900
- if (!this.isSimplify()) return;
6901
- const {
6902
- maxLineWidth = textTheme.maxLineWidth
6903
- } = attribute;
6904
- return Number.isFinite(maxLineWidth) ? (this.tryUpdateAABBBounds(), this.cache.clipedText) : (null !== (_a = attribute.text) && void 0 !== _a ? _a : textTheme.text).toString();
6935
+ textTheme = this.getGraphicTheme(),
6936
+ maxWidth = this.getMaxWidth(textTheme);
6937
+ return Number.isFinite(maxWidth) ? (this.tryUpdateAABBBounds(), this.cache.clipedText) : (null !== (_a = attribute.text) && void 0 !== _a ? _a : textTheme.text).toString();
6905
6938
  }
6906
6939
  get clipedWidth() {
6907
- if (this.isSimplify()) return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
6940
+ return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
6908
6941
  }
6909
6942
  get cliped() {
6910
6943
  var _a, _b;
6911
6944
  const textTheme = this.getGraphicTheme(),
6912
6945
  attribute = this.attribute,
6913
- {
6914
- maxLineWidth = textTheme.maxLineWidth,
6915
- text: text,
6916
- whiteSpace = textTheme.whiteSpace
6917
- } = attribute;
6918
- if (!Number.isFinite(maxLineWidth)) return !1;
6946
+ maxWidth = this.getMaxWidth(textTheme);
6947
+ if (!Number.isFinite(maxWidth)) return !1;
6948
+ const {
6949
+ text: text
6950
+ } = this.attribute;
6919
6951
  if (this.tryUpdateAABBBounds(), null === (_b = null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData) || void 0 === _b ? void 0 : _b.lines) {
6920
6952
  let mergedText = "";
6921
6953
  this.cache.layoutData.lines.forEach(item => {
@@ -6926,10 +6958,7 @@
6926
6958
  return "vertical" === attribute.direction && this.cache.verticalList && this.cache.verticalList[0] ? this.cache.verticalList[0].map(item => item.text).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString();
6927
6959
  }
6928
6960
  get multilineLayout() {
6929
- if (this.isMultiLine) return this.tryUpdateAABBBounds(), this.cache.layoutData;
6930
- }
6931
- isSimplify() {
6932
- return !this.isMultiLine && "vertical" !== this.attribute.direction;
6961
+ return this.tryUpdateAABBBounds(), this.cache.layoutData;
6933
6962
  }
6934
6963
  get isMultiLine() {
6935
6964
  return Array.isArray(this.attribute.text) || "normal" === this.attribute.whiteSpace;
@@ -7002,8 +7031,74 @@
7002
7031
  }
7003
7032
  return application.graphicService.combindShadowAABBBounds(aabbBounds, this), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds), vutils.transformBoundsWithMatrix(aabbBounds, aabbBounds, this.transMatrix), aabbBounds;
7004
7033
  }
7034
+ updateSingallineAABBBounds(text) {
7035
+ this.updateMultilineAABBBounds([text]);
7036
+ const layoutData = this.cache.layoutData;
7037
+ if (layoutData && layoutData.lines && layoutData.lines.length) {
7038
+ const line = layoutData.lines[0];
7039
+ this.cache.clipedText = line.str, this.cache.clipedWidth = line.width;
7040
+ }
7041
+ return this._AABBBounds;
7042
+ }
7043
+ updateMultilineAABBBounds(text) {
7044
+ const textTheme = this.getGraphicTheme(),
7045
+ {
7046
+ direction = textTheme.direction,
7047
+ underlineOffset = textTheme.underlineOffset
7048
+ } = this.attribute,
7049
+ b = "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
7050
+ return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
7051
+ }
7052
+ guessLineHeightBuf(fontSize) {
7053
+ return fontSize ? .1 * fontSize : 0;
7054
+ }
7055
+ updateHorizontalMultilineAABBBounds(text) {
7056
+ var _a;
7057
+ const textTheme = this.getGraphicTheme(),
7058
+ attribute = this.attribute,
7059
+ {
7060
+ fontFamily = textTheme.fontFamily,
7061
+ textAlign = textTheme.textAlign,
7062
+ textBaseline = textTheme.textBaseline,
7063
+ fontSize = textTheme.fontSize,
7064
+ fontWeight = textTheme.fontWeight,
7065
+ ellipsis = textTheme.ellipsis,
7066
+ maxLineWidth: maxLineWidth,
7067
+ stroke = textTheme.stroke,
7068
+ wrap = textTheme.wrap,
7069
+ measureMode = textTheme.measureMode,
7070
+ lineWidth = textTheme.lineWidth,
7071
+ whiteSpace = textTheme.whiteSpace,
7072
+ suffixPosition = textTheme.suffixPosition,
7073
+ ignoreBuf = textTheme.ignoreBuf,
7074
+ keepCenterInLine = textTheme.keepCenterInLine
7075
+ } = attribute,
7076
+ buf = ignoreBuf ? 0 : this.guessLineHeightBuf(fontSize),
7077
+ lineHeight = this.getLineHeight(attribute, textTheme, buf);
7078
+ if ("normal" === whiteSpace || wrap) return this.updateWrapAABBBounds(text);
7079
+ if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
7080
+ const bbox = this.cache.layoutData.bbox;
7081
+ return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
7082
+ }
7083
+ const textMeasure = application.graphicUtil.textMeasure,
7084
+ layoutData = new CanvasTextLayout(fontFamily, {
7085
+ fontSize: fontSize,
7086
+ fontWeight: fontWeight,
7087
+ fontFamily: fontFamily,
7088
+ lineHeight: lineHeight
7089
+ }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, {
7090
+ lineWidth: maxLineWidth,
7091
+ suffixPosition: suffixPosition,
7092
+ measureMode: measureMode,
7093
+ keepCenterInLine: keepCenterInLine
7094
+ }),
7095
+ {
7096
+ bbox: bbox
7097
+ } = layoutData;
7098
+ return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
7099
+ }
7005
7100
  updateWrapAABBBounds(text) {
7006
- var _a, _b, _c, _d;
7101
+ var _a, _b, _c;
7007
7102
  const textTheme = this.getGraphicTheme(),
7008
7103
  {
7009
7104
  fontFamily = textTheme.fontFamily,
@@ -7017,22 +7112,26 @@
7017
7112
  wordBreak = textTheme.wordBreak,
7018
7113
  fontWeight = textTheme.fontWeight,
7019
7114
  ignoreBuf = textTheme.ignoreBuf,
7115
+ measureMode = textTheme.measureMode,
7020
7116
  suffixPosition = textTheme.suffixPosition,
7021
7117
  heightLimit = 0,
7022
- lineClamp: lineClamp
7118
+ lineClamp: lineClamp,
7119
+ keepCenterInLine = textTheme.keepCenterInLine
7023
7120
  } = this.attribute,
7024
- lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
7025
- buf = ignoreBuf ? 0 : 2;
7026
- if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
7121
+ buf = ignoreBuf ? 0 : this.guessLineHeightBuf(fontSize),
7122
+ lineHeight = this.getLineHeight(this.attribute, textTheme, buf);
7123
+ if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
7027
7124
  const bbox = this.cache.layoutData.bbox;
7028
7125
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
7029
7126
  }
7030
7127
  const textMeasure = application.graphicUtil.textMeasure,
7031
- layoutObj = new CanvasTextLayout(fontFamily, {
7128
+ textOptions = {
7032
7129
  fontSize: fontSize,
7033
7130
  fontWeight: fontWeight,
7034
- fontFamily: fontFamily
7035
- }, textMeasure),
7131
+ fontFamily: fontFamily,
7132
+ lineHeight: lineHeight
7133
+ },
7134
+ layoutObj = new CanvasTextLayout(fontFamily, textOptions, textMeasure),
7036
7135
  lines = vutils.isArray(text) ? text.map(l => l.toString()) : [text.toString()],
7037
7136
  linesLayout = [],
7038
7137
  bboxWH = [0, 0];
@@ -7042,24 +7141,32 @@
7042
7141
  const str = lines[i];
7043
7142
  let needCut = !0;
7044
7143
  if (i === lineCountLimit - 1) {
7045
- const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1);
7144
+ const clip = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1),
7145
+ matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
7046
7146
  linesLayout.push({
7047
7147
  str: clip.str,
7048
- width: clip.width
7148
+ width: clip.width,
7149
+ ascent: matrics.ascent,
7150
+ descent: matrics.descent,
7151
+ keepCenterInLine: keepCenterInLine
7049
7152
  });
7050
7153
  break;
7051
7154
  }
7052
- const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, "break-all" !== wordBreak, "keep-all" === wordBreak);
7155
+ const clip = textMeasure.clipText(str, textOptions, maxLineWidth, "break-all" !== wordBreak, "keep-all" === wordBreak);
7053
7156
  if ("" !== str && "" === clip.str || clip.wordBreaked) {
7054
7157
  if (ellipsis) {
7055
- const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
7056
- clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
7158
+ const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
7159
+ clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
7057
7160
  } else clip.str = "", clip.width = 0;
7058
7161
  needCut = !1;
7059
7162
  }
7163
+ const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
7060
7164
  linesLayout.push({
7061
7165
  str: clip.str,
7062
- width: clip.width
7166
+ width: clip.width,
7167
+ ascent: matrics.ascent,
7168
+ descent: matrics.descent,
7169
+ keepCenterInLine: keepCenterInLine
7063
7170
  });
7064
7171
  let cutLength = clip.str.length;
7065
7172
  if (!clip.wordBreaked || "" !== str && "" === clip.str || (needCut = !0, cutLength = clip.wordBreaked), clip.str.length === str.length) ;else if (needCut) {
@@ -7077,235 +7184,46 @@
7077
7184
  lineWidth = 0;
7078
7185
  for (let i = 0, len = lines.length; i < len; i++) {
7079
7186
  if (i === lineCountLimit - 1) {
7080
- const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
7187
+ const clip = textMeasure.clipTextWithSuffix(lines[i], textOptions, maxLineWidth, ellipsis, !1, suffixPosition),
7188
+ matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
7081
7189
  linesLayout.push({
7082
7190
  str: clip.str,
7083
- width: clip.width
7191
+ width: clip.width,
7192
+ ascent: matrics.ascent,
7193
+ descent: matrics.descent,
7194
+ keepCenterInLine: keepCenterInLine
7084
7195
  }), lineWidth = Math.max(lineWidth, clip.width);
7085
7196
  break;
7086
7197
  }
7087
- text = lines[i], width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, "break-word" === wordBreak), lineWidth = Math.max(lineWidth, width), linesLayout.push({
7198
+ text = lines[i], width = textMeasure.measureTextWidth(text, textOptions), lineWidth = Math.max(lineWidth, width);
7199
+ const matrics = textMeasure.measureTextPixelADscentAndWidth(text, textOptions, measureMode);
7200
+ linesLayout.push({
7088
7201
  str: text,
7089
- width: width
7202
+ width: width,
7203
+ ascent: matrics.ascent,
7204
+ descent: matrics.descent,
7205
+ keepCenterInLine: keepCenterInLine
7090
7206
  });
7091
7207
  }
7092
7208
  bboxWH[0] = lineWidth;
7093
7209
  }
7094
- bboxWH[1] = linesLayout.length * (lineHeight + buf);
7210
+ bboxWH[1] = linesLayout.length * lineHeight;
7095
7211
  const bbox = {
7096
7212
  xOffset: 0,
7097
7213
  yOffset: 0,
7098
7214
  width: bboxWH[0],
7099
7215
  height: bboxWH[1]
7100
7216
  };
7101
- layoutObj.LayoutBBox(bbox, textAlign, textBaseline);
7217
+ layoutObj.LayoutBBox(bbox, textAlign, textBaseline, linesLayout);
7102
7218
  const layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
7103
7219
  return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
7104
7220
  }
7105
- updateSingallineAABBBounds(text) {
7106
- const textTheme = this.getGraphicTheme(),
7107
- {
7108
- direction = textTheme.direction,
7109
- underlineOffset = textTheme.underlineOffset
7110
- } = this.attribute,
7111
- b = "horizontal" === direction ? this.updateHorizontalSinglelineAABBBounds(text) : this.updateVerticalSinglelineAABBBounds(text);
7112
- return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
7113
- }
7114
- updateMultilineAABBBounds(text) {
7115
- const textTheme = this.getGraphicTheme(),
7116
- {
7117
- direction = textTheme.direction,
7118
- underlineOffset = textTheme.underlineOffset
7119
- } = this.attribute,
7120
- b = "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
7121
- return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
7122
- }
7123
- updateHorizontalSinglelineAABBBounds(text) {
7124
- var _a, _b;
7125
- const textTheme = this.getGraphicTheme(),
7126
- {
7127
- wrap = textTheme.wrap
7128
- } = this.attribute;
7129
- if (wrap) return this.updateWrapAABBBounds([text]);
7130
- const textMeasure = application.graphicUtil.textMeasure;
7131
- let width, str;
7132
- const attribute = this.attribute,
7133
- {
7134
- maxLineWidth = textTheme.maxLineWidth,
7135
- ellipsis = textTheme.ellipsis,
7136
- textAlign = textTheme.textAlign,
7137
- textBaseline = textTheme.textBaseline,
7138
- fontFamily = textTheme.fontFamily,
7139
- fontSize = textTheme.fontSize,
7140
- fontWeight = textTheme.fontWeight,
7141
- stroke = textTheme.stroke,
7142
- lineWidth = textTheme.lineWidth,
7143
- ignoreBuf = textTheme.ignoreBuf,
7144
- whiteSpace = textTheme.whiteSpace,
7145
- suffixPosition = textTheme.suffixPosition
7146
- } = attribute;
7147
- if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
7148
- const buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
7149
- textFontSize = attribute.fontSize || textTheme.fontSize,
7150
- lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) && void 0 !== _a ? _a : textFontSize + buf;
7151
- if (!this.shouldUpdateShape() && this.cache) {
7152
- width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
7153
- const dx = textDrawOffsetX(textAlign, width),
7154
- dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
7155
- return this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
7156
- }
7157
- if (Number.isFinite(maxLineWidth)) {
7158
- if (ellipsis) {
7159
- const strEllipsis = !0 === ellipsis ? textTheme.ellipsis : ellipsis,
7160
- data = textMeasure.clipTextWithSuffix(text.toString(), {
7161
- fontSize: fontSize,
7162
- fontWeight: fontWeight,
7163
- fontFamily: fontFamily
7164
- }, maxLineWidth, strEllipsis, !1, suffixPosition);
7165
- str = data.str, width = data.width;
7166
- } else {
7167
- const data = textMeasure.clipText(text.toString(), {
7168
- fontSize: fontSize,
7169
- fontWeight: fontWeight,
7170
- fontFamily: fontFamily
7171
- }, maxLineWidth, !1);
7172
- str = data.str, width = data.width;
7173
- }
7174
- this.cache.clipedText = str, this.cache.clipedWidth = width;
7175
- } else width = textMeasure.measureTextWidth(text.toString(), {
7176
- fontSize: fontSize,
7177
- fontWeight: fontWeight,
7178
- fontFamily: fontFamily
7179
- }), this.cache.clipedText = text.toString(), this.cache.clipedWidth = width;
7180
- this.clearUpdateShapeTag();
7181
- const dx = textDrawOffsetX(textAlign, width);
7182
- let lh = lineHeight;
7183
- application.global && application.global.isSafari() && (lh += .2 * fontSize);
7184
- const dy = textLayoutOffsetY(textBaseline, lh, fontSize, buf);
7185
- return this._AABBBounds.set(dx, dy, dx + width, dy + lh), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
7186
- }
7187
- getBaselineMapAlign() {
7188
- return Text.baselineMapAlign;
7189
- }
7190
- getAlignMapBaseline() {
7191
- return Text.alignMapBaseline;
7192
- }
7193
- updateVerticalSinglelineAABBBounds(text) {
7194
- var _a, _b, _c;
7195
- const textTheme = this.getGraphicTheme(),
7196
- textMeasure = application.graphicUtil.textMeasure;
7197
- let width;
7198
- const attribute = this.attribute,
7199
- {
7200
- ignoreBuf = textTheme.ignoreBuf
7201
- } = attribute,
7202
- buf = ignoreBuf ? 0 : 2,
7203
- {
7204
- maxLineWidth = textTheme.maxLineWidth,
7205
- ellipsis = textTheme.ellipsis,
7206
- fontSize = textTheme.fontSize,
7207
- fontWeight = textTheme.fontWeight,
7208
- fontFamily = textTheme.fontFamily,
7209
- stroke = textTheme.stroke,
7210
- lineWidth = textTheme.lineWidth,
7211
- verticalMode = textTheme.verticalMode,
7212
- suffixPosition = textTheme.suffixPosition
7213
- } = attribute,
7214
- lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
7215
- let {
7216
- textAlign = textTheme.textAlign,
7217
- textBaseline = textTheme.textBaseline
7218
- } = attribute;
7219
- if (!verticalMode) {
7220
- const t = textAlign;
7221
- textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
7222
- }
7223
- if (!this.shouldUpdateShape() && this.cache) {
7224
- width = this.cache.clipedWidth;
7225
- const dx = textDrawOffsetX(textAlign, width),
7226
- dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
7227
- return this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
7228
- }
7229
- let verticalList = [verticalLayout(text.toString())];
7230
- if (Number.isFinite(maxLineWidth)) {
7231
- if (ellipsis) {
7232
- const strEllipsis = !0 === ellipsis ? textTheme.ellipsis : ellipsis,
7233
- data = textMeasure.clipTextWithSuffixVertical(verticalList[0], {
7234
- fontSize: fontSize,
7235
- fontWeight: fontWeight,
7236
- fontFamily: fontFamily
7237
- }, maxLineWidth, strEllipsis, !1, suffixPosition);
7238
- verticalList = [data.verticalList], width = data.width;
7239
- } else {
7240
- const data = textMeasure.clipTextVertical(verticalList[0], {
7241
- fontSize: fontSize,
7242
- fontWeight: fontWeight,
7243
- fontFamily: fontFamily
7244
- }, maxLineWidth, !1);
7245
- verticalList = [data.verticalList], width = data.width;
7246
- }
7247
- this.cache.verticalList = verticalList, this.cache.clipedWidth = width;
7248
- } else width = 0, verticalList[0].forEach(t => {
7249
- const w = t.direction === TextDirection.HORIZONTAL ? fontSize : textMeasure.measureTextWidth(t.text, {
7250
- fontSize: fontSize,
7251
- fontWeight: fontWeight,
7252
- fontFamily: fontFamily
7253
- });
7254
- width += w, t.width = w;
7255
- }), this.cache.verticalList = verticalList, this.cache.clipedWidth = width;
7256
- this.clearUpdateShapeTag();
7257
- const dx = textDrawOffsetX(textAlign, width),
7258
- dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
7259
- return this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
7260
- }
7261
- updateHorizontalMultilineAABBBounds(text) {
7262
- var _a, _b;
7263
- const textTheme = this.getGraphicTheme(),
7264
- {
7265
- wrap = textTheme.wrap
7266
- } = this.attribute;
7267
- if (wrap) return this.updateWrapAABBBounds(text);
7268
- const attribute = this.attribute,
7269
- {
7270
- fontFamily = textTheme.fontFamily,
7271
- textAlign = textTheme.textAlign,
7272
- textBaseline = textTheme.textBaseline,
7273
- fontSize = textTheme.fontSize,
7274
- fontWeight = textTheme.fontWeight,
7275
- ellipsis = textTheme.ellipsis,
7276
- maxLineWidth: maxLineWidth,
7277
- stroke = textTheme.stroke,
7278
- lineWidth = textTheme.lineWidth,
7279
- whiteSpace = textTheme.whiteSpace,
7280
- suffixPosition = textTheme.suffixPosition
7281
- } = attribute,
7282
- lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
7283
- if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
7284
- if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
7285
- const bbox = this.cache.layoutData.bbox;
7286
- return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
7287
- }
7288
- const textMeasure = application.graphicUtil.textMeasure,
7289
- layoutData = new CanvasTextLayout(fontFamily, {
7290
- fontSize: fontSize,
7291
- fontWeight: fontWeight,
7292
- fontFamily: fontFamily
7293
- }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, maxLineWidth, suffixPosition),
7294
- {
7295
- bbox: bbox
7296
- } = layoutData;
7297
- return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
7298
- }
7299
7221
  updateVerticalMultilineAABBBounds(text) {
7300
- var _a, _b, _c;
7222
+ var _a, _b;
7301
7223
  const textTheme = this.getGraphicTheme(),
7302
7224
  textMeasure = application.graphicUtil.textMeasure;
7303
7225
  let width;
7304
7226
  const attribute = this.attribute,
7305
- {
7306
- ignoreBuf = textTheme.ignoreBuf
7307
- } = attribute,
7308
- buf = ignoreBuf ? 0 : 2,
7309
7227
  {
7310
7228
  maxLineWidth = textTheme.maxLineWidth,
7311
7229
  ellipsis = textTheme.ellipsis,
@@ -7317,14 +7235,14 @@
7317
7235
  verticalMode = textTheme.verticalMode,
7318
7236
  suffixPosition = textTheme.suffixPosition
7319
7237
  } = attribute,
7320
- lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
7238
+ lineHeight = this.getLineHeight(attribute, textTheme, 0);
7321
7239
  let {
7322
7240
  textAlign = textTheme.textAlign,
7323
7241
  textBaseline = textTheme.textBaseline
7324
7242
  } = attribute;
7325
7243
  if (!verticalMode) {
7326
7244
  const t = textAlign;
7327
- textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
7245
+ textAlign = null !== (_a = Text.baselineMapAlign[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = Text.alignMapBaseline[t]) && void 0 !== _b ? _b : "top";
7328
7246
  }
7329
7247
  if (width = 0, !this.shouldUpdateShape() && this.cache) {
7330
7248
  this.cache.verticalList.forEach(item => {
@@ -7372,6 +7290,15 @@
7372
7290
  dy = textLayoutOffsetY(textBaseline, height, fontSize);
7373
7291
  return this._AABBBounds.set(dy, dx, dy + height, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
7374
7292
  }
7293
+ getMaxWidth(theme) {
7294
+ var _a, _b;
7295
+ const attribute = this.attribute;
7296
+ return null !== (_b = null !== (_a = attribute.maxLineWidth) && void 0 !== _a ? _a : attribute.maxWidth) && void 0 !== _b ? _b : theme.maxWidth;
7297
+ }
7298
+ getLineHeight(attribute, textTheme, buf) {
7299
+ var _a;
7300
+ return null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
7301
+ }
7375
7302
  needUpdateTags(keys) {
7376
7303
  let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TEXT_UPDATE_TAG_KEY;
7377
7304
  return super.needUpdateTags(keys, k);
@@ -7386,6 +7313,12 @@
7386
7313
  getNoWorkAnimateAttr() {
7387
7314
  return Text.NOWORK_ANIMATE_ATTR;
7388
7315
  }
7316
+ getBaselineMapAlign() {
7317
+ return Text.baselineMapAlign;
7318
+ }
7319
+ getAlignMapBaseline() {
7320
+ return Text.alignMapBaseline;
7321
+ }
7389
7322
  }
7390
7323
  Text.NOWORK_ANIMATE_ATTR = Object.assign({
7391
7324
  ellipsis: 1,