@visactor/vrender 0.21.0-alpha.10 → 0.21.0-alpha.12

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/cjs/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import '@visactor/vrender-core';
2
- export declare const version = "0.21.0-alpha.10";
2
+ export declare const version = "0.21.0-alpha.12";
3
3
  export * from '@visactor/vrender-core';
4
4
  export * from '@visactor/vrender-kits';
package/cjs/index.js CHANGED
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "__esModule", {
21
21
 
22
22
  const vrender_core_1 = require("@visactor/vrender-core"), vrender_kits_1 = require("@visactor/vrender-kits"), vrender_kits_2 = require("@visactor/vrender-kits");
23
23
 
24
- exports.version = "0.21.0-alpha.10", (0, vrender_core_1.preLoadAllModule)(), (0,
24
+ exports.version = "0.21.0-alpha.12", (0, vrender_core_1.preLoadAllModule)(), (0,
25
25
  vrender_core_1.isBrowserEnv)() ? (0, vrender_kits_1.loadBrowserEnv)(vrender_core_1.container) : (0,
26
26
  vrender_core_1.isNodeEnv)() && (0, vrender_kits_1.loadNodeEnv)(vrender_core_1.container),
27
27
  (0, vrender_kits_2.registerArc)(), (0, vrender_kits_2.registerArc3d)(), (0, vrender_kits_2.registerArea)(),
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAWgC;AAChC,yDAAqE;AACrE,yDAmBgC;AAEnB,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;IAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;CAC3B;KAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;IACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;CACxB;AACD,IAAA,0BAAW,GAAE,CAAC;AACd,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,8BAAe,GAAE,CAAC;AAClB,IAAA,gCAAiB,GAAE,CAAC;AACpB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,iCAAkB,GAAE,CAAC;AACrB,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,4CAA6B,GAAE,CAAC;AAChC,IAAA,0CAA2B,GAAE,CAAC;AAC9B,IAAA,2CAA4B,GAAE,CAAC;AAC/B,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,kCAAmB,GAAE,CAAC;AACtB,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import '@visactor/vrender-core';\nimport {\n container,\n isBrowserEnv,\n isNodeEnv,\n preLoadAllModule,\n registerFlexLayoutPlugin,\n registerViewTransform3dPlugin,\n registerHtmlAttributePlugin,\n registerReactAttributePlugin,\n registerDirectionalLight,\n registerOrthoCamera\n} from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\n// 导出版本号\nexport const version = \"0.21.0-alpha.10\";\n\npreLoadAllModule();\n\nif (isBrowserEnv()) {\n loadBrowserEnv(container);\n} else if (isNodeEnv()) {\n loadNodeEnv(container);\n}\nregisterArc();\nregisterArc3d();\nregisterArea();\nregisterCircle();\nregisterGlyph();\nregisterGroup();\nregisterImage();\nregisterLine();\nregisterPath();\nregisterPolygon();\nregisterPyramid3d();\nregisterRect();\nregisterRect3d();\nregisterRichtext();\nregisterShadowRoot();\nregisterSymbol();\nregisterText();\nregisterWrapText();\n\nregisterFlexLayoutPlugin();\nregisterViewTransform3dPlugin();\nregisterHtmlAttributePlugin();\nregisterReactAttributePlugin();\nregisterDirectionalLight();\nregisterOrthoCamera();\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAWgC;AAChC,yDAAqE;AACrE,yDAmBgC;AAEnB,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;IAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;CAC3B;KAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;IACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;CACxB;AACD,IAAA,0BAAW,GAAE,CAAC;AACd,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,8BAAe,GAAE,CAAC;AAClB,IAAA,gCAAiB,GAAE,CAAC;AACpB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,iCAAkB,GAAE,CAAC;AACrB,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,4CAA6B,GAAE,CAAC;AAChC,IAAA,0CAA2B,GAAE,CAAC;AAC9B,IAAA,2CAA4B,GAAE,CAAC;AAC/B,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,kCAAmB,GAAE,CAAC;AACtB,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import '@visactor/vrender-core';\nimport {\n container,\n isBrowserEnv,\n isNodeEnv,\n preLoadAllModule,\n registerFlexLayoutPlugin,\n registerViewTransform3dPlugin,\n registerHtmlAttributePlugin,\n registerReactAttributePlugin,\n registerDirectionalLight,\n registerOrthoCamera\n} from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\n// 导出版本号\nexport const version = \"0.21.0-alpha.12\";\n\npreLoadAllModule();\n\nif (isBrowserEnv()) {\n loadBrowserEnv(container);\n} else if (isNodeEnv()) {\n loadNodeEnv(container);\n}\nregisterArc();\nregisterArc3d();\nregisterArea();\nregisterCircle();\nregisterGlyph();\nregisterGroup();\nregisterImage();\nregisterLine();\nregisterPath();\nregisterPolygon();\nregisterPyramid3d();\nregisterRect();\nregisterRect3d();\nregisterRichtext();\nregisterShadowRoot();\nregisterSymbol();\nregisterText();\nregisterWrapText();\n\nregisterFlexLayoutPlugin();\nregisterViewTransform3dPlugin();\nregisterHtmlAttributePlugin();\nregisterReactAttributePlugin();\nregisterDirectionalLight();\nregisterOrthoCamera();\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
package/dist/index.es.js CHANGED
@@ -3951,7 +3951,8 @@ const DefaultTextStyle = {
3951
3951
  underlineDash: [],
3952
3952
  underlineOffset: 0,
3953
3953
  disableAutoClipedPoptip: void 0,
3954
- measureMode: MeasureModeEnum.fontBounding
3954
+ measureMode: MeasureModeEnum.fontBounding,
3955
+ keepCenterInLine: !1
3955
3956
  };
3956
3957
  const DefaultPickStyle = {
3957
3958
  pickStrokeBuffer: 0
@@ -7339,12 +7340,16 @@ class RafBasedSTO {
7339
7340
  }
7340
7341
  RafBasedSTO.TimeOut = 1e3 / 60;
7341
7342
  const rafBasedSto = new RafBasedSTO();
7342
- const calculateLineHeight = (lineHeight, fontSize) => {
7343
+ const _calculateLineHeight = (lineHeight, fontSize) => {
7343
7344
  if (isString$1(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
7344
7345
  return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
7345
7346
  }
7346
7347
  return lineHeight;
7347
7348
  };
7349
+ const calculateLineHeight = (lineHeight, fontSize) => {
7350
+ const _lh = _calculateLineHeight(lineHeight, fontSize);
7351
+ return isNaN(_lh) ? _lh : Math.max(fontSize, _lh);
7352
+ };
7348
7353
 
7349
7354
  class IncreaseCount extends ACustomAnimate {
7350
7355
  constructor(from, to, duration, easing, params) {
@@ -14598,11 +14603,7 @@ class CanvasTextLayout {
14598
14603
  this.fontFamily = fontFamily, this.textOptions = options, this.textMeasure = textMeasure;
14599
14604
  }
14600
14605
  LayoutBBox(bbox, textAlign, textBaseline, linesLayout) {
14601
- if ("left" === textAlign || "start" === textAlign) bbox.xOffset = 0;else if ("center" === textAlign) bbox.xOffset = bbox.width / -2;else {
14602
- if ("right" !== textAlign && "end" !== textAlign) throw new Error("非法的textAlign");
14603
- bbox.xOffset = -bbox.width;
14604
- }
14605
- if ("top" === textBaseline) bbox.yOffset = 0;else if ("middle" === textBaseline) bbox.yOffset = bbox.height / -2;else if ("alphabetic" === textBaseline) {
14606
+ 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) {
14606
14607
  let percent = .79;
14607
14608
  if (1 === linesLayout.length) {
14608
14609
  const lineInfo = linesLayout[0];
@@ -14619,7 +14620,8 @@ class CanvasTextLayout {
14619
14620
  const {
14620
14621
  lineWidth: lineWidth,
14621
14622
  suffixPosition = "end",
14622
- measureMode = MeasureModeEnum.actualBounding
14623
+ measureMode = MeasureModeEnum.actualBounding,
14624
+ keepCenterInLine = !1
14623
14625
  } = null != params ? params : {};
14624
14626
  lines = lines.map(l => l.toString());
14625
14627
  const linesLayout = [],
@@ -14632,7 +14634,8 @@ class CanvasTextLayout {
14632
14634
  str: metrics.width <= lineWidth ? lines[i].toString() : this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
14633
14635
  width: width,
14634
14636
  ascent: metrics.ascent,
14635
- descent: metrics.descent
14637
+ descent: metrics.descent,
14638
+ keepCenterInLine: keepCenterInLine
14636
14639
  });
14637
14640
  }
14638
14641
  bboxWH[0] = lineWidth;
@@ -14647,7 +14650,8 @@ class CanvasTextLayout {
14647
14650
  str: text,
14648
14651
  width: width,
14649
14652
  ascent: metrics.ascent,
14650
- descent: metrics.descent
14653
+ descent: metrics.descent,
14654
+ keepCenterInLine: keepCenterInLine
14651
14655
  });
14652
14656
  }
14653
14657
  bboxWH[0] = _lineWidth;
@@ -14678,9 +14682,15 @@ class CanvasTextLayout {
14678
14682
  };
14679
14683
  }
14680
14684
  lineOffset(bbox, line, textAlign, textBaseline, lineHeight, origin) {
14681
- "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];
14682
- const actualHeightWithBuf = line.ascent + line.descent + 0;
14683
- return actualHeightWithBuf < lineHeight - 0 && ("bottom" === textBaseline ? line.topOffset += (lineHeight - actualHeightWithBuf) / 2 : "top" === textBaseline && (line.topOffset -= (lineHeight - actualHeightWithBuf) / 2)), origin[1] += lineHeight, line;
14685
+ 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) {
14686
+ const buf = 0,
14687
+ actualHeightWithBuf = line.ascent + line.descent + buf;
14688
+ if (actualHeightWithBuf < lineHeight - buf && ("bottom" === textBaseline ? line.topOffset += (lineHeight - actualHeightWithBuf) / 2 : "top" === textBaseline && (line.topOffset -= (lineHeight - actualHeightWithBuf) / 2)), "alphabetic" === textBaseline) {
14689
+ const ratio = lineHeight / (line.ascent + line.descent);
14690
+ line.topOffset = lineHeight / 2 + (line.ascent - line.descent) / 2 * ratio + origin[1];
14691
+ }
14692
+ }
14693
+ return origin[1] += lineHeight, line;
14684
14694
  }
14685
14695
  }
14686
14696
 
@@ -14795,7 +14805,7 @@ class Text extends Graphic {
14795
14805
  updateSingallineAABBBounds(text) {
14796
14806
  this.updateMultilineAABBBounds([text]);
14797
14807
  const layoutData = this.cache.layoutData;
14798
- if (layoutData) {
14808
+ if (layoutData && layoutData.lines && layoutData.lines.length) {
14799
14809
  const line = layoutData.lines[0];
14800
14810
  this.cache.clipedText = line.str, this.cache.clipedWidth = line.width;
14801
14811
  }
@@ -14831,10 +14841,11 @@ class Text extends Graphic {
14831
14841
  lineWidth = textTheme.lineWidth,
14832
14842
  whiteSpace = textTheme.whiteSpace,
14833
14843
  suffixPosition = textTheme.suffixPosition,
14834
- ignoreBuf = textTheme.ignoreBuf
14844
+ ignoreBuf = textTheme.ignoreBuf,
14845
+ keepCenterInLine = textTheme.keepCenterInLine
14835
14846
  } = attribute,
14836
14847
  buf = ignoreBuf ? 0 : this.guessLineHeightBuf(fontSize),
14837
- lineHeight = this.getLineHeight(attribute, textTheme) + buf;
14848
+ lineHeight = this.getLineHeight(attribute, textTheme, buf);
14838
14849
  if ("normal" === whiteSpace || wrap) return this.updateWrapAABBBounds(text);
14839
14850
  if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14840
14851
  const bbox = this.cache.layoutData.bbox;
@@ -14849,7 +14860,8 @@ class Text extends Graphic {
14849
14860
  }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, {
14850
14861
  lineWidth: maxLineWidth,
14851
14862
  suffixPosition: suffixPosition,
14852
- measureMode: measureMode
14863
+ measureMode: measureMode,
14864
+ keepCenterInLine: keepCenterInLine
14853
14865
  }),
14854
14866
  {
14855
14867
  bbox: bbox
@@ -14874,10 +14886,11 @@ class Text extends Graphic {
14874
14886
  measureMode = textTheme.measureMode,
14875
14887
  suffixPosition = textTheme.suffixPosition,
14876
14888
  heightLimit = 0,
14877
- lineClamp: lineClamp
14889
+ lineClamp: lineClamp,
14890
+ keepCenterInLine = textTheme.keepCenterInLine
14878
14891
  } = this.attribute,
14879
14892
  buf = ignoreBuf ? 0 : this.guessLineHeightBuf(fontSize),
14880
- lineHeight = this.getLineHeight(this.attribute, textTheme) + buf;
14893
+ lineHeight = this.getLineHeight(this.attribute, textTheme, buf);
14881
14894
  if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14882
14895
  const bbox = this.cache.layoutData.bbox;
14883
14896
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
@@ -14905,7 +14918,8 @@ class Text extends Graphic {
14905
14918
  str: clip.str,
14906
14919
  width: clip.width,
14907
14920
  ascent: matrics.ascent,
14908
- descent: matrics.descent
14921
+ descent: matrics.descent,
14922
+ keepCenterInLine: keepCenterInLine
14909
14923
  });
14910
14924
  break;
14911
14925
  }
@@ -14922,7 +14936,8 @@ class Text extends Graphic {
14922
14936
  str: clip.str,
14923
14937
  width: clip.width,
14924
14938
  ascent: matrics.ascent,
14925
- descent: matrics.descent
14939
+ descent: matrics.descent,
14940
+ keepCenterInLine: keepCenterInLine
14926
14941
  });
14927
14942
  let cutLength = clip.str.length;
14928
14943
  if (!clip.wordBreaked || "" !== str && "" === clip.str || (needCut = !0, cutLength = clip.wordBreaked), clip.str.length === str.length) ;else if (needCut) {
@@ -14946,7 +14961,8 @@ class Text extends Graphic {
14946
14961
  str: clip.str,
14947
14962
  width: clip.width,
14948
14963
  ascent: matrics.ascent,
14949
- descent: matrics.descent
14964
+ descent: matrics.descent,
14965
+ keepCenterInLine: keepCenterInLine
14950
14966
  }), lineWidth = Math.max(lineWidth, clip.width);
14951
14967
  break;
14952
14968
  }
@@ -14956,7 +14972,8 @@ class Text extends Graphic {
14956
14972
  str: text,
14957
14973
  width: width,
14958
14974
  ascent: matrics.ascent,
14959
- descent: matrics.descent
14975
+ descent: matrics.descent,
14976
+ keepCenterInLine: keepCenterInLine
14960
14977
  });
14961
14978
  }
14962
14979
  bboxWH[0] = lineWidth;
@@ -14989,7 +15006,7 @@ class Text extends Graphic {
14989
15006
  verticalMode = textTheme.verticalMode,
14990
15007
  suffixPosition = textTheme.suffixPosition
14991
15008
  } = attribute,
14992
- lineHeight = this.getLineHeight(attribute, textTheme);
15009
+ lineHeight = this.getLineHeight(attribute, textTheme, 0);
14993
15010
  let {
14994
15011
  textAlign = textTheme.textAlign,
14995
15012
  textBaseline = textTheme.textBaseline
@@ -15049,9 +15066,9 @@ class Text extends Graphic {
15049
15066
  const attribute = this.attribute;
15050
15067
  return null !== (_b = null !== (_a = attribute.maxLineWidth) && void 0 !== _a ? _a : attribute.maxWidth) && void 0 !== _b ? _b : theme.maxWidth;
15051
15068
  }
15052
- getLineHeight(attribute, textTheme) {
15069
+ getLineHeight(attribute, textTheme, buf) {
15053
15070
  var _a;
15054
- return null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
15071
+ return null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
15055
15072
  }
15056
15073
  needUpdateTags(keys) {
15057
15074
  let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TEXT_UPDATE_TAG_KEY;
@@ -15153,7 +15170,8 @@ class WrapText extends Text {
15153
15170
  str: clip.str,
15154
15171
  width: clip.width,
15155
15172
  ascent: 0,
15156
- descent: 0
15173
+ descent: 0,
15174
+ keepCenterInLine: !1
15157
15175
  });
15158
15176
  break;
15159
15177
  }
@@ -15169,7 +15187,8 @@ class WrapText extends Text {
15169
15187
  str: clip.str,
15170
15188
  width: clip.width,
15171
15189
  ascent: 0,
15172
- descent: 0
15190
+ descent: 0,
15191
+ keepCenterInLine: !1
15173
15192
  }), clip.str.length === str.length) ;else if (needCut) {
15174
15193
  const newStr = str.substring(clip.str.length);
15175
15194
  lines.splice(i + 1, 0, newStr);
@@ -15190,7 +15209,8 @@ class WrapText extends Text {
15190
15209
  str: clip.str,
15191
15210
  width: clip.width,
15192
15211
  ascent: 0,
15193
- descent: 0
15212
+ descent: 0,
15213
+ keepCenterInLine: !1
15194
15214
  }), lineWidth = Math.max(lineWidth, clip.width);
