@visactor/vrender 0.21.0-alpha.5 → 0.21.0-alpha.6

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.5";
2
+ export declare const version = "0.21.0-alpha.6";
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.5", (0, vrender_core_1.preLoadAllModule)(), (0,
24
+ exports.version = "0.21.0-alpha.6", (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,gBAAgB,CAAC;AAExC,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.5\";\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,gBAAgB,CAAC;AAExC,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.6\";\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
@@ -742,6 +742,13 @@ let DefaultGlobal = class {
742
742
  };
743
743
  DefaultGlobal = __decorate$1H([injectable(), __param$T(0, inject(ContributionProvider)), __param$T(0, named(EnvContribution)), __metadata$1h("design:paramtypes", [Object])], DefaultGlobal);
744
744
 
745
+ var MeasureModeEnum;
746
+ !function (MeasureModeEnum) {
747
+ MeasureModeEnum[MeasureModeEnum.estimate = 0] = "estimate", MeasureModeEnum[MeasureModeEnum.actualBounding = 1] = "actualBounding", MeasureModeEnum[MeasureModeEnum.fontBounding = 2] = "fontBounding";
748
+ }(MeasureModeEnum || (MeasureModeEnum = {}));
749
+
750
+ const strCommandMap = ["arc", "arcTo", "bezierCurveTo", "closePath", "ellipse", "lineTo", "moveTo", "quadraticCurveTo", "rect"];
751
+
745
752
  function getDefaultExportFromCjs (x) {
746
753
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
747
754
  }
@@ -3937,7 +3944,8 @@ const DefaultTextStyle = {
3937
3944
  suffixPosition: "end",
3938
3945
  underlineDash: [],
3939
3946
  underlineOffset: 0,
3940
- disableAutoClipedPoptip: void 0
3947
+ disableAutoClipedPoptip: void 0,
3948
+ measureMode: MeasureModeEnum.fontBounding
3941
3949
  };
3942
3950
  const DefaultPickStyle = {
3943
3951
  pickStrokeBuffer: 0
@@ -4340,22 +4348,10 @@ let ATextMeasure = class {
4340
4348
  }
4341
4349
  measureTextBoundADscentEstimate(options) {
4342
4350
  var _a;
4343
- const fontSize = null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize,
4344
- {
4345
- textBaseline: textBaseline
4346
- } = options;
4347
- return "bottom" === textBaseline ? {
4348
- ascent: fontSize,
4349
- descent: 0
4350
- } : "middle" === textBaseline ? {
4351
- ascent: fontSize / 2,
4352
- descent: fontSize / 2
4353
- } : "alphabetic" === textBaseline ? {
4351
+ const fontSize = null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
4352
+ return {
4354
4353
  ascent: .79 * fontSize,
4355
4354
  descent: .21 * fontSize
4356
- } : {
4357
- ascent: 0,
4358
- descent: fontSize
4359
4355
  };
4360
4356
  }
4361
4357
  measureTextBoundLeftRightEstimate(options) {
@@ -4375,11 +4371,42 @@ let ATextMeasure = class {
4375
4371
  right: fontSize
4376
4372
  };
4377
4373
  }
4378
- measureTextPixelADscentAndWidth(text, options) {
4374
+ measureTextPixelADscentAndWidth(text, options, mode) {
4379
4375
  if (!this.context) return Object.assign(Object.assign({}, this.measureTextBoundADscentEstimate(options)), {
4380
4376
  width: this.estimate(text, options).width
4381
4377
  });
4382
4378
  const out = this._measureTextWithoutAlignBaseline(text, options, !0);
4379
+ if (mode === MeasureModeEnum.actualBounding) return {
4380
+ ascent: out.actualBoundingBoxAscent,
4381
+ descent: out.actualBoundingBoxDescent,
4382
+ width: out.width
4383
+ };
4384
+ if (mode === MeasureModeEnum.estimate) return Object.assign(Object.assign({}, this.measureTextBoundADscentEstimate(options)), {
4385
+ width: out.width
4386
+ });
4387
+ if (mode === MeasureModeEnum.fontBounding) {
4388
+ const {
4389
+ lineHeight = options.fontSize
4390
+ } = options;
4391
+ let ratio = 1;
4392
+ if (lineHeight) {
4393
+ ratio = lineHeight / (out.fontBoundingBoxAscent + out.fontBoundingBoxDescent);
4394
+ }
4395
+ let ascent = out.fontBoundingBoxAscent * ratio,
4396
+ descent = out.fontBoundingBoxDescent * ratio;
4397
+ if (out.actualBoundingBoxDescent && descent < out.actualBoundingBoxDescent) {
4398
+ const delta = out.actualBoundingBoxDescent - descent;
4399
+ descent += delta, ascent -= delta;
4400
+ } else if (out.actualBoundingBoxAscent && ascent < out.actualBoundingBoxAscent) {
4401
+ const delta = out.actualBoundingBoxAscent - ascent;
4402
+ ascent += delta, descent -= delta;
4403
+ }
4404
+ return {
4405
+ ascent: ascent,
4406
+ descent: descent,
4407
+ width: out.width
4408
+ };
4409
+ }
4383
4410
  return {
4384
4411
  ascent: out.actualBoundingBoxAscent,
4385
4412
  descent: out.actualBoundingBoxDescent,
@@ -14581,15 +14608,19 @@ class CanvasTextLayout {
14581
14608
  GetLayoutByLines(lines, textAlign, textBaseline, lineHeight) {
14582
14609
  let suffix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
14583
14610
  let wordBreak = arguments.length > 5 ? arguments[5] : undefined;
14584
- let lineWidth = arguments.length > 6 ? arguments[6] : undefined;
14585
- let suffixPosition = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : "end";
14611
+ let params = arguments.length > 6 ? arguments[6] : undefined;
14612
+ const {
14613
+ lineWidth: lineWidth,
14614
+ suffixPosition = "end",
14615
+ measureMode = MeasureModeEnum.actualBounding
14616
+ } = null != params ? params : {};
14586
14617
  lines = lines.map(l => l.toString());
14587
14618
  const linesLayout = [],
14588
14619
  bboxWH = [0, 0];
14589
14620
  if ("number" == typeof lineWidth && lineWidth !== 1 / 0) {
14590
14621
  let width;
14591
14622
  for (let i = 0, len = lines.length; i < len; i++) {
14592
- const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions);
14623
+ const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions, measureMode);
14593
14624
  width = Math.min(metrics.width, lineWidth), linesLayout.push({
14594
14625
  str: metrics.width <= lineWidth ? lines[i].toString() : this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
14595
14626
  width: width,
@@ -14599,19 +14630,20 @@ class CanvasTextLayout {
14599
14630
  }
14600
14631
  bboxWH[0] = lineWidth;
14601
14632
  } else {
14602
- let width, text;
14603
- lineWidth = 0;
14633
+ let width,
14634
+ text,
14635
+ _lineWidth = 0;
14604
14636
  for (let i = 0, len = lines.length; i < len; i++) {
14605
14637
  text = lines[i];
14606
- const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions);
14607
- width = metrics.width, lineWidth = Math.max(lineWidth, width), linesLayout.push({
14638
+ const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions, measureMode);
14639
+ width = metrics.width, _lineWidth = Math.max(_lineWidth, width), linesLayout.push({
14608
14640
  str: text,
14609
14641
  width: width,
14610
14642
  ascent: metrics.ascent,
14611
14643
  descent: metrics.descent
14612
14644
  });
14613
14645
  }
14614
- bboxWH[0] = lineWidth;
14646
+ bboxWH[0] = _lineWidth;
14615
14647
  }
14616
14648
  bboxWH[1] = linesLayout.length * lineHeight, bboxWH[0] = linesLayout.reduce((a, b) => Math.max(a, b.width), 0);
14617
14649
  const bbox = {
@@ -14769,6 +14801,9 @@ class Text extends Graphic {
14769
14801
  b = "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
14770
14802
  return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
14771
14803
  }
14804
+ guessLineHeightBuf(fontSize) {
14805
+ return fontSize ? .1 * fontSize : 0;
14806
+ }
14772
14807
  updateHorizontalMultilineAABBBounds(text) {
14773
14808
  var _a;
14774
14809
  const textTheme = this.getGraphicTheme(),
@@ -14783,12 +14818,14 @@ class Text extends Graphic {
14783
14818
  maxLineWidth: maxLineWidth,
14784
14819
  stroke = textTheme.stroke,
14785
14820
  wrap = textTheme.wrap,
14786
- ignoreBuf = textTheme.ignoreBuf,
14821
+ measureMode = textTheme.measureMode,
14787
14822
  lineWidth = textTheme.lineWidth,
14788
14823
  whiteSpace = textTheme.whiteSpace,
14789
- suffixPosition = textTheme.suffixPosition
14824
+ suffixPosition = textTheme.suffixPosition,
14825
+ ignoreBuf = textTheme.ignoreBuf
14790
14826
  } = attribute,
14791
- lineHeight = this.getLineHeight(attribute, textTheme);
14827
+ buf = ignoreBuf ? 0 : this.guessLineHeightBuf(fontSize),
14828
+ lineHeight = this.getLineHeight(attribute, textTheme) + buf;
14792
14829
  if ("normal" === whiteSpace || wrap) return this.updateWrapAABBBounds(text);
14793
14830
  if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14794
14831
  const bbox = this.cache.layoutData.bbox;
@@ -14798,8 +14835,13 @@ class Text extends Graphic {
14798
14835
  layoutData = new CanvasTextLayout(fontFamily, {
14799
14836
  fontSize: fontSize,
14800
14837
  fontWeight: fontWeight,
14801
- fontFamily: fontFamily
14802
- }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, maxLineWidth, suffixPosition),
14838
+ fontFamily: fontFamily,
14839
+ lineHeight: lineHeight
14840
+ }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, {
14841
+ lineWidth: maxLineWidth,
14842
+ suffixPosition: suffixPosition,
14843
+ measureMode: measureMode
14844
+ }),
14803
14845
  {
14804
14846
  bbox: bbox
14805
14847
  } = layoutData;
@@ -14820,11 +14862,13 @@ class Text extends Graphic {
14820
14862
  wordBreak = textTheme.wordBreak,
14821
14863
  fontWeight = textTheme.fontWeight,
14822
14864
  ignoreBuf = textTheme.ignoreBuf,
14865
+ measureMode = textTheme.measureMode,
14823
14866
  suffixPosition = textTheme.suffixPosition,
14824
14867
  heightLimit = 0,
14825
14868
  lineClamp: lineClamp
14826
14869
  } = this.attribute,
14827
- lineHeight = this.getLineHeight(this.attribute, textTheme);
14870
+ buf = ignoreBuf ? 0 : this.guessLineHeightBuf(fontSize),
14871
+ lineHeight = this.getLineHeight(this.attribute, textTheme) + buf;
14828
14872
  if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14829
14873
  const bbox = this.cache.layoutData.bbox;
14830
14874
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
@@ -14833,7 +14877,8 @@ class Text extends Graphic {
14833
14877
  textOptions = {
14834
14878
  fontSize: fontSize,
14835
14879
  fontWeight: fontWeight,
14836
- fontFamily: fontFamily
14880
+ fontFamily: fontFamily,
14881
+ lineHeight: lineHeight
14837
14882
  },
14838
14883
  layoutObj = new CanvasTextLayout(fontFamily, textOptions, textMeasure),
14839
14884
  lines = isArray$1(text) ? text.map(l => l.toString()) : [text.toString()],
@@ -14846,7 +14891,7 @@ class Text extends Graphic {
14846
14891
  let needCut = !0;
14847
14892
  if (i === lineCountLimit - 1) {
14848
14893
  const clip = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1),
14849
- matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);
14894
+ matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
14850
14895
  linesLayout.push({
14851
14896
  str: clip.str,
14852
14897
  width: clip.width,
@@ -14863,7 +14908,7 @@ class Text extends Graphic {
14863
14908
  } else clip.str = "", clip.width = 0;
14864
14909
  needCut = !1;
14865
14910
  }
14866
- const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);
14911
+ const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
14867
14912
  linesLayout.push({
14868
14913
  str: clip.str,
14869
14914
  width: clip.width,
@@ -14887,7 +14932,7 @@ class Text extends Graphic {
14887
14932
  for (let i = 0, len = lines.length; i < len; i++) {
14888
14933
  if (i === lineCountLimit - 1) {
14889
14934
  const clip = textMeasure.clipTextWithSuffix(lines[i], textOptions, maxLineWidth, ellipsis, !1, suffixPosition),
14890
- matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);
14935
+ matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
14891
14936
  linesLayout.push({
14892
14937
  str: clip.str,
14893
14938
  width: clip.width,
@@ -14897,7 +14942,7 @@ class Text extends Graphic {
14897
14942
  break;
14898
14943
  }
14899
14944
  text = lines[i], width = textMeasure.measureTextWidth(text, textOptions), lineWidth = Math.max(lineWidth, width);
14900
- const matrics = textMeasure.measureTextPixelADscentAndWidth(text, textOptions);
14945
+ const matrics = textMeasure.measureTextPixelADscentAndWidth(text, textOptions, measureMode);
14901
14946
  linesLayout.push({
14902
14947
  str: text,
14903
14948
  width: width,
@@ -18982,8 +19027,6 @@ function createStage(params) {
18982
19027
  return new Stage(params);
18983
19028
  }
18984
19029
 
18985
- const strCommandMap = ["arc", "arcTo", "bezierCurveTo", "closePath", "ellipse", "lineTo", "moveTo", "quadraticCurveTo", "rect"];
18986
-
18987
19030
  var __decorate$1d = undefined && undefined.__decorate || function (decorators, target, key, desc) {
18988
19031
  var d,
18989
19032
  c = arguments.length,
@@ -28569,7 +28612,7 @@ const registerWrapText = _registerWrapText;
28569
28612
 
28570
28613
  const roughModule = _roughModule;
28571
28614
 
28572
- const version = "0.21.0-alpha.5";
28615
+ const version = "0.21.0-alpha.6";
28573
28616
  preLoadAllModule();
28574
28617
  if (isBrowserEnv()) {
28575
28618
  loadBrowserEnv(container);
@@ -28602,4 +28645,4 @@ registerReactAttributePlugin();
28602
28645
  registerDirectionalLight();
28603
28646
  registerOrthoCamera();
28604
28647
 
28605
- 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, 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 };
28648
+ 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 };
package/dist/index.js CHANGED
@@ -748,6 +748,13 @@
748
748
  };
749
749
  exports.DefaultGlobal = __decorate$1H([injectable(), __param$T(0, inject(ContributionProvider)), __param$T(0, named(EnvContribution)), __metadata$1h("design:paramtypes", [Object])], exports.DefaultGlobal);
750
750
 
751
+ exports.MeasureModeEnum = void 0;
752
+ !function (MeasureModeEnum) {
753
+ MeasureModeEnum[MeasureModeEnum.estimate = 0] = "estimate", MeasureModeEnum[MeasureModeEnum.actualBounding = 1] = "actualBounding", MeasureModeEnum[MeasureModeEnum.fontBounding = 2] = "fontBounding";
754
+ }(exports.MeasureModeEnum || (exports.MeasureModeEnum = {}));
755
+
756
+ const strCommandMap = ["arc", "arcTo", "bezierCurveTo", "closePath", "ellipse", "lineTo", "moveTo", "quadraticCurveTo", "rect"];
757
+
751
758
  function getDefaultExportFromCjs (x) {
752
759
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
753
760
  }
@@ -3943,7 +3950,8 @@
3943
3950
  suffixPosition: "end",
3944
3951
  underlineDash: [],
3945
3952
  underlineOffset: 0,
3946
- disableAutoClipedPoptip: void 0
3953
+ disableAutoClipedPoptip: void 0,
3954
+ measureMode: exports.MeasureModeEnum.fontBounding
3947
3955
  };
3948
3956
  const DefaultPickStyle = {
3949
3957
  pickStrokeBuffer: 0
@@ -4346,22 +4354,10 @@
4346
4354
  }
4347
4355
  measureTextBoundADscentEstimate(options) {
4348
4356
  var _a;
4349
- const fontSize = null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize,
4350
- {
4351
- textBaseline: textBaseline
4352
- } = options;
4353
- return "bottom" === textBaseline ? {
4354
- ascent: fontSize,
4355
- descent: 0
4356
- } : "middle" === textBaseline ? {
4357
- ascent: fontSize / 2,
4358
- descent: fontSize / 2
4359
- } : "alphabetic" === textBaseline ? {
4357
+ const fontSize = null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
4358
+ return {
4360
4359
  ascent: .79 * fontSize,
4361
4360
  descent: .21 * fontSize
4362
- } : {
4363
- ascent: 0,
4364
- descent: fontSize
4365
4361
  };
4366
4362
  }
4367
4363
  measureTextBoundLeftRightEstimate(options) {
@@ -4381,11 +4377,42 @@
4381
4377
  right: fontSize
4382
4378
  };
4383
4379
  }
4384
- measureTextPixelADscentAndWidth(text, options) {
4380
+ measureTextPixelADscentAndWidth(text, options, mode) {
4385
4381
  if (!this.context) return Object.assign(Object.assign({}, this.measureTextBoundADscentEstimate(options)), {
4386
4382
  width: this.estimate(text, options).width
4387
4383
  });
4388
4384
  const out = this._measureTextWithoutAlignBaseline(text, options, !0);
4385
+ if (mode === exports.MeasureModeEnum.actualBounding) return {
4386
+ ascent: out.actualBoundingBoxAscent,
4387
+ descent: out.actualBoundingBoxDescent,
4388
+ width: out.width
4389
+ };
4390
+ if (mode === exports.MeasureModeEnum.estimate) return Object.assign(Object.assign({}, this.measureTextBoundADscentEstimate(options)), {
4391
+ width: out.width
4392
+ });
4393
+ if (mode === exports.MeasureModeEnum.fontBounding) {
4394
+ const {
4395
+ lineHeight = options.fontSize
4396
+ } = options;
4397
+ let ratio = 1;
4398
+ if (lineHeight) {
4399
+ ratio = lineHeight / (out.fontBoundingBoxAscent + out.fontBoundingBoxDescent);
4400
+ }
4401
+ let ascent = out.fontBoundingBoxAscent * ratio,
4402
+ descent = out.fontBoundingBoxDescent * ratio;
4403
+ if (out.actualBoundingBoxDescent && descent < out.actualBoundingBoxDescent) {
4404
+ const delta = out.actualBoundingBoxDescent - descent;
4405
+ descent += delta, ascent -= delta;
4406
+ } else if (out.actualBoundingBoxAscent && ascent < out.actualBoundingBoxAscent) {
4407
+ const delta = out.actualBoundingBoxAscent - ascent;
4408
+ ascent += delta, descent -= delta;
4409
+ }
4410
+ return {
4411
+ ascent: ascent,
4412
+ descent: descent,
4413
+ width: out.width
4414
+ };
4415
+ }
4389
4416
  return {
4390
4417
  ascent: out.actualBoundingBoxAscent,
4391
4418
  descent: out.actualBoundingBoxDescent,
@@ -14587,15 +14614,19 @@
14587
14614
  GetLayoutByLines(lines, textAlign, textBaseline, lineHeight) {
14588
14615
  let suffix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
14589
14616
  let wordBreak = arguments.length > 5 ? arguments[5] : undefined;
14590
- let lineWidth = arguments.length > 6 ? arguments[6] : undefined;
14591
- let suffixPosition = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : "end";
14617
+ let params = arguments.length > 6 ? arguments[6] : undefined;
14618
+ const {
14619
+ lineWidth: lineWidth,
14620
+ suffixPosition = "end",
14621
+ measureMode = exports.MeasureModeEnum.actualBounding
14622
+ } = null != params ? params : {};
14592
14623
  lines = lines.map(l => l.toString());
14593
14624
  const linesLayout = [],
14594
14625
  bboxWH = [0, 0];
14595
14626
  if ("number" == typeof lineWidth && lineWidth !== 1 / 0) {
14596
14627
  let width;
14597
14628
  for (let i = 0, len = lines.length; i < len; i++) {
14598
- const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions);
14629
+ const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions, measureMode);
14599
14630
  width = Math.min(metrics.width, lineWidth), linesLayout.push({
14600
14631
  str: metrics.width <= lineWidth ? lines[i].toString() : this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
14601
14632
  width: width,
@@ -14605,19 +14636,20 @@
14605
14636
  }
14606
14637
  bboxWH[0] = lineWidth;
14607
14638
  } else {
14608
- let width, text;
14609
- lineWidth = 0;
14639
+ let width,
14640
+ text,
14641
+ _lineWidth = 0;
14610
14642
  for (let i = 0, len = lines.length; i < len; i++) {
14611
14643
  text = lines[i];
14612
- const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions);
14613
- width = metrics.width, lineWidth = Math.max(lineWidth, width), linesLayout.push({
14644
+ const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions, measureMode);
14645
+ width = metrics.width, _lineWidth = Math.max(_lineWidth, width), linesLayout.push({
14614
14646
  str: text,
14615
14647
  width: width,
14616
14648
  ascent: metrics.ascent,
14617
14649
  descent: metrics.descent
14618
14650
  });
14619
14651
  }
14620
- bboxWH[0] = lineWidth;
14652
+ bboxWH[0] = _lineWidth;
14621
14653
  }
14622
14654
  bboxWH[1] = linesLayout.length * lineHeight, bboxWH[0] = linesLayout.reduce((a, b) => Math.max(a, b.width), 0);
14623
14655
  const bbox = {
@@ -14775,6 +14807,9 @@
14775
14807
  b = "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
14776
14808
  return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
14777
14809
  }
14810
+ guessLineHeightBuf(fontSize) {
14811
+ return fontSize ? .1 * fontSize : 0;
14812
+ }
14778
14813
  updateHorizontalMultilineAABBBounds(text) {
14779
14814
  var _a;
14780
14815
  const textTheme = this.getGraphicTheme(),
@@ -14789,12 +14824,14 @@
14789
14824
  maxLineWidth: maxLineWidth,
14790
14825
  stroke = textTheme.stroke,
14791
14826
  wrap = textTheme.wrap,
14792
- ignoreBuf = textTheme.ignoreBuf,
14827
+ measureMode = textTheme.measureMode,
14793
14828
  lineWidth = textTheme.lineWidth,
14794
14829
  whiteSpace = textTheme.whiteSpace,
14795
- suffixPosition = textTheme.suffixPosition
14830
+ suffixPosition = textTheme.suffixPosition,
14831
+ ignoreBuf = textTheme.ignoreBuf
14796
14832
  } = attribute,
14797
- lineHeight = this.getLineHeight(attribute, textTheme);
14833
+ buf = ignoreBuf ? 0 : this.guessLineHeightBuf(fontSize),
14834
+ lineHeight = this.getLineHeight(attribute, textTheme) + buf;
14798
14835
  if ("normal" === whiteSpace || wrap) return this.updateWrapAABBBounds(text);
14799
14836
  if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14800
14837
  const bbox = this.cache.layoutData.bbox;
@@ -14804,8 +14841,13 @@
14804
14841
  layoutData = new CanvasTextLayout(fontFamily, {
14805
14842
  fontSize: fontSize,
14806
14843
  fontWeight: fontWeight,
14807
- fontFamily: fontFamily
14808
- }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, maxLineWidth, suffixPosition),
14844
+ fontFamily: fontFamily,
14845
+ lineHeight: lineHeight
14846
+ }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, {
14847
+ lineWidth: maxLineWidth,
14848
+ suffixPosition: suffixPosition,
14849
+ measureMode: measureMode
14850
+ }),
14809
14851
  {
14810
14852
  bbox: bbox
14811
14853
  } = layoutData;
@@ -14826,11 +14868,13 @@
14826
14868
  wordBreak = textTheme.wordBreak,
14827
14869
  fontWeight = textTheme.fontWeight,
14828
14870
  ignoreBuf = textTheme.ignoreBuf,
14871
+ measureMode = textTheme.measureMode,
14829
14872
  suffixPosition = textTheme.suffixPosition,
14830
14873
  heightLimit = 0,
14831
14874
  lineClamp: lineClamp
14832
14875
  } = this.attribute,
14833
- lineHeight = this.getLineHeight(this.attribute, textTheme);
14876
+ buf = ignoreBuf ? 0 : this.guessLineHeightBuf(fontSize),
14877
+ lineHeight = this.getLineHeight(this.attribute, textTheme) + buf;
14834
14878
  if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14835
14879
  const bbox = this.cache.layoutData.bbox;
14836
14880
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
@@ -14839,7 +14883,8 @@
14839
14883
  textOptions = {
14840
14884
  fontSize: fontSize,
14841
14885
  fontWeight: fontWeight,
14842
- fontFamily: fontFamily
14886
+ fontFamily: fontFamily,
14887
+ lineHeight: lineHeight
14843
14888
  },
14844
14889
  layoutObj = new CanvasTextLayout(fontFamily, textOptions, textMeasure),
14845
14890
  lines = isArray$1(text) ? text.map(l => l.toString()) : [text.toString()],
@@ -14852,7 +14897,7 @@
14852
14897
  let needCut = !0;
14853
14898
  if (i === lineCountLimit - 1) {
14854
14899
  const clip = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1),
14855
- matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);
14900
+ matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
14856
14901
  linesLayout.push({
14857
14902
  str: clip.str,
14858
14903
  width: clip.width,
@@ -14869,7 +14914,7 @@
14869
14914
  } else clip.str = "", clip.width = 0;
14870
14915
  needCut = !1;
14871
14916
  }
14872
- const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);
14917
+ const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
14873
14918
  linesLayout.push({
14874
14919
  str: clip.str,
14875
14920
  width: clip.width,
@@ -14893,7 +14938,7 @@
14893
14938
  for (let i = 0, len = lines.length; i < len; i++) {
14894
14939
  if (i === lineCountLimit - 1) {
14895
14940
  const clip = textMeasure.clipTextWithSuffix(lines[i], textOptions, maxLineWidth, ellipsis, !1, suffixPosition),
14896
- matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);
14941
+ matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
14897
14942
  linesLayout.push({
14898
14943
  str: clip.str,
14899
14944
  width: clip.width,
@@ -14903,7 +14948,7 @@
14903
14948
  break;
14904
14949
  }
14905
14950
  text = lines[i], width = textMeasure.measureTextWidth(text, textOptions), lineWidth = Math.max(lineWidth, width);
14906
- const matrics = textMeasure.measureTextPixelADscentAndWidth(text, textOptions);
14951
+ const matrics = textMeasure.measureTextPixelADscentAndWidth(text, textOptions, measureMode);
14907
14952
  linesLayout.push({
14908
14953
  str: text,
14909
14954
  width: width,
@@ -18988,8 +19033,6 @@
18988
19033
  return new Stage(params);
18989
19034
  }
18990
19035
 
18991
- const strCommandMap = ["arc", "arcTo", "bezierCurveTo", "closePath", "ellipse", "lineTo", "moveTo", "quadraticCurveTo", "rect"];
18992
-
18993
19036
  var __decorate$1d = undefined && undefined.__decorate || function (decorators, target, key, desc) {
18994
19037
  var d,
18995
19038
  c = arguments.length,
@@ -28575,7 +28618,7 @@
28575
28618
 
28576
28619
  const roughModule = _roughModule;
28577
28620
 
28578
- const version = "0.21.0-alpha.5";
28621
+ const version = "0.21.0-alpha.6";
28579
28622
  preLoadAllModule();
28580
28623
  if (isBrowserEnv()) {
28581
28624
  loadBrowserEnv(container);