15195
15215
  break;
15196
15216
  }
@@ -15198,7 +15218,8 @@ class WrapText extends Text {
15198
15218
  str: text,
15199
15219
  width: width,
15200
15220
  ascent: 0,
15201
- descent: 0
15221
+ descent: 0,
15222
+ keepCenterInLine: !1
15202
15223
  });
15203
15224
  }
15204
15225
  bboxWH[0] = lineWidth;
@@ -28621,7 +28642,7 @@ const registerWrapText = _registerWrapText;
28621
28642
 
28622
28643
  const roughModule = _roughModule;
28623
28644
 
28624
- const version = "0.21.0-alpha.10";
28645
+ const version = "0.21.0-alpha.12";
28625
28646
  preLoadAllModule();
28626
28647
  if (isBrowserEnv()) {
28627
28648
  loadBrowserEnv(container);
@@ -28654,4 +28675,4 @@ registerReactAttributePlugin();
28654
28675
  registerDirectionalLight();
28655
28676
  registerOrthoCamera();
28656
28677
 
28657
- export { ACustomAnimate, ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, Animate, AnimateGroup, AnimateGroup1, AnimateMode, AnimateStatus, AnimateStepType, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeAnimate, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, BrowserEnvContribution, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasArc3dPicker, CanvasArcPicker, CanvasAreaPicker, CanvasCirclePicker, CanvasFactory, CanvasGlyphPicker, CanvasGroupPicker, CanvasImagePicker, CanvasLinePicker, CanvasPathPicker, CanvasPickerContribution, CanvasPolygonPicker, CanvasPyramid3dPicker, CanvasRect3dPicker, CanvasRectPicker, CanvasRichTextPicker, CanvasSymbolPicker, CanvasTextLayout, CanvasTextPicker, CbAnimate, Circle, CircleRender, CircleRenderContribution, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Container, ContainerModule, Context2dFactory, ContributionProvider, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasGroupRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageBackgroundRenderContribution, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultMorphingAnimateConfig, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStateAnimateConfig, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTicker, DefaultTimeline, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction$1 as Direction, DirectionalLight, DragNDrop, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, Factory, FadeInPlus, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FlexLayoutPlugin, Fragment, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, Gesture, GlobalPickerService, Glyph, GlyphRender, Graphic, GraphicAnimate, GraphicCreator$1 as GraphicCreator, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupFadeIn, GroupFadeOut, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, HtmlAttributePlugin, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncreaseCount, IncrementalDrawContribution, InputText, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, ManualTickHandler, ManualTicker, Mat4Allocate, MathArcPicker, MathAreaPicker, MathCirclePicker, MathGlyphPicker, MathImagePicker, MathLinePicker, MathPathPicker, MathPickerContribution, MathPolygonPicker, MathRectPicker, MathSymbolPicker, MathTextPicker, MatrixAllocate, MeasureModeEnum, Meteor, MonotoneX, MonotoneY, MorphingPath, MotionPath, MultiToOneMorphingPath, NOWORK_ANIMATE_ATTR, Node, OrthoCamera, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PickItemInterceptor, PickerService, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RAFTickHandler, REACT_TO_CANOPUS_EVENTS, REACT_TO_CANOPUS_EVENTS_LIST, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, ReactAttributePlugin, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, ResourceLoader, RichText, RichTextEditPlugin, RichTextRender, RotateBySphereAnimate, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StaticLayerHandlerContribution, Step$1 as Step, StreamLight, SubAnimate, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, TagPointsUpdate, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TimeOutTickHandler, TransformUtil, UpdateTag, VArc, VArc3d, VArea, VCircle, VGlobal, VGlyph, VGroup, VImage, VLine, VPath, VPolygon, VPyramid3d, VRect, VRect3d, VRichText, VSymbol, VText, VWindow, ViewTransform3dPlugin, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, _interpolateColor, _registerArc, addArcToBezierPath$1 as addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dCanvasPickModule, arc3dModule, arcCanvasPickModule, arcMathPickModule, arcModule, areaCanvasPickModule, areaMathPickModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindContributionProvider, bindContributionProviderNoSingletonScope, boundStroke, browserEnvModule, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache, calculateArcCornerRadius, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleCanvasPickModule, circleMathPickModule, circleModule, clock, cloneGraphic, colorEqual, colorStringInterpolationToStr, container, cornerTangents, createArc, createArc3d, createArea, createCircle, createColor, createConicalGradient, createGlyph, createGroup, createImage, createImageElement$1 as createImageElement, createLine, createMat4, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, decodeReactDom, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, defaultTicker, defaultTimeline, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawIncrementalAreaSegments, drawIncrementalSegments, drawPathProxy, drawSegments, enumCommandMap, feishuEnvModule, fillVisible, findBestMorphingRotation, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getConicGradientAt, getCurrentEnv, getExtraModelMatrix, getModelMatrix, getRichTextBounds, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphCanvasPickModule, glyphMathPickModule, glyphModule, graphicCreator, graphicService, graphicUtil, harmonyEnvModule, identityMat4, imageCanvasPickModule, imageMathPickModule, imageModule, incrementalAddTo, initAllEnv, initBrowserEnv, initFeishuEnv, initHarmonyEnv, initLynxEnv, initNodeEnv, initTTEnv, initTaroEnv, initWxEnv, inject, injectable, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, intersect, isBrowserEnv, isNodeEnv, isSvg, isTransformKey, isXML, jsx, layerService, lineCanvasPickModule, lineMathPickModule, lineModule, loadAllEnv, loadAllModule, loadBrowserEnv, loadFeishuEnv, loadHarmonyEnv, loadLynxEnv, loadNodeEnv, loadTTEnv, loadTaroEnv, loadWxEnv, lookAt, lynxEnvModule, mat3Tomat4, mat4Allocate, matrixAllocate, morphPath, multiInject, multiToOneMorph, multiplyMat4Mat3, multiplyMat4Mat4, named, newThemeObj, nodeEnvModule, oneToMultiMorph, ortho, parsePadding, parseStroke, parseSvgPath, pathCanvasPickModule, pathMathPickModule, pathModule, pathToBezierCurves, point$3 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polygonCanvasPickModule, polygonMathPickModule, polygonModule, preLoadAllModule, pyramid3dCanvasPickModule, pyramid3dModule, rafBasedSto, rect3dCanvasPickModule, rect3dModule, rectCanvasPickModule, rectFillVisible, rectMathPickModule, rectModule, rectStrokeVisible, recursiveCallBinarySplit, registerArc, registerArc3d, registerArc3dGraphic, registerArcGraphic, registerArea, registerAreaGraphic, registerCircle, registerCircleGraphic, registerDirectionalLight, registerFlexLayoutPlugin, registerGlyph, registerGlyphGraphic, registerGroup, registerGroupGraphic, registerHtmlAttributePlugin, registerImage, registerImageGraphic, registerLine, registerLineGraphic, registerOrthoCamera, registerPath, registerPathGraphic, registerPolygon, registerPolygonGraphic, registerPyramid3d, registerPyramid3dGraphic, registerReactAttributePlugin, registerRect, registerRect3d, registerRect3dGraphic, registerRectGraphic, registerRichtext, registerRichtextGraphic, registerShadowRoot, registerShadowRootGraphic, registerSymbol, registerSymbolGraphic, registerText, registerTextGraphic, registerViewTransform3dPlugin, registerWrapText, registerWrapTextGraphic, renderCommandList, rewriteProto, richTextMathPickModule, richtextCanvasPickModule, richtextModule, rotateX, rotateY, rotateZ, roughModule, runFill, runStroke, scaleMat4, segments, shouldUseMat4, snapLength, splitArc, splitArea, splitCircle, splitGraphic, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, strCommandMap, strokeVisible, symbolCanvasPickModule, symbolMathPickModule, symbolModule, taroEnvModule, textAttributesToStyle, textCanvasPickModule, textDrawOffsetX, textDrawOffsetY, textLayoutOffsetY, textMathPickModule, textModule, transformKeys, transformMat4, transformUtil, translate, ttEnvModule, version, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, wxEnvModule, xul };
28678
+ export { ACustomAnimate, ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, Animate, AnimateGroup, AnimateGroup1, AnimateMode, AnimateStatus, AnimateStepType, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeAnimate, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, BrowserEnvContribution, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasArc3dPicker, CanvasArcPicker, CanvasAreaPicker, CanvasCirclePicker, CanvasFactory, CanvasGlyphPicker, CanvasGroupPicker, CanvasImagePicker, CanvasLinePicker, CanvasPathPicker, CanvasPickerContribution, CanvasPolygonPicker, CanvasPyramid3dPicker, CanvasRect3dPicker, CanvasRectPicker, CanvasRichTextPicker, CanvasSymbolPicker, CanvasTextLayout, CanvasTextPicker, CbAnimate, Circle, CircleRender, CircleRenderContribution, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Container, ContainerModule, Context2dFactory, ContributionProvider, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasGroupRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageBackgroundRenderContribution, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultMorphingAnimateConfig, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStateAnimateConfig, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTicker, DefaultTimeline, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction$1 as Direction, DirectionalLight, DragNDrop, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, Factory, FadeInPlus, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FlexLayoutPlugin, Fragment, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, Gesture, GlobalPickerService, Glyph, GlyphRender, Graphic, GraphicAnimate, GraphicCreator$1 as GraphicCreator, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupFadeIn, GroupFadeOut, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, HtmlAttributePlugin, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncreaseCount, IncrementalDrawContribution, InputText, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, ManualTickHandler, ManualTicker, Mat4Allocate, MathArcPicker, MathAreaPicker, MathCirclePicker, MathGlyphPicker, MathImagePicker, MathLinePicker, MathPathPicker, MathPickerContribution, MathPolygonPicker, MathRectPicker, MathSymbolPicker, MathTextPicker, MatrixAllocate, MeasureModeEnum, Meteor, MonotoneX, MonotoneY, MorphingPath, MotionPath, MultiToOneMorphingPath, NOWORK_ANIMATE_ATTR, Node, OrthoCamera, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PickItemInterceptor, PickerService, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RAFTickHandler, REACT_TO_CANOPUS_EVENTS, REACT_TO_CANOPUS_EVENTS_LIST, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, ReactAttributePlugin, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, ResourceLoader, RichText, RichTextEditPlugin, RichTextRender, RotateBySphereAnimate, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StaticLayerHandlerContribution, Step$1 as Step, StreamLight, SubAnimate, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, TagPointsUpdate, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TimeOutTickHandler, TransformUtil, UpdateTag, VArc, VArc3d, VArea, VCircle, VGlobal, VGlyph, VGroup, VImage, VLine, VPath, VPolygon, VPyramid3d, VRect, VRect3d, VRichText, VSymbol, VText, VWindow, ViewTransform3dPlugin, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, _calculateLineHeight, _interpolateColor, _registerArc, addArcToBezierPath$1 as addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dCanvasPickModule, arc3dModule, arcCanvasPickModule, arcMathPickModule, arcModule, areaCanvasPickModule, areaMathPickModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindContributionProvider, bindContributionProviderNoSingletonScope, boundStroke, browserEnvModule, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache, calculateArcCornerRadius, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleCanvasPickModule, circleMathPickModule, circleModule, clock, cloneGraphic, colorEqual, colorStringInterpolationToStr, container, cornerTangents, createArc, createArc3d, createArea, createCircle, createColor, createConicalGradient, createGlyph, createGroup, createImage, createImageElement$1 as createImageElement, createLine, createMat4, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, decodeReactDom, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, defaultTicker, defaultTimeline, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawIncrementalAreaSegments, drawIncrementalSegments, drawPathProxy, drawSegments, enumCommandMap, feishuEnvModule, fillVisible, findBestMorphingRotation, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getConicGradientAt, getCurrentEnv, getExtraModelMatrix, getModelMatrix, getRichTextBounds, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphCanvasPickModule, glyphMathPickModule, glyphModule, graphicCreator, graphicService, graphicUtil, harmonyEnvModule, identityMat4, imageCanvasPickModule, imageMathPickModule, imageModule, incrementalAddTo, initAllEnv, initBrowserEnv, initFeishuEnv, initHarmonyEnv, initLynxEnv, initNodeEnv, initTTEnv, initTaroEnv, initWxEnv, inject, injectable, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, intersect, isBrowserEnv, isNodeEnv, isSvg, isTransformKey, isXML, jsx, layerService, lineCanvasPickModule, lineMathPickModule, lineModule, loadAllEnv, loadAllModule, loadBrowserEnv, loadFeishuEnv, loadHarmonyEnv, loadLynxEnv, loadNodeEnv, loadTTEnv, loadTaroEnv, loadWxEnv, lookAt, lynxEnvModule, mat3Tomat4, mat4Allocate, matrixAllocate, morphPath, multiInject, multiToOneMorph, multiplyMat4Mat3, multiplyMat4Mat4, named, newThemeObj, nodeEnvModule, oneToMultiMorph, ortho, parsePadding, parseStroke, parseSvgPath, pathCanvasPickModule, pathMathPickModule, pathModule, pathToBezierCurves, point$3 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polygonCanvasPickModule, polygonMathPickModule, polygonModule, preLoadAllModule, pyramid3dCanvasPickModule, pyramid3dModule, rafBasedSto, rect3dCanvasPickModule, rect3dModule, rectCanvasPickModule, rectFillVisible, rectMathPickModule, rectModule, rectStrokeVisible, recursiveCallBinarySplit, registerArc, registerArc3d, registerArc3dGraphic, registerArcGraphic, registerArea, registerAreaGraphic, registerCircle, registerCircleGraphic, registerDirectionalLight, registerFlexLayoutPlugin, registerGlyph, registerGlyphGraphic, registerGroup, registerGroupGraphic, registerHtmlAttributePlugin, registerImage, registerImageGraphic, registerLine, registerLineGraphic, registerOrthoCamera, registerPath, registerPathGraphic, registerPolygon, registerPolygonGraphic, registerPyramid3d, registerPyramid3dGraphic, registerReactAttributePlugin, registerRect, registerRect3d, registerRect3dGraphic, registerRectGraphic, registerRichtext, registerRichtextGraphic, registerShadowRoot, registerShadowRootGraphic, registerSymbol, registerSymbolGraphic, registerText, registerTextGraphic, registerViewTransform3dPlugin, registerWrapText, registerWrapTextGraphic, renderCommandList, rewriteProto, richTextMathPickModule, richtextCanvasPickModule, richtextModule, rotateX, rotateY, rotateZ, roughModule, runFill, runStroke, scaleMat4, segments, shouldUseMat4, snapLength, splitArc, splitArea, splitCircle, splitGraphic, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, strCommandMap, strokeVisible, symbolCanvasPickModule, symbolMathPickModule, symbolModule, taroEnvModule, textAttributesToStyle, textCanvasPickModule, textDrawOffsetX, textDrawOffsetY, textLayoutOffsetY, textMathPickModule, textModule, transformKeys, transformMat4, transformUtil, translate, ttEnvModule, version, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, wxEnvModule, xul };
package/dist/index.js CHANGED
@@ -3957,7 +3957,8 @@
3957
3957
  underlineDash: [],
3958
3958
  underlineOffset: 0,
3959
3959
  disableAutoClipedPoptip: void 0,
3960
- measureMode: exports.MeasureModeEnum.fontBounding
3960
+ measureMode: exports.MeasureModeEnum.fontBounding,
3961
+ keepCenterInLine: !1
3961
3962
  };
3962
3963
  const DefaultPickStyle = {
3963
3964
  pickStrokeBuffer: 0
@@ -7345,12 +7346,16 @@
7345
7346
  }
7346
7347
  RafBasedSTO.TimeOut = 1e3 / 60;
7347
7348
  const rafBasedSto = new RafBasedSTO();
7348
- const calculateLineHeight = (lineHeight, fontSize) => {
7349
+ const _calculateLineHeight = (lineHeight, fontSize) => {
7349
7350
  if (isString$1(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
7350
7351
  return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
7351
7352
  }
7352
7353
  return lineHeight;
7353
7354
  };
7355
+ const calculateLineHeight = (lineHeight, fontSize) => {
7356
+ const _lh = _calculateLineHeight(lineHeight, fontSize);
7357
+ return isNaN(_lh) ? _lh : Math.max(fontSize, _lh);
7358
+ };
7354
7359
 
7355
7360
  class IncreaseCount extends ACustomAnimate {
7356
7361
  constructor(from, to, duration, easing, params) {
@@ -14604,11 +14609,7 @@
14604
14609
  this.fontFamily = fontFamily, this.textOptions = options, this.textMeasure = textMeasure;
14605
14610
  }
14606
14611
  LayoutBBox(bbox, textAlign, textBaseline, linesLayout) {
14607
- if ("left" === textAlign || "start" === textAlign) bbox.xOffset = 0;else if ("center" === textAlign) bbox.xOffset = bbox.width / -2;else {
14608
- if ("right" !== textAlign && "end" !== textAlign) throw new Error("非法的textAlign");
14609
- bbox.xOffset = -bbox.width;
14610
- }
14611
- if ("top" === textBaseline) bbox.yOffset = 0;else if ("middle" === textBaseline) bbox.yOffset = bbox.height / -2;else if ("alphabetic" === textBaseline) {
14612
+ 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) {
14612
14613
  let percent = .79;
14613
14614
  if (1 === linesLayout.length) {
14614
14615
  const lineInfo = linesLayout[0];
@@ -14625,7 +14626,8 @@
14625
14626
  const {
14626
14627
  lineWidth: lineWidth,
14627
14628
  suffixPosition = "end",
14628
- measureMode = exports.MeasureModeEnum.actualBounding
14629
+ measureMode = exports.MeasureModeEnum.actualBounding,
14630
+ keepCenterInLine = !1
14629
14631
  } = null != params ? params : {};
14630
14632
  lines = lines.map(l => l.toString());
14631
14633
  const linesLayout = [],
@@ -14638,7 +14640,8 @@
14638
14640
  str: metrics.width <= lineWidth ? lines[i].toString() : this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
14639
14641
  width: width,
14640
14642
  ascent: metrics.ascent,
14641
- descent: metrics.descent
14643
+ descent: metrics.descent,
14644
+ keepCenterInLine: keepCenterInLine
14642
14645
  });
14643
14646
  }
14644
14647
  bboxWH[0] = lineWidth;
@@ -14653,7 +14656,8 @@
14653
14656
  str: text,
14654
14657
  width: width,
14655
14658
  ascent: metrics.ascent,
14656
- descent: metrics.descent
14659
+ descent: metrics.descent,
14660
+ keepCenterInLine: keepCenterInLine
14657
14661
  });
14658
14662
  }
14659
14663
  bboxWH[0] = _lineWidth;
@@ -14684,9 +14688,15 @@
14684
14688
  };
14685
14689
  }
14686
14690
  lineOffset(bbox, line, textAlign, textBaseline, lineHeight, origin) {
14687
- "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];
14688
- const actualHeightWithBuf = line.ascent + line.descent + 0;
14689
- return actualHeightWithBuf < lineHeight - 0 && ("bottom" === textBaseline ? line.topOffset += (lineHeight - actualHeightWithBuf) / 2 : "top" === textBaseline && (line.topOffset -= (lineHeight - actualHeightWithBuf) / 2)), origin[1] += lineHeight, line;
14691
+ 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) {
14692
+ const buf = 0,
14693
+ actualHeightWithBuf = line.ascent + line.descent + buf;
14694
+ if (actualHeightWithBuf < lineHeight - buf && ("bottom" === textBaseline ? line.topOffset += (lineHeight - actualHeightWithBuf) / 2 : "top" === textBaseline && (line.topOffset -= (lineHeight - actualHeightWithBuf) / 2)), "alphabetic" === textBaseline) {
14695
+ const ratio = lineHeight / (line.ascent + line.descent);
14696
+ line.topOffset = lineHeight / 2 + (line.ascent - line.descent) / 2 * ratio + origin[1];
14697
+ }
14698
+ }
14699
+ return origin[1] += lineHeight, line;
14690
14700
  }
14691
14701
  }
14692
14702
 
@@ -14801,7 +14811,7 @@
14801
14811
  updateSingallineAABBBounds(text) {
14802
14812
  this.updateMultilineAABBBounds([text]);
14803
14813
  const layoutData = this.cache.layoutData;
14804
- if (layoutData) {
14814
+ if (layoutData && layoutData.lines && layoutData.lines.length) {
14805
14815
  const line = layoutData.lines[0];
14806
14816
  this.cache.clipedText = line.str, this.cache.clipedWidth = line.width;
14807
14817
  }
@@ -14837,10 +14847,11 @@
14837
14847
  lineWidth = textTheme.lineWidth,
14838
14848
  whiteSpace = textTheme.whiteSpace,
14839
14849
  suffixPosition = textTheme.suffixPosition,
14840
- ignoreBuf = textTheme.ignoreBuf
14850
+ ignoreBuf = textTheme.ignoreBuf,
14851
+ keepCenterInLine = textTheme.keepCenterInLine
14841
14852
  } = attribute,
14842
14853
  buf = ignoreBuf ? 0 : this.guessLineHeightBuf(fontSize),
14843
- lineHeight = this.getLineHeight(attribute, textTheme) + buf;
14854
+ lineHeight = this.getLineHeight(attribute, textTheme, buf);
14844
14855
  if ("normal" === whiteSpace || wrap) return this.updateWrapAABBBounds(text);
14845
14856
  if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14846
14857
  const bbox = this.cache.layoutData.bbox;
@@ -14855,7 +14866,8 @@
14855
14866
  }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, {
14856
14867
  lineWidth: maxLineWidth,
14857
14868
  suffixPosition: suffixPosition,
14858
- measureMode: measureMode
14869
+ measureMode: measureMode,
14870
+ keepCenterInLine: keepCenterInLine
14859
14871
  }),
14860
14872
  {
14861
14873
  bbox: bbox
@@ -14880,10 +14892,11 @@
14880
14892
  measureMode = textTheme.measureMode,
14881
14893
  suffixPosition = textTheme.suffixPosition,
14882
14894
  heightLimit = 0,
14883
- lineClamp: lineClamp
14895
+ lineClamp: lineClamp,
14896
+ keepCenterInLine = textTheme.keepCenterInLine
14884
14897
  } = this.attribute,
14885
14898
  buf = ignoreBuf ? 0 : this.guessLineHeightBuf(fontSize),
14886
- lineHeight = this.getLineHeight(this.attribute, textTheme) + buf;
14899
+ lineHeight = this.getLineHeight(this.attribute, textTheme, buf);
14887
14900
  if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14888
14901
  const bbox = this.cache.layoutData.bbox;
14889
14902
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
@@ -14911,7 +14924,8 @@
14911
14924
  str: clip.str,
14912
14925
  width: clip.width,
14913
14926
  ascent: matrics.ascent,
14914
- descent: matrics.descent
14927
+ descent: matrics.descent,
14928
+ keepCenterInLine: keepCenterInLine
14915
14929
  });
14916
14930
  break;
14917
14931
  }
@@ -14928,7 +14942,8 @@
14928
14942
  str: clip.str,
14929
14943
  width: clip.width,
14930
14944
  ascent: matrics.ascent,
14931
- descent: matrics.descent
14945
+ descent: matrics.descent,
14946
+ keepCenterInLine: keepCenterInLine
14932
14947
  });
14933
14948
  let cutLength = clip.str.length;
14934
14949
  if (!clip.wordBreaked || "" !== str && "" === clip.str || (needCut = !0, cutLength = clip.wordBreaked), clip.str.length === str.length) ;else if (needCut) {
@@ -14952,7 +14967,8 @@
14952
14967
  str: clip.str,
14953
14968
  width: clip.width,
14954
14969
  ascent: matrics.ascent,
14955
- descent: matrics.descent
14970
+ descent: matrics.descent,
14971
+ keepCenterInLine: keepCenterInLine
14956
14972
  }), lineWidth = Math.max(lineWidth, clip.width);
14957
14973
  break;
14958
14974
  }
@@ -14962,7 +14978,8 @@
14962
14978
  str: text,
14963
14979
  width: width,
14964
14980
  ascent: matrics.ascent,
14965
- descent: matrics.descent
14981
+ descent: matrics.descent,
14982
+ keepCenterInLine: keepCenterInLine
14966
14983
  });
14967
14984
  }
14968
14985
  bboxWH[0] = lineWidth;
@@ -14995,7 +15012,7 @@
14995
15012
  verticalMode = textTheme.verticalMode,
14996
15013
  suffixPosition = textTheme.suffixPosition
14997
15014
  } = attribute,
14998
- lineHeight = this.getLineHeight(attribute, textTheme);
15015
+ lineHeight = this.getLineHeight(attribute, textTheme, 0);
14999
15016
  let {
15000
15017
  textAlign = textTheme.textAlign,
15001
15018
  textBaseline = textTheme.textBaseline
@@ -15055,9 +15072,9 @@
15055
15072
  const attribute = this.attribute;
15056
15073
  return null !== (_b = null !== (_a = attribute.maxLineWidth) && void 0 !== _a ? _a : attribute.maxWidth) && void 0 !== _b ? _b : theme.maxWidth;
15057
15074
  }
15058
- getLineHeight(attribute, textTheme) {
15075
+ getLineHeight(attribute, textTheme, buf) {
15059
15076
  var _a;
15060
- return null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
15077
+ return null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
15061
15078
  }
15062
15079
  needUpdateTags(keys) {
15063
15080
  let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TEXT_UPDATE_TAG_KEY;
@@ -15159,7 +15176,8 @@
15159
15176
  str: clip.str,
15160
15177
  width: clip.width,
15161
15178
  ascent: 0,
15162
- descent: 0
15179
+ descent: 0,
15180
+ keepCenterInLine: !1
15163
15181
  });
15164
15182
  break;
15165
15183
  }
@@ -15175,7 +15193,8 @@
15175
15193
  str: clip.str,
15176
15194
  width: clip.width,
15177
15195
  ascent: 0,
15178
- descent: 0
15196
+ descent: 0,
15197
+ keepCenterInLine: !1
15179
15198
  }), clip.str.length === str.length) ;else if (needCut) {
15180
15199
  const newStr = str.substring(clip.str.length);
15181
15200
  lines.splice(i + 1, 0, newStr);
@@ -15196,7 +15215,8 @@
15196
15215
  str: clip.str,
15197
15216
  width: clip.width,
15198
15217
  ascent: 0,
15199
- descent: 0
15218
+ descent: 0,
15219
+ keepCenterInLine: !1
15200
15220
  }), lineWidth = Math.max(lineWidth, clip.width);
15201
15221
  break;
15202
15222
  }
@@ -15204,7 +15224,8 @@
15204
15224
  str: text,
15205
15225
  width: width,
15206
15226
  ascent: 0,
15207
- descent: 0
15227
+ descent: 0,
15228
+ keepCenterInLine: !1
15208
15229
  });
15209
15230
  }
15210
15231
  bboxWH[0] = lineWidth;
@@ -28627,7 +28648,7 @@
28627
28648
 
28628
28649
  const roughModule = _roughModule;
28629
28650
 
28630
- const version = "0.21.0-alpha.10";
28651
+ const version = "0.21.0-alpha.12";
28631
28652
  preLoadAllModule();
28632
28653
  if (isBrowserEnv()) {
28633
28654
  loadBrowserEnv(container);
@@ -28943,6 +28964,7 @@
28943
28964
  exports.WindowHandlerContribution = WindowHandlerContribution;
28944
28965
  exports.WrapText = WrapText;
28945
28966
  exports.XMLParser = XMLParser;
28967
+ exports._calculateLineHeight = _calculateLineHeight;
28946
28968
  exports._interpolateColor = _interpolateColor;
28947
28969
  exports._registerArc = _registerArc;
28948
28970
  exports.addArcToBezierPath = addArcToBezierPath$1;