@visactor/vrender-core 0.22.0-vstory.11 → 0.22.0-vstory.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.
Files changed (116) hide show
  1. package/cjs/animate/animate.js +1 -1
  2. package/cjs/animate/animate.js.map +1 -1
  3. package/cjs/animate/custom-animate.js +2 -1
  4. package/cjs/animate/custom-animate.js.map +1 -1
  5. package/cjs/common/render-area.d.ts +0 -4
  6. package/cjs/common/render-area.js +16 -76
  7. package/cjs/common/render-area.js.map +1 -1
  8. package/cjs/common/render-curve.d.ts +1 -1
  9. package/cjs/common/render-curve.js.map +1 -1
  10. package/cjs/common/segment/step.js +1 -1
  11. package/cjs/common/segment/step.js.map +1 -1
  12. package/cjs/core/global.d.ts +3 -0
  13. package/cjs/core/global.js +7 -1
  14. package/cjs/core/global.js.map +1 -1
  15. package/cjs/graphic/config.js +1 -0
  16. package/cjs/graphic/config.js.map +1 -1
  17. package/cjs/graphic/graphic.js +4 -4
  18. package/cjs/graphic/graphic.js.map +1 -1
  19. package/cjs/graphic/group.d.ts +0 -1
  20. package/cjs/graphic/group.js +0 -5
  21. package/cjs/graphic/group.js.map +1 -1
  22. package/cjs/graphic/line.js +2 -2
  23. package/cjs/graphic/line.js.map +1 -1
  24. package/cjs/graphic/richtext/line.js +3 -13
  25. package/cjs/graphic/richtext/line.js.map +1 -1
  26. package/cjs/graphic/richtext/paragraph.d.ts +3 -9
  27. package/cjs/graphic/richtext/paragraph.js +33 -20
  28. package/cjs/graphic/richtext/paragraph.js.map +1 -1
  29. package/cjs/graphic/richtext/utils.d.ts +1 -1
  30. package/cjs/graphic/richtext/utils.js +6 -7
  31. package/cjs/graphic/richtext/utils.js.map +1 -1
  32. package/cjs/graphic/richtext.d.ts +1 -2
  33. package/cjs/graphic/richtext.js +3 -9
  34. package/cjs/graphic/richtext.js.map +1 -1
  35. package/cjs/interface/color.js.map +1 -1
  36. package/cjs/interface/global.d.ts +1 -0
  37. package/cjs/interface/global.js.map +1 -1
  38. package/cjs/interface/graphic/richText.d.ts +1 -1
  39. package/cjs/interface/graphic/richText.js.map +1 -1
  40. package/cjs/interface/graphic.d.ts +2 -2
  41. package/cjs/interface/graphic.js.map +1 -1
  42. package/cjs/plugins/builtin-plugin/edit-module.js +8 -4
  43. package/cjs/plugins/builtin-plugin/edit-module.js.map +1 -1
  44. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.d.ts +3 -4
  45. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +74 -86
  46. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
  47. package/cjs/render/contributions/render/area-render.d.ts +1 -1
  48. package/cjs/render/contributions/render/area-render.js +16 -36
  49. package/cjs/render/contributions/render/area-render.js.map +1 -1
  50. package/cjs/render/contributions/render/contributions/image-contribution-render.d.ts +1 -1
  51. package/cjs/render/contributions/render/contributions/image-contribution-render.js +2 -2
  52. package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
  53. package/cjs/render/contributions/render/image-render.js.map +1 -1
  54. package/cjs/render/contributions/render/line-render.js +9 -31
  55. package/cjs/render/contributions/render/line-render.js.map +1 -1
  56. package/cjs/resource-loader/loader.js +1 -1
  57. package/cjs/resource-loader/loader.js.map +1 -1
  58. package/dist/index.es.js +183 -441
  59. package/es/animate/animate.js +4 -3
  60. package/es/animate/animate.js.map +1 -1
  61. package/es/animate/custom-animate.js +2 -1
  62. package/es/animate/custom-animate.js.map +1 -1
  63. package/es/common/render-area.d.ts +0 -4
  64. package/es/common/render-area.js +16 -76
  65. package/es/common/render-area.js.map +1 -1
  66. package/es/common/render-curve.d.ts +1 -1
  67. package/es/common/render-curve.js.map +1 -1
  68. package/es/common/segment/step.js +1 -1
  69. package/es/common/segment/step.js.map +1 -1
  70. package/es/core/global.d.ts +3 -0
  71. package/es/core/global.js +8 -1
  72. package/es/core/global.js.map +1 -1
  73. package/es/graphic/config.js +1 -0
  74. package/es/graphic/config.js.map +1 -1
  75. package/es/graphic/graphic.js +5 -5
  76. package/es/graphic/graphic.js.map +1 -1
  77. package/es/graphic/group.d.ts +0 -1
  78. package/es/graphic/group.js +0 -5
  79. package/es/graphic/group.js.map +1 -1
  80. package/es/graphic/line.js +2 -2
  81. package/es/graphic/line.js.map +1 -1
  82. package/es/graphic/richtext/line.js +3 -13
  83. package/es/graphic/richtext/line.js.map +1 -1
  84. package/es/graphic/richtext/paragraph.d.ts +3 -9
  85. package/es/graphic/richtext/paragraph.js +33 -20
  86. package/es/graphic/richtext/paragraph.js.map +1 -1
  87. package/es/graphic/richtext/utils.d.ts +1 -1
  88. package/es/graphic/richtext/utils.js +6 -7
  89. package/es/graphic/richtext/utils.js.map +1 -1
  90. package/es/graphic/richtext.d.ts +1 -2
  91. package/es/graphic/richtext.js +3 -9
  92. package/es/graphic/richtext.js.map +1 -1
  93. package/es/interface/color.js.map +1 -1
  94. package/es/interface/global.d.ts +1 -0
  95. package/es/interface/global.js.map +1 -1
  96. package/es/interface/graphic/richText.d.ts +1 -1
  97. package/es/interface/graphic/richText.js.map +1 -1
  98. package/es/interface/graphic.d.ts +2 -2
  99. package/es/interface/graphic.js.map +1 -1
  100. package/es/plugins/builtin-plugin/edit-module.js +8 -4
  101. package/es/plugins/builtin-plugin/edit-module.js.map +1 -1
  102. package/es/plugins/builtin-plugin/richtext-edit-plugin.d.ts +3 -4
  103. package/es/plugins/builtin-plugin/richtext-edit-plugin.js +74 -86
  104. package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
  105. package/es/render/contributions/render/area-render.d.ts +1 -1
  106. package/es/render/contributions/render/area-render.js +16 -36
  107. package/es/render/contributions/render/area-render.js.map +1 -1
  108. package/es/render/contributions/render/contributions/image-contribution-render.d.ts +1 -1
  109. package/es/render/contributions/render/contributions/image-contribution-render.js +2 -2
  110. package/es/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
  111. package/es/render/contributions/render/image-render.js.map +1 -1
  112. package/es/render/contributions/render/line-render.js +9 -31
  113. package/es/render/contributions/render/line-render.js.map +1 -1
  114. package/es/resource-loader/loader.js +1 -1
  115. package/es/resource-loader/loader.js.map +1 -1
  116. package/package.json +1 -1
package/dist/index.es.js CHANGED
@@ -855,6 +855,12 @@ let DefaultGlobal = class DefaultGlobal {
855
855
  get env() {
856
856
  return this._env;
857
857
  }
858
+ get isImageAnonymous() {
859
+ return this._isImageAnonymous;
860
+ }
861
+ set isImageAnonymous(isImageAnonymous) {
862
+ this._isImageAnonymous = isImageAnonymous;
863
+ }
858
864
  get devicePixelRatio() {
859
865
  if (!this._env) {
860
866
  this.setEnv(defaultEnv);
@@ -923,6 +929,7 @@ let DefaultGlobal = class DefaultGlobal {
923
929
  }
924
930
  constructor(contributions) {
925
931
  this.contributions = contributions;
932
+ this._isImageAnonymous = true;
926
933
  this.id = Generator.GenAutoIncrementId();
927
934
  this.hooks = {
928
935
  onSetEnv: new SyncHook(['lastEnv', 'env', 'global'])
@@ -2355,7 +2362,12 @@ let Step$1 = class Step {
2355
2362
  }
2356
2363
  else {
2357
2364
  const x1 = this._x * (1 - this._t) + x * this._t;
2358
- this.context.lineTo(x1, this._y, this._lastDefined !== false && p.defined !== false, this.lastPoint);
2365
+ if (this._t === 0.5) {
2366
+ this.context.lineTo(x1, this._y, this._lastDefined !== false, this.lastPoint);
2367
+ }
2368
+ else {
2369
+ this.context.lineTo(x1, this._y, this._lastDefined !== false && p.defined !== false, this.lastPoint);
2370
+ }
2359
2371
  this.context.lineTo(x1, y, this._lastDefined !== false && p.defined !== false, p);
2360
2372
  }
2361
2373
  break;
@@ -3307,7 +3319,7 @@ const DefaultRectAttribute = Object.assign(Object.assign({}, DefaultAttribute),
3307
3319
  const DefaultRect3dAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, x1: 0, y1: 0, cornerRadius: 0, length: 0, cornerType: 'round' });
3308
3320
  const DefaultSymbolAttribute = Object.assign(Object.assign({}, DefaultAttribute), { symbolType: 'circle', size: 10, keepDirIn3d: true, clipRange: 1 });
3309
3321
  const DefaultTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), { strokeBoundsBuffer: 0, keepDirIn3d: true });
3310
- const DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), { editable: false, editOptions: null, width: 300, height: 300, ellipsis: true, wordBreak: 'break-word', verticalDirection: 'top', textAlign: 'left', textBaseline: 'top', layoutDirection: 'horizontal', textConfig: [], disableAutoWrapLine: false, maxHeight: undefined, maxWidth: undefined, singleLine: false });
3322
+ const DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), { editable: false, editOptions: null, ascentDescentMode: 'actual', width: 300, height: 300, ellipsis: true, wordBreak: 'break-word', verticalDirection: 'top', textAlign: 'left', textBaseline: 'top', layoutDirection: 'horizontal', textConfig: [], disableAutoWrapLine: false, maxHeight: undefined, maxWidth: undefined, singleLine: false });
3311
3323
  const DefaultImageAttribute = Object.assign(Object.assign({ repeatX: 'no-repeat', repeatY: 'no-repeat', image: '', width: 0, height: 0 }, DefaultAttribute), { fill: true, cornerRadius: 0, cornerType: 'round' });
3312
3324
  const DefaultRichTextIconAttribute = Object.assign(Object.assign({}, DefaultImageAttribute), { backgroundShowMode: 'never', backgroundWidth: 0, backgroundHeight: 0, textAlign: 'left', textBaseline: 'middle', direction: 'horizontal', margin: 0, id: '', width: 20, height: 20, backgroundFill: 'rgba(101, 117, 168, 0.1)', backgroundFillOpacity: 1, backgroundStroke: false, backgroundStrokeOpacity: 1, backgroundRadius: 4, opacity: 1 });
3313
3325
 
@@ -3922,7 +3934,7 @@ function testLetter2(string, index) {
3922
3934
  }
3923
3935
  return i + 1;
3924
3936
  }
3925
- function measureTextCanvas(text, character) {
3937
+ function measureTextCanvas(text, character, mode = 'actual') {
3926
3938
  const textMeasure = application.graphicUtil.textMeasure;
3927
3939
  const measurement = textMeasure.measureText(text, character);
3928
3940
  const result = {
@@ -3931,16 +3943,18 @@ function measureTextCanvas(text, character) {
3931
3943
  descent: 0,
3932
3944
  width: 0
3933
3945
  };
3934
- if (typeof measurement.fontBoundingBoxAscent !== 'number' || typeof measurement.fontBoundingBoxDescent !== 'number') {
3935
- result.width = measurement.width;
3946
+ const ascent = mode === 'actual' ? measurement.actualBoundingBoxAscent : measurement.fontBoundingBoxAscent;
3947
+ const descent = mode === 'actual' ? measurement.actualBoundingBoxDescent : measurement.fontBoundingBoxDescent;
3948
+ if (typeof ascent !== 'number' || typeof descent !== 'number') {
3949
+ result.width = Math.floor(measurement.width);
3936
3950
  result.height = character.fontSize || 0;
3937
3951
  result.ascent = result.height;
3938
3952
  result.descent = 0;
3939
3953
  }
3940
3954
  else {
3941
- result.width = measurement.width;
3942
- result.height = Math.floor(measurement.fontBoundingBoxAscent + measurement.fontBoundingBoxDescent);
3943
- result.ascent = Math.floor(measurement.fontBoundingBoxAscent);
3955
+ result.width = Math.floor(measurement.width);
3956
+ result.height = Math.floor(ascent + descent);
3957
+ result.ascent = Math.floor(ascent);
3944
3958
  result.descent = result.height - result.ascent;
3945
3959
  }
3946
3960
  return result;
@@ -8287,7 +8301,7 @@ class CbAnimate extends ACustomAnimate {
8287
8301
  class Animate {
8288
8302
  constructor(id = Generator.GenAutoIncrementId(), timeline = defaultTimeline, slience) {
8289
8303
  this.id = id;
8290
- this.timeline = timeline;
8304
+ this.timeline = timeline || defaultTimeline;
8291
8305
  this.status = AnimateStatus.INITIAL;
8292
8306
  this.tailAnimate = new SubAnimate(this);
8293
8307
  this.subAnimates = [this.tailAnimate];
@@ -9173,11 +9187,12 @@ class IncreaseCount extends ACustomAnimate {
9173
9187
  return;
9174
9188
  }
9175
9189
  onUpdate(end, ratio, out) {
9190
+ var _a;
9176
9191
  if (this.valid === false) {
9177
9192
  return;
9178
9193
  }
9179
9194
  if (end) {
9180
- out.text = this.toNumber;
9195
+ out.text = (_a = this.to) === null || _a === void 0 ? void 0 : _a.text;
9181
9196
  }
9182
9197
  else {
9183
9198
  out.text = (this.fromNumber + (this.toNumber - this.fromNumber) * ratio).toFixed(this.decimalLength);
@@ -11729,10 +11744,10 @@ class ResourceLoader {
11729
11744
  static GetFile(url, type) {
11730
11745
  let data = ResourceLoader.cache.get(url);
11731
11746
  if (data) {
11732
- if (data.loadState === 'init' || data.loadState === 'fail') {
11747
+ if (data.loadState === 'fail') {
11733
11748
  return Promise.reject();
11734
11749
  }
11735
- else if (data.loadState === 'loading') {
11750
+ else if (data.loadState === 'init' || data.loadState === 'loading') {
11736
11751
  return data.dataPromise.then(data => data.data);
11737
11752
  }
11738
11753
  return Promise.resolve(data.data);
@@ -12385,7 +12400,6 @@ class Graphic extends Node {
12385
12400
  }
12386
12401
  this.animates.set(animate.id, animate);
12387
12402
  animate.onRemove(() => {
12388
- animate.stop();
12389
12403
  this.animates.delete(animate.id);
12390
12404
  });
12391
12405
  return animate;
@@ -12686,9 +12700,7 @@ class Graphic extends Node {
12686
12700
  if (this.animates && this.animates.size) {
12687
12701
  const timeline = stage.getTimeline();
12688
12702
  this.animates.forEach(a => {
12689
- if (a.timeline === defaultTimeline) {
12690
- a.setTimeline(timeline);
12691
- }
12703
+ a.setTimeline(timeline);
12692
12704
  });
12693
12705
  }
12694
12706
  this._onSetStage && this._onSetStage(this, stage, layer);
@@ -12862,7 +12874,6 @@ class Graphic extends Node {
12862
12874
  detachShadow() {
12863
12875
  if (this.shadowRoot) {
12864
12876
  this.addUpdateBoundTag();
12865
- this.shadowRoot.release(true);
12866
12877
  this.shadowRoot = null;
12867
12878
  }
12868
12879
  }
@@ -12970,7 +12981,6 @@ class Graphic extends Node {
12970
12981
  }
12971
12982
  release() {
12972
12983
  this.releaseStatus = 'released';
12973
- this.stopAnimates();
12974
12984
  application.graphicService.onRelease(this);
12975
12985
  }
12976
12986
  _emitCustomEvent(type, context) {
@@ -13785,14 +13795,6 @@ class Group extends Graphic {
13785
13795
  getNoWorkAnimateAttr() {
13786
13796
  return Group.NOWORK_ANIMATE_ATTR;
13787
13797
  }
13788
- release(all) {
13789
- if (all) {
13790
- this.forEachChildren((g) => {
13791
- g.release(all);
13792
- });
13793
- }
13794
- super.release();
13795
- }
13796
13798
  }
13797
13799
  Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
13798
13800
  function createGroup(attributes) {
@@ -17211,7 +17213,7 @@ let Line$1 = class Line extends Graphic {
17211
17213
  const { points = lineTheme.points, connectedType } = attribute;
17212
17214
  const b = aabbBounds;
17213
17215
  points.forEach(p => {
17214
- if (p.defined !== false || connectedType === 'zero' || connectedType === 'connect') {
17216
+ if (p.defined !== false || connectedType === 'connect') {
17215
17217
  b.add(p.x, p.y);
17216
17218
  }
17217
17219
  });
@@ -17222,7 +17224,7 @@ let Line$1 = class Line extends Graphic {
17222
17224
  const b = aabbBounds;
17223
17225
  segments.forEach(s => {
17224
17226
  s.points.forEach(p => {
17225
- if (p.defined !== false || connectedType === 'zero' || connectedType === 'connect') {
17227
+ if (p.defined !== false || connectedType === 'connect') {
17226
17228
  b.add(p.x, p.y);
17227
17229
  }
17228
17230
  });
@@ -17857,17 +17859,22 @@ function getFixedLRTB(left, right, top, bottom) {
17857
17859
  const topInt = Math.round(top);
17858
17860
  const rightInt = Math.round(right);
17859
17861
  const bottomInt = Math.round(bottom);
17862
+ const _left = left > leftInt ? leftInt : leftInt - 0.5;
17863
+ const _top = top > topInt ? topInt : topInt - 0.5;
17864
+ const _right = rightInt > right ? rightInt : rightInt + 0.5;
17865
+ const _bottom = bottomInt > bottom ? bottomInt : bottomInt + 0.5;
17860
17866
  return {
17861
- left: leftInt,
17862
- top: topInt,
17863
- right: rightInt,
17864
- bottom: bottomInt
17867
+ left: _left,
17868
+ top: _top,
17869
+ right: _right,
17870
+ bottom: _bottom
17865
17871
  };
17866
17872
  }
17867
17873
  class Paragraph {
17868
- constructor(text, newLine, character) {
17874
+ constructor(text, newLine, character, ascentDescentMode) {
17869
17875
  this.fontSize = character.fontSize || 16;
17870
17876
  this.textBaseline = character.textBaseline || 'alphabetic';
17877
+ this.ascentDescentMode = ascentDescentMode;
17871
17878
  const lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
17872
17879
  if (typeof lineHeight === 'number') {
17873
17880
  this.lineHeight = lineHeight > this.fontSize ? lineHeight : this.fontSize;
@@ -17876,7 +17883,7 @@ class Paragraph {
17876
17883
  this.lineHeight = Math.floor(1.2 * this.fontSize);
17877
17884
  }
17878
17885
  this.height = this.lineHeight;
17879
- const { ascent, height, descent, width } = measureTextCanvas(text, character);
17886
+ const { ascent, height, descent, width } = measureTextCanvas(text, character, this.ascentDescentMode);
17880
17887
  let halfDetaHeight = 0;
17881
17888
  let deltaAscent = 0;
17882
17889
  let deltaDescent = 0;
@@ -17922,7 +17929,7 @@ class Paragraph {
17922
17929
  this.ellipsisStr = '...';
17923
17930
  }
17924
17931
  updateWidth() {
17925
- const { width } = measureTextCanvas(this.text, this.character);
17932
+ const { width } = measureTextCanvas(this.text, this.character, this.ascentDescentMode);
17926
17933
  this.width = width;
17927
17934
  if (this.direction === 'vertical') {
17928
17935
  this.widthOrigin = this.width;
@@ -17958,17 +17965,41 @@ class Paragraph {
17958
17965
  text = text.slice(0, index);
17959
17966
  text += this.ellipsisStr;
17960
17967
  if (textAlign === 'right' || textAlign === 'end') {
17961
- const { width } = measureTextCanvas(this.text.slice(index), this.character);
17968
+ const { width } = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
17962
17969
  if (direction === 'vertical') ;
17963
17970
  else {
17964
17971
  left -= this.ellipsisWidth - width;
17965
17972
  }
17966
17973
  }
17967
17974
  }
17975
+ switch (this.character.script) {
17976
+ case 'super':
17977
+ baseline -= this.ascent * (1 / 3);
17978
+ break;
17979
+ case 'sub':
17980
+ baseline += this.descent / 2;
17981
+ break;
17982
+ }
17983
+ if (direction === 'vertical') {
17984
+ ctx.save();
17985
+ ctx.rotateAbout(Math.PI / 2, left, baseline);
17986
+ ctx.translate(-this.heightOrigin || -this.lineHeight / 2, -this.descent / 2);
17987
+ ctx.translate(left, baseline);
17988
+ left = 0;
17989
+ baseline = 0;
17990
+ }
17991
+ const fillStyle = ctx.fillStyle;
17992
+ const globalAlpha = ctx.globalAlpha;
17993
+ ctx.fillStyle = this.character.background;
17994
+ if (this.character.backgroundOpacity !== void 0) {
17995
+ ctx.globalAlpha = this.character.backgroundOpacity;
17996
+ }
17968
17997
  const right = left + (this.widthOrigin || this.width);
17969
17998
  const bottom = top + lineHeight;
17970
17999
  const lrtb = getFixedLRTB(left, right, top, bottom);
17971
- return Object.assign(Object.assign({}, lrtb), { fillStyle: this.character.background, globalAlpha: this.character.backgroundOpacity });
18000
+ ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);
18001
+ ctx.fillStyle = fillStyle;
18002
+ ctx.globalAlpha = globalAlpha;
17972
18003
  }
17973
18004
  draw(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
17974
18005
  let baseline = top + ascent;
@@ -17995,7 +18026,7 @@ class Paragraph {
17995
18026
  text = text.slice(0, index);
17996
18027
  text += this.ellipsisStr;
17997
18028
  if (textAlign === 'right' || textAlign === 'end') {
17998
- const { width } = measureTextCanvas(this.text.slice(index), this.character);
18029
+ const { width } = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
17999
18030
  if (direction === 'vertical') ;
18000
18031
  else {
18001
18032
  left -= this.ellipsisWidth - width;
@@ -18032,14 +18063,14 @@ class Paragraph {
18032
18063
  const right = left + (this.widthOrigin || this.width);
18033
18064
  const bottom = top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
18034
18065
  const lrtb = getFixedLRTB(left, right, top, bottom);
18035
- ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);
18066
+ ctx.fillRect(lrtb.left, 1 + baseline, lrtb.right - lrtb.left, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
18036
18067
  }
18037
18068
  if (this.character.lineThrough) {
18038
18069
  const top = 1 + baseline - this.ascent / 2;
18039
18070
  const right = left + (this.widthOrigin || this.width);
18040
18071
  const bottom = top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
18041
18072
  const lrtb = getFixedLRTB(left, right, top, bottom);
18042
- ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);
18073
+ ctx.fillRect(lrtb.left, 1 + baseline - this.ascent / 2, lrtb.right - lrtb.left, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
18043
18074
  }
18044
18075
  }
18045
18076
  else if (this.character.textDecoration === 'underline') {
@@ -18047,14 +18078,14 @@ class Paragraph {
18047
18078
  const right = left + (this.widthOrigin || this.width);
18048
18079
  const bottom = top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
18049
18080
  const lrtb = getFixedLRTB(left, right, top, bottom);
18050
- ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);
18081
+ ctx.fillRect(lrtb.left, 1 + baseline, lrtb.right - lrtb.left, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
18051
18082
  }
18052
18083
  else if (this.character.textDecoration === 'line-through') {
18053
18084
  const top = 1 + baseline - this.ascent / 2;
18054
18085
  const right = left + (this.widthOrigin || this.width);
18055
18086
  const bottom = top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
18056
18087
  const lrtb = getFixedLRTB(left, right, top, bottom);
18057
- ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);
18088
+ ctx.fillRect(lrtb.left, 1 + baseline - this.ascent / 2, lrtb.right - lrtb.left, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1);
18058
18089
  }
18059
18090
  }
18060
18091
  if (direction === 'vertical') {
@@ -18074,7 +18105,7 @@ class Paragraph {
18074
18105
  const index = getStrByWithCanvas(text, width - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
18075
18106
  text = text.slice(0, index);
18076
18107
  text += this.ellipsisStr;
18077
- const { width: measureWidth } = measureTextCanvas(this.text.slice(index), this.character);
18108
+ const { width: measureWidth } = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
18078
18109
  return width + this.ellipsisWidth - measureWidth;
18079
18110
  }
18080
18111
  return width;
@@ -18083,8 +18114,8 @@ class Paragraph {
18083
18114
  function seperateParagraph(paragraph, index) {
18084
18115
  const text1 = paragraph.text.slice(0, index);
18085
18116
  const text2 = paragraph.text.slice(index);
18086
- const p1 = new Paragraph(text1, paragraph.newLine, paragraph.character);
18087
- const p2 = new Paragraph(text2, true, paragraph.character);
18117
+ const p1 = new Paragraph(text1, paragraph.newLine, paragraph.character, paragraph.ascentDescentMode);
18118
+ const p2 = new Paragraph(text2, true, paragraph.character, paragraph.ascentDescentMode);
18088
18119
  return [p1, p2];
18089
18120
  }
18090
18121
 
@@ -18374,7 +18405,7 @@ class Line {
18374
18405
  }
18375
18406
  const ellipsis = drawEllipsis === true ? '...' : drawEllipsis || '';
18376
18407
  paragraph.ellipsisStr = ellipsis;
18377
- const { width } = measureTextCanvas(ellipsis, paragraph.character);
18408
+ const { width } = measureTextCanvas(ellipsis, paragraph.character, paragraph.ascentDescentMode);
18378
18409
  const ellipsisWidth = width || 0;
18379
18410
  if (ellipsisWidth <= this.blankWidth + otherParagraphWidth) {
18380
18411
  lastLine && (paragraph.ellipsis = 'add');
@@ -18393,35 +18424,11 @@ class Line {
18393
18424
  }
18394
18425
  }
18395
18426
  }
18396
- let fillStyle = '';
18397
- let globalAlpha = -1;
18398
- let currBgList = [];
18399
- const bgList = [currBgList];
18400
18427
  this.paragraphs.forEach((paragraph, index) => {
18401
18428
  if (paragraph instanceof RichTextIcon) {
18402
18429
  return;
18403
18430
  }
18404
- const data = paragraph.drawBackground(ctx, y, this.ascent, x, index === 0, this.textAlign, this.height);
18405
- if (!data) {
18406
- return;
18407
- }
18408
- if (!(fillStyle === data.fillStyle && globalAlpha === data.globalAlpha)) {
18409
- currBgList = [];
18410
- bgList.push(currBgList);
18411
- fillStyle = data.fillStyle;
18412
- globalAlpha = data.globalAlpha;
18413
- }
18414
- currBgList.push(data);
18415
- });
18416
- bgList.forEach(bg => {
18417
- if (bg.length === 0) {
18418
- return;
18419
- }
18420
- const data = bg[0];
18421
- const end = bg[bg.length - 1];
18422
- ctx.fillStyle = data.fillStyle;
18423
- ctx.globalAlpha = data.globalAlpha;
18424
- ctx.fillRect(data.left, data.top, end.right - data.left, end.bottom - data.top);
18431
+ paragraph.drawBackground(ctx, y, this.ascent, x, index === 0, this.textAlign, this.height);
18425
18432
  });
18426
18433
  this.paragraphs.forEach((paragraph, index) => {
18427
18434
  if (paragraph instanceof RichTextIcon) {
@@ -18450,7 +18457,7 @@ class Line {
18450
18457
  if (paragraph instanceof RichTextIcon) {
18451
18458
  break;
18452
18459
  }
18453
- const { width } = measureTextCanvas(ellipsis, paragraph.character);
18460
+ const { width } = measureTextCanvas(ellipsis, paragraph.character, paragraph.ascentDescentMode);
18454
18461
  const ellipsisWidth = width || 0;
18455
18462
  if (ellipsisWidth <= this.blankWidth + otherParagraphWidth) {
18456
18463
  paragraph.ellipsis = 'add';
@@ -18770,16 +18777,7 @@ class RichText extends Graphic {
18770
18777
  return tc.every(item => item.isComposing ||
18771
18778
  !(item.text && isString(item.text) && RichText.splitText(item.text).length > 1));
18772
18779
  }
18773
- static splitEmoji(text) {
18774
- return [...new Intl.Segmenter().segment(text)].map(x => x.segment);
18775
- }
18776
18780
  static splitText(text) {
18777
- try {
18778
- const arr = this.splitEmoji(text);
18779
- return arr;
18780
- }
18781
- catch (e) {
18782
- }
18783
18781
  return Array.from(text);
18784
18782
  }
18785
18783
  static TransformTextConfig2SingleCharacter(textConfig) {
@@ -18896,7 +18894,7 @@ class RichText extends Graphic {
18896
18894
  }
18897
18895
  doUpdateFrameCache(tc) {
18898
18896
  var _a;
18899
- const { maxWidth, maxHeight, width, height, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection, singleLine, disableAutoWrapLine, editable } = this.attribute;
18897
+ const { maxWidth, maxHeight, width, height, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection, singleLine, disableAutoWrapLine, editable, ascentDescentMode } = this.attribute;
18900
18898
  let { textConfig: _tc = [] } = this.attribute;
18901
18899
  if (editable && _tc.length > 0 && !RichText.AllSingleCharacter(_tc)) {
18902
18900
  _tc = RichText.TransformTextConfig2SingleCharacter(_tc);
@@ -18931,11 +18929,11 @@ class RichText extends Graphic {
18931
18929
  if (richTextConfig.text && richTextConfig.text.includes('\n')) {
18932
18930
  const textParts = richTextConfig.text.split('\n');
18933
18931
  for (let j = 0; j < textParts.length; j++) {
18934
- paragraphs.push(new Paragraph(textParts[j], j !== 0, richTextConfig));
18932
+ paragraphs.push(new Paragraph(textParts[j], j !== 0, richTextConfig, ascentDescentMode));
18935
18933
  }
18936
18934
  }
18937
18935
  else if (richTextConfig.text) {
18938
- paragraphs.push(new Paragraph(richTextConfig.text, false, richTextConfig));
18936
+ paragraphs.push(new Paragraph(richTextConfig.text, false, richTextConfig, ascentDescentMode));
18939
18937
  }
18940
18938
  }
18941
18939
  }
@@ -20838,8 +20836,8 @@ class DefaultImageRenderContribution extends DefaultRectRenderContribution {
20838
20836
  this.useStyle = true;
20839
20837
  this.order = 0;
20840
20838
  }
20841
- drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
20842
- return super.drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
20839
+ drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
20840
+ return super.drawShape(image, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
20843
20841
  }
20844
20842
  }
20845
20843
  const defaultImageRenderContribution = new DefaultImageRenderContribution();
@@ -21437,7 +21435,7 @@ let DefaultCanvasLineRender = class DefaultCanvasLineRender extends BaseRender {
21437
21435
  this._draw(line, lineAttribute, false, drawContext, params);
21438
21436
  }
21439
21437
  drawSegmentItem(context, cache, fill, stroke, fillOpacity, strokeOpacity, attribute, defaultAttribute, clipRange, clipRangeByDimension, offsetX, offsetY, line, fillCb, strokeCb) {
21440
- var _a, _b, _c, _d, _e;
21438
+ var _a;
21441
21439
  if (!cache) {
21442
21440
  return;
21443
21441
  }
@@ -21476,60 +21474,6 @@ let DefaultCanvasLineRender = class DefaultCanvasLineRender extends BaseRender {
21476
21474
  context.stroke();
21477
21475
  }
21478
21476
  }
21479
- let { connectedType, connectedX, connectedY, connectedStyle } = attribute;
21480
- if (isArray(defaultAttribute)) {
21481
- connectedType = (_b = connectedType !== null && connectedType !== void 0 ? connectedType : defaultAttribute[0].connectedType) !== null && _b !== void 0 ? _b : defaultAttribute[1].connectedType;
21482
- connectedX = (_c = connectedX !== null && connectedX !== void 0 ? connectedX : defaultAttribute[0].connectedX) !== null && _c !== void 0 ? _c : defaultAttribute[1].connectedX;
21483
- connectedY = (_d = connectedY !== null && connectedY !== void 0 ? connectedY : defaultAttribute[0].connectedY) !== null && _d !== void 0 ? _d : defaultAttribute[1].connectedY;
21484
- connectedStyle = (_e = connectedStyle !== null && connectedStyle !== void 0 ? connectedStyle : defaultAttribute[0].connectedStyle) !== null && _e !== void 0 ? _e : defaultAttribute[1].connectedStyle;
21485
- }
21486
- else {
21487
- connectedType = connectedType !== null && connectedType !== void 0 ? connectedType : defaultAttribute.connectedType;
21488
- connectedX = connectedX !== null && connectedX !== void 0 ? connectedX : defaultAttribute.connectedX;
21489
- connectedY = connectedY !== null && connectedY !== void 0 ? connectedY : defaultAttribute.connectedY;
21490
- connectedStyle = connectedStyle !== null && connectedStyle !== void 0 ? connectedStyle : defaultAttribute.connectedStyle;
21491
- }
21492
- if (connectedType !== 'connect' && connectedType !== 'zero') {
21493
- connectedType = 'none';
21494
- }
21495
- if (connectedType !== 'none') {
21496
- context.beginPath();
21497
- drawSegments(context.camera ? context : context.nativeContext, cache, clipRange, clipRangeByDimension, {
21498
- offsetX,
21499
- offsetY,
21500
- offsetZ: z,
21501
- drawConnect: true,
21502
- mode: connectedType,
21503
- zeroX: connectedX,
21504
- zeroY: connectedY
21505
- });
21506
- const da = [];
21507
- if (isArray(defaultAttribute)) {
21508
- defaultAttribute.forEach(i => da.push(i));
21509
- }
21510
- else {
21511
- da.push(defaultAttribute);
21512
- }
21513
- da.push(attribute);
21514
- if (fill !== false) {
21515
- if (fillCb) {
21516
- fillCb(context, attribute, defaultAttribute);
21517
- }
21518
- else if (fillOpacity) {
21519
- context.setCommonStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da);
21520
- context.fill();
21521
- }
21522
- }
21523
- if (stroke !== false) {
21524
- if (strokeCb) {
21525
- strokeCb(context, attribute, defaultAttribute);
21526
- }
21527
- else if (strokeOpacity) {
21528
- context.setStrokeStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da);
21529
- context.stroke();
21530
- }
21531
- }
21532
- }
21533
21477
  return !!ret;
21534
21478
  }
21535
21479
  drawLinearLineHighPerformance(line, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, lineAttribute, drawContext, params, fillCb, strokeCb) {
@@ -21566,7 +21510,7 @@ let DefaultCanvasLineRender = class DefaultCanvasLineRender extends BaseRender {
21566
21510
  }
21567
21511
  drawShape(line, context, x, y, drawContext, params, fillCb, strokeCb) {
21568
21512
  const lineAttribute = getTheme(line, params === null || params === void 0 ? void 0 : params.theme).line;
21569
- const { fill = lineAttribute.fill, stroke = lineAttribute.stroke, fillOpacity = lineAttribute.fillOpacity, strokeOpacity = lineAttribute.strokeOpacity, segments, points, closePath, curveTension = lineAttribute.curveTension } = line.attribute;
21513
+ const { fill = lineAttribute.fill, stroke = lineAttribute.stroke, fillOpacity = lineAttribute.fillOpacity, strokeOpacity = lineAttribute.strokeOpacity, segments, points, closePath, curveTension = lineAttribute.curveTension, connectedType = lineAttribute.connectedType } = line.attribute;
21570
21514
  const data = this.valid(line, lineAttribute, fillCb, strokeCb);
21571
21515
  if (!data) {
21572
21516
  return;
@@ -21579,6 +21523,12 @@ let DefaultCanvasLineRender = class DefaultCanvasLineRender extends BaseRender {
21579
21523
  if (clipRange === 1 && !segments && !points.some(p => p.defined === false) && curveType === 'linear') {
21580
21524
  return this.drawLinearLineHighPerformance(line, context, !!fill, !!stroke, fillOpacity, strokeOpacity, x, y, lineAttribute, drawContext, params, fillCb, strokeCb);
21581
21525
  }
21526
+ function parsePoint(points, connectedType) {
21527
+ if (connectedType === 'none') {
21528
+ return points;
21529
+ }
21530
+ return points.filter(p => p.defined !== false);
21531
+ }
21582
21532
  if (line.shouldUpdateShape()) {
21583
21533
  const { points, segments } = line.attribute;
21584
21534
  const _points = points;
@@ -21610,7 +21560,7 @@ let DefaultCanvasLineRender = class DefaultCanvasLineRender extends BaseRender {
21610
21560
  startPoint.y = lastSeg.endY;
21611
21561
  startPoint.defined = lastSeg.curves[lastSeg.curves.length - 1].defined;
21612
21562
  }
21613
- const data = calcLineCache(seg.points, curveType, {
21563
+ const data = calcLineCache(parsePoint(seg.points, connectedType), curveType, {
21614
21564
  startPoint,
21615
21565
  curveTension
21616
21566
  });
@@ -21636,7 +21586,7 @@ let DefaultCanvasLineRender = class DefaultCanvasLineRender extends BaseRender {
21636
21586
  }
21637
21587
  }
21638
21588
  else if (points && points.length) {
21639
- line.cache = calcLineCache(_points, curveType, { curveTension });
21589
+ line.cache = calcLineCache(parsePoint(_points, connectedType), curveType, { curveTension });
21640
21590
  }
21641
21591
  else {
21642
21592
  line.cache = null;
@@ -21688,10 +21638,6 @@ DefaultCanvasLineRender = __decorate([
21688
21638
 
21689
21639
  function drawAreaSegments(path, segPath, percent, params) {
21690
21640
  var _a;
21691
- const { drawConnect = false, mode = 'none' } = params || {};
21692
- if (drawConnect && mode === 'none') {
21693
- return;
21694
- }
21695
21641
  const { top, bottom } = segPath;
21696
21642
  if (top.curves.length !== bottom.curves.length) {
21697
21643
  return;
@@ -21700,90 +21646,28 @@ function drawAreaSegments(path, segPath, percent, params) {
21700
21646
  const topList = [];
21701
21647
  const bottomList = [];
21702
21648
  let lastDefined = true;
21703
- if (drawConnect) {
21704
- let defined0 = true;
21705
- let lastCurve;
21706
- let lastBottomCurve;
21707
- const n = top.curves.length;
21708
- top.curves.forEach((curve, i) => {
21709
- const bototmCurve = bottom.curves[n - i - 1];
21710
- let currentTopCurve = curve;
21711
- let currentBottomCurve = bototmCurve;
21712
- if (curve.originP1 === curve.originP2) {
21713
- lastCurve = curve;
21714
- lastBottomCurve = bototmCurve;
21715
- return;
21716
- }
21717
- if (lastCurve && lastCurve.originP1 === lastCurve.originP2) {
21718
- currentTopCurve = lastCurve;
21719
- currentBottomCurve = lastBottomCurve;
21720
- }
21721
- if (curve.defined) {
21722
- if (!defined0) {
21723
- topList.push(currentTopCurve);
21724
- bottomList.push(currentBottomCurve);
21725
- drawAreaConnectBlock(path, topList, bottomList, params);
21726
- topList.length = 0;
21727
- bottomList.length = 0;
21728
- defined0 = !defined0;
21729
- }
21649
+ for (let i = 0, n = top.curves.length; i < n; i++) {
21650
+ const topCurve = top.curves[i];
21651
+ if (lastDefined !== topCurve.defined) {
21652
+ if (lastDefined) {
21653
+ drawAreaBlock(path, topList, bottomList, params);
21654
+ topList.length = 0;
21655
+ bottomList.length = 0;
21730
21656
  }
21731
21657
  else {
21732
- const { originP1, originP2 } = curve;
21733
- let validTopCurve;
21734
- let validBottomCurve;
21735
- if (originP1 && originP1.defined !== false) {
21736
- validTopCurve = currentTopCurve;
21737
- validBottomCurve = currentBottomCurve;
21738
- }
21739
- else if (originP1 && originP2.defined !== false) {
21740
- validTopCurve = curve;
21741
- validBottomCurve = bototmCurve;
21742
- }
21743
- if (defined0) {
21744
- defined0 = !defined0;
21745
- topList.push(validTopCurve || curve);
21746
- bottomList.push(validBottomCurve || bototmCurve);
21747
- }
21748
- else {
21749
- if (validTopCurve) {
21750
- defined0 = !defined0;
21751
- topList.push(validTopCurve || curve);
21752
- bottomList.push(validBottomCurve || bototmCurve);
21753
- drawAreaConnectBlock(path, topList, bottomList, params);
21754
- topList.length = 0;
21755
- bottomList.length = 0;
21756
- }
21757
- }
21758
- }
21759
- lastCurve = curve;
21760
- });
21761
- drawAreaConnectBlock(path, topList, bottomList, params);
21762
- }
21763
- else {
21764
- for (let i = 0, n = top.curves.length; i < n; i++) {
21765
- const topCurve = top.curves[i];
21766
- if (lastDefined !== topCurve.defined) {
21767
- if (lastDefined) {
21768
- drawAreaBlock(path, topList, bottomList, params);
21769
- topList.length = 0;
21770
- bottomList.length = 0;
21771
- }
21772
- else {
21773
- topList.push(topCurve);
21774
- bottomList.push(bottom.curves[n - i - 1]);
21775
- }
21776
- lastDefined = !lastDefined;
21658
+ topList.push(topCurve);
21659
+ bottomList.push(bottom.curves[n - i - 1]);
21777
21660
  }
21778
- else {
21779
- if (lastDefined) {
21780
- topList.push(topCurve);
21781
- bottomList.push(bottom.curves[n - i - 1]);
21782
- }
21661
+ lastDefined = !lastDefined;
21662
+ }
21663
+ else {
21664
+ if (lastDefined) {
21665
+ topList.push(topCurve);
21666
+ bottomList.push(bottom.curves[n - i - 1]);
21783
21667
  }
21784
21668
  }
21785
- drawAreaBlock(path, topList, bottomList, params);
21786
21669
  }
21670
+ drawAreaBlock(path, topList, bottomList, params);
21787
21671
  return;
21788
21672
  }
21789
21673
  if (percent <= 0) {
@@ -21807,9 +21691,6 @@ function drawAreaSegments(path, segPath, percent, params) {
21807
21691
  let lastDefined = true;
21808
21692
  const topList = [];
21809
21693
  const bottomList = [];
21810
- let defined0 = true;
21811
- let lastTopCurve;
21812
- let lastBottomCurve;
21813
21694
  for (let i = 0, n = top.curves.length; i < n; i++) {
21814
21695
  const topCurve = top.curves[i];
21815
21696
  const curCurveLength = topCurve.getLength(direction);
@@ -21818,127 +21699,50 @@ function drawAreaSegments(path, segPath, percent, params) {
21818
21699
  break;
21819
21700
  }
21820
21701
  drawedLengthUntilLast += curCurveLength;
21821
- if (drawConnect) {
21822
- const bototmCurve = bottom.curves[n - i - 1];
21823
- let currentTopCurve = topCurve;
21824
- let currentBottomCurve = bototmCurve;
21825
- if (topCurve.originP1 === topCurve.originP2) {
21826
- lastTopCurve = topCurve;
21827
- lastBottomCurve = bototmCurve;
21828
- continue;
21829
- }
21830
- if (lastTopCurve && lastTopCurve.originP1 === lastTopCurve.originP2) {
21831
- currentTopCurve = lastTopCurve;
21832
- currentBottomCurve = lastBottomCurve;
21833
- }
21834
- if (topCurve.defined) {
21835
- if (!defined0) {
21836
- topList.push(currentTopCurve);
21837
- bottomList.push(currentBottomCurve);
21838
- drawAreaConnectBlock(path, topList, bottomList, params);
21839
- topList.length = 0;
21840
- bottomList.length = 0;
21841
- defined0 = !defined0;
21842
- }
21702
+ let tc = null;
21703
+ let bc = null;
21704
+ if (lastDefined !== topCurve.defined) {
21705
+ if (lastDefined) {
21706
+ drawAreaBlock(path, topList, bottomList, params);
21707
+ topList.length = 0;
21708
+ bottomList.length = 0;
21843
21709
  }
21844
21710
  else {
21845
- const { originP1, originP2 } = topCurve;
21846
- let validTopCurve;
21847
- let validBottomCurve;
21848
- if (originP1 && originP1.defined !== false) {
21849
- validTopCurve = currentTopCurve;
21850
- validBottomCurve = currentBottomCurve;
21851
- }
21852
- else if (originP1 && originP2.defined !== false) {
21853
- validTopCurve = topCurve;
21854
- validBottomCurve = bototmCurve;
21855
- }
21856
- if (defined0) {
21857
- defined0 = !defined0;
21858
- topList.push(validTopCurve || topCurve);
21859
- bottomList.push(validBottomCurve || bototmCurve);
21860
- }
21861
- else {
21862
- if (validTopCurve) {
21863
- defined0 = !defined0;
21864
- topList.push(validTopCurve || topCurve);
21865
- bottomList.push(validBottomCurve || bototmCurve);
21866
- drawAreaConnectBlock(path, topList, bottomList, params);
21867
- topList.length = 0;
21868
- bottomList.length = 0;
21869
- }
21870
- }
21711
+ tc = topCurve;
21712
+ bc = bottom.curves[n - i - 1];
21871
21713
  }
21872
- lastTopCurve = topCurve;
21714
+ lastDefined = !lastDefined;
21873
21715
  }
21874
21716
  else {
21875
- let tc = null;
21876
- let bc = null;
21877
- if (lastDefined !== topCurve.defined) {
21878
- if (lastDefined) {
21879
- drawAreaBlock(path, topList, bottomList, params);
21880
- topList.length = 0;
21881
- bottomList.length = 0;
21717
+ if (lastDefined) {
21718
+ tc = topCurve;
21719
+ bc = bottom.curves[n - i - 1];
21720
+ }
21721
+ }
21722
+ if (tc && bc) {
21723
+ if (percent < 1) {
21724
+ if (tc.p2 && tc.p3) {
21725
+ tc = divideCubic(tc, percent)[0];
21882
21726
  }
21883
21727
  else {
21884
- tc = topCurve;
21885
- bc = bottom.curves[n - i - 1];
21728
+ tc = divideLinear(tc, percent)[0];
21886
21729
  }
21887
- lastDefined = !lastDefined;
21888
- }
21889
- else {
21890
- if (lastDefined) {
21891
- tc = topCurve;
21892
- bc = bottom.curves[n - i - 1];
21730
+ if (bc.p2 && bc.p3) {
21731
+ bc = divideCubic(bc, 1 - percent)[1];
21893
21732
  }
21894
- }
21895
- if (tc && bc) {
21896
- if (percent < 1) {
21897
- if (tc.p2 && tc.p3) {
21898
- tc = divideCubic(tc, percent)[0];
21899
- }
21900
- else {
21901
- tc = divideLinear(tc, percent)[0];
21902
- }
21903
- if (bc.p2 && bc.p3) {
21904
- bc = divideCubic(bc, 1 - percent)[1];
21905
- }
21906
- else {
21907
- bc = divideLinear(bc, 1 - percent)[1];
21908
- }
21733
+ else {
21734
+ bc = divideLinear(bc, 1 - percent)[1];
21909
21735
  }
21910
- tc.defined = lastDefined;
21911
- bc.defined = lastDefined;
21912
- topList.push(tc);
21913
- bottomList.push(bc);
21914
21736
  }
21915
- tc = null;
21916
- bc = null;
21737
+ tc.defined = lastDefined;
21738
+ bc.defined = lastDefined;
21739
+ topList.push(tc);
21740
+ bottomList.push(bc);
21917
21741
  }
21742
+ tc = null;
21743
+ bc = null;
21918
21744
  }
21919
- if (drawConnect) {
21920
- drawAreaConnectBlock(path, topList, bottomList, params);
21921
- }
21922
- else {
21923
- drawAreaBlock(path, topList, bottomList, params);
21924
- }
21925
- }
21926
- function drawAreaConnectBlock(path, topList, bottomList, params) {
21927
- if (topList.length < 2) {
21928
- return;
21929
- }
21930
- const { offsetX = 0, offsetY = 0, offsetZ = 0, mode } = params || {};
21931
- let curve = topList[0];
21932
- path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ);
21933
- curve = topList[topList.length - 1];
21934
- let end = curve.p3 || curve.p1;
21935
- path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ);
21936
- curve = bottomList[bottomList.length - 1];
21937
- path.lineTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ);
21938
- curve = bottomList[0];
21939
- end = curve.p3 || curve.p1;
21940
- path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ);
21941
- path.closePath();
21745
+ drawAreaBlock(path, topList, bottomList, params);
21942
21746
  }
21943
21747
  function drawAreaBlock(path, topList, bottomList, params) {
21944
21748
  const { offsetX = 0, offsetY = 0, offsetZ = 0 } = params || {};
@@ -22052,7 +21856,7 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
22052
21856
  drawShape(area, context, x, y, drawContext, params, fillCb, strokeCb) {
22053
21857
  var _a, _b, _c, _d, _e, _f;
22054
21858
  const areaAttribute = getTheme(area, params === null || params === void 0 ? void 0 : params.theme).area;
22055
- const { fill = areaAttribute.fill, stroke = areaAttribute.stroke, fillOpacity = areaAttribute.fillOpacity, z = areaAttribute.z, strokeOpacity = areaAttribute.strokeOpacity, curveTension = areaAttribute.curveTension } = area.attribute;
21859
+ const { fill = areaAttribute.fill, stroke = areaAttribute.stroke, fillOpacity = areaAttribute.fillOpacity, z = areaAttribute.z, strokeOpacity = areaAttribute.strokeOpacity, curveTension = areaAttribute.curveTension, connectedType = areaAttribute.connectedType } = area.attribute;
22056
21860
  const data = this.valid(area, areaAttribute, fillCb, strokeCb);
22057
21861
  if (!data) {
22058
21862
  return;
@@ -22064,6 +21868,12 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
22064
21868
  if (closePath && curveType === 'linear') {
22065
21869
  curveType = 'linearClosed';
22066
21870
  }
21871
+ function parsePoint(points, connectedType) {
21872
+ if (connectedType !== 'connect') {
21873
+ return points;
21874
+ }
21875
+ return points.filter(p => p.defined !== false);
21876
+ }
22067
21877
  if (clipRange === 1 && !segments && !points.some(p => p.defined === false) && curveType === 'linear') {
22068
21878
  return this.drawLinearAreaHighPerformance(area, context, !!fill, doStroke, fillOpacity, strokeOpacity, x, y, areaAttribute, drawContext, params, fillCb, strokeCb);
22069
21879
  }
@@ -22086,7 +21896,7 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
22086
21896
  startPoint.x = lastTopSeg.endX;
22087
21897
  startPoint.y = lastTopSeg.endY;
22088
21898
  }
22089
- const data = calcLineCache(seg.points, curveType, {
21899
+ const data = calcLineCache(parsePoint(seg.points, connectedType), curveType, {
22090
21900
  startPoint,
22091
21901
  curveTension
22092
21902
  });
@@ -22115,7 +21925,7 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
22115
21925
  });
22116
21926
  }
22117
21927
  if (bottomPoints.length > 1) {
22118
- lastBottomSeg = calcLineCache(bottomPoints, curveType === 'stepBefore' ? 'stepAfter' : curveType === 'stepAfter' ? 'stepBefore' : curveType, { curveTension });
21928
+ lastBottomSeg = calcLineCache(parsePoint(bottomPoints, connectedType), curveType === 'stepBefore' ? 'stepAfter' : curveType === 'stepAfter' ? 'stepBefore' : curveType, { curveTension });
22119
21929
  bottomCaches.unshift(lastBottomSeg);
22120
21930
  }
22121
21931
  }
@@ -22125,12 +21935,12 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
22125
21935
  }));
22126
21936
  }
22127
21937
  else if (points && points.length) {
22128
- const topPoints = points;
21938
+ const topPoints = parsePoint(points, connectedType);
22129
21939
  const bottomPoints = [];
22130
- for (let i = points.length - 1; i >= 0; i--) {
21940
+ for (let i = topPoints.length - 1; i >= 0; i--) {
22131
21941
  bottomPoints.push({
22132
- x: (_e = points[i].x1) !== null && _e !== void 0 ? _e : points[i].x,
22133
- y: (_f = points[i].y1) !== null && _f !== void 0 ? _f : points[i].y
21942
+ x: (_e = topPoints[i].x1) !== null && _e !== void 0 ? _e : topPoints[i].x,
21943
+ y: (_f = topPoints[i].y1) !== null && _f !== void 0 ? _f : topPoints[i].y
22134
21944
  });
22135
21945
  }
22136
21946
  const topCache = calcLineCache(topPoints, curveType, { curveTension });
@@ -22185,17 +21995,9 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
22185
21995
  this._draw(area, areaAttribute, false, drawContext, params);
22186
21996
  }
22187
21997
  drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb) {
22188
- let ret = false;
22189
- ret =
22190
- ret ||
22191
- this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, false, fillCb, strokeCb);
22192
- ret =
22193
- ret ||
22194
- this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, true, fillCb, strokeCb);
22195
- return ret;
21998
+ return this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb);
22196
21999
  }
22197
- _drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, connect, fillCb, strokeCb) {
22198
- var _a, _b, _c, _d;
22000
+ _drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb) {
22199
22001
  if (!(cache &&
22200
22002
  cache.top &&
22201
22003
  cache.bottom &&
@@ -22205,35 +22007,6 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
22205
22007
  cache.bottom.curves.length)) {
22206
22008
  return;
22207
22009
  }
22208
- let { connectedType, connectedX, connectedY, connectedStyle } = attribute;
22209
- const da = [];
22210
- if (connect) {
22211
- if (isArray(defaultAttribute)) {
22212
- connectedType = (_a = connectedType !== null && connectedType !== void 0 ? connectedType : defaultAttribute[0].connectedType) !== null && _a !== void 0 ? _a : defaultAttribute[1].connectedType;
22213
- connectedX = (_b = connectedX !== null && connectedX !== void 0 ? connectedX : defaultAttribute[0].connectedX) !== null && _b !== void 0 ? _b : defaultAttribute[1].connectedX;
22214
- connectedY = (_c = connectedY !== null && connectedY !== void 0 ? connectedY : defaultAttribute[0].connectedY) !== null && _c !== void 0 ? _c : defaultAttribute[1].connectedY;
22215
- connectedStyle = (_d = connectedStyle !== null && connectedStyle !== void 0 ? connectedStyle : defaultAttribute[0].connectedStyle) !== null && _d !== void 0 ? _d : defaultAttribute[1].connectedStyle;
22216
- }
22217
- else {
22218
- connectedType = connectedType !== null && connectedType !== void 0 ? connectedType : defaultAttribute.connectedType;
22219
- connectedX = connectedX !== null && connectedX !== void 0 ? connectedX : defaultAttribute.connectedX;
22220
- connectedY = connectedY !== null && connectedY !== void 0 ? connectedY : defaultAttribute.connectedY;
22221
- connectedStyle = connectedStyle !== null && connectedStyle !== void 0 ? connectedStyle : defaultAttribute.connectedStyle;
22222
- }
22223
- if (connectedType !== 'connect' && connectedType !== 'zero') {
22224
- connectedType = 'none';
22225
- }
22226
- if (isArray(defaultAttribute)) {
22227
- defaultAttribute.forEach(i => da.push(i));
22228
- }
22229
- else {
22230
- da.push(defaultAttribute);
22231
- }
22232
- da.push(attribute);
22233
- }
22234
- if (connect && connectedType === 'none') {
22235
- return false;
22236
- }
22237
22010
  context.beginPath();
22238
22011
  const ret = false;
22239
22012
  const { points, segments } = area.attribute;
@@ -22268,11 +22041,7 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
22268
22041
  offsetX,
22269
22042
  offsetY,
22270
22043
  offsetZ,
22271
- direction,
22272
- drawConnect: connect,
22273
- mode: connectedType,
22274
- zeroX: connectedX,
22275
- zeroY: connectedY
22044
+ direction
22276
22045
  });
22277
22046
  this.beforeRenderStep(area, context, offsetX, offsetY, !!fillOpacity, false, fill, false, defaultAttribute, drawContext, fillCb, null, { attribute });
22278
22047
  context.setShadowBlendStyle && context.setShadowBlendStyle(area, attribute, defaultAttribute);
@@ -22283,7 +22052,7 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
22283
22052
  fillCb(context, attribute, defaultAttribute);
22284
22053
  }
22285
22054
  else if (fillOpacity) {
22286
- context.setCommonStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute);
22055
+ context.setCommonStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute);
22287
22056
  context.fill();
22288
22057
  }
22289
22058
  }
@@ -22300,14 +22069,10 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
22300
22069
  drawSegments(context.camera ? context : context.nativeContext, stroke[0] ? cache.top : cache.bottom, clipRange, direction === Direction$1.ROW ? 'x' : 'y', {
22301
22070
  offsetX,
22302
22071
  offsetY,
22303
- offsetZ,
22304
- drawConnect: connect,
22305
- mode: connectedType,
22306
- zeroX: connectedX,
22307
- zeroY: connectedY
22072
+ offsetZ
22308
22073
  });
22309
22074
  }
22310
- context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute);
22075
+ context.setStrokeStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute);
22311
22076
  context.stroke();
22312
22077
  }
22313
22078
  }
@@ -27146,12 +26911,12 @@ class EditModule {
27146
26911
  this.composingConfigIdx = this.cursorIndex < 0 ? 0 : findConfigIndexByCursorIdx(textConfig, this.cursorIndex);
27147
26912
  if (this.cursorIndex < 0) {
27148
26913
  const config = textConfig[0];
27149
- textConfig.unshift(Object.assign(Object.assign(Object.assign({}, getDefaultCharacterConfig(this.currRt.attribute)), config), { text: '' }));
26914
+ textConfig.unshift(Object.assign(Object.assign(Object.assign({ fill: 'black' }, getDefaultCharacterConfig(this.currRt.attribute)), config), { text: '' }));
27150
26915
  }
27151
26916
  else {
27152
26917
  const configIdx = this.composingConfigIdx;
27153
26918
  const lastConfig = textConfig[configIdx] || textConfig[configIdx - 1];
27154
- textConfig.splice(configIdx, 0, Object.assign(Object.assign({}, lastConfig), { text: '' }));
26919
+ textConfig.splice(configIdx, 0, Object.assign(Object.assign({ fill: 'black' }, lastConfig), { text: '' }));
27155
26920
  }
27156
26921
  };
27157
26922
  this.handleCompositionEnd = () => {
@@ -27281,7 +27046,7 @@ class EditModule {
27281
27046
  const text = lastConfig.text;
27282
27047
  const textList = text ? Array.from(text.toString()) : [];
27283
27048
  for (let i = 0; i < textList.length; i++) {
27284
- textConfig.splice(i + configIdx, 0, Object.assign(Object.assign(Object.assign(Object.assign({}, getDefaultCharacterConfig(this.currRt.attribute)), { fill: 'black' }), lastConfig), { isComposing: false, text: textList[i] }));
27049
+ textConfig.splice(i + configIdx, 0, Object.assign(Object.assign({ fill: 'black' }, lastConfig), { isComposing: false, text: textList[i] }));
27285
27050
  }
27286
27051
  this.currRt.setAttributes({ textConfig });
27287
27052
  const nextConfigIdx = configIdx + textList.length;
@@ -27359,7 +27124,7 @@ class Selection {
27359
27124
  getFormat(key) {
27360
27125
  return this.getAllFormat(key)[0];
27361
27126
  }
27362
- getAllFormat(key, includeUndefined) {
27127
+ getAllFormat(key) {
27363
27128
  const valSet = new Set();
27364
27129
  const minCursorIdx = Math.min(this.selectionStartCursorIdx, this.curCursorIdx);
27365
27130
  const maxCursorIdx = Math.max(this.selectionStartCursorIdx, this.curCursorIdx);
@@ -27368,12 +27133,7 @@ class Selection {
27368
27133
  }
27369
27134
  for (let i = Math.ceil(minCursorIdx); i <= Math.floor(maxCursorIdx); i++) {
27370
27135
  const val = this._getFormat(key, i);
27371
- if (includeUndefined) {
27372
- valSet.add(val);
27373
- }
27374
- else {
27375
- val !== undefined && valSet.add(val);
27376
- }
27136
+ val && valSet.add(val);
27377
27137
  }
27378
27138
  return Array.from(valSet.values());
27379
27139
  }
@@ -27473,31 +27233,28 @@ class RichTextEditPlugin {
27473
27233
  throw new Error('不会走到这里 handleFocusOut');
27474
27234
  };
27475
27235
  this.handleMove = (e) => {
27476
- if (this.currRt && !this.currRt.attribute.editable) {
27477
- this.deFocus(true);
27478
- }
27479
- if (!this.isEditableRichtext(e)) {
27480
- this.handleLeave();
27236
+ if (!this.isRichtext(e)) {
27481
27237
  return;
27482
27238
  }
27483
- this.handleEnter();
27239
+ this.currRt = e.target;
27240
+ this.handleEnter(e);
27484
27241
  e.target.once('pointerleave', this.handleLeave);
27485
27242
  this.tryShowSelection(e, false);
27486
27243
  };
27487
- this.handleEnter = () => {
27244
+ this.handleEnter = (e) => {
27488
27245
  this.editing = true;
27489
27246
  this.pluginService.stage.setCursor('text');
27490
27247
  };
27491
- this.handleLeave = () => {
27248
+ this.handleLeave = (e) => {
27492
27249
  this.editing = false;
27493
27250
  this.pluginService.stage.setCursor('default');
27494
27251
  };
27495
27252
  this.handlePointerDown = (e) => {
27496
- if (!this.editing || !this.isEditableRichtext(e)) {
27497
- this.deFocus(true);
27253
+ if (this.editing) {
27254
+ this.onFocus(e);
27498
27255
  }
27499
27256
  else {
27500
- this.onFocus(e);
27257
+ this.deFocus(true);
27501
27258
  }
27502
27259
  this.triggerRender();
27503
27260
  this.pointerDown = true;
@@ -27635,12 +27392,6 @@ class RichTextEditPlugin {
27635
27392
  return;
27636
27393
  }
27637
27394
  const { lines } = cache;
27638
- if (lines.length === 0) {
27639
- return;
27640
- }
27641
- if (!lines[0].paragraphs || lines[0].paragraphs.length === 0) {
27642
- return;
27643
- }
27644
27395
  const totalCursorCount = lines.reduce((total, line) => total + line.paragraphs.length, 0) - 1;
27645
27396
  this.selectionRange(-0.1, totalCursorCount + 0.1);
27646
27397
  e.preventDefault();
@@ -27699,7 +27450,6 @@ class RichTextEditPlugin {
27699
27450
  else if (this.curCursorIdx > totalCursorCount + 0.1) {
27700
27451
  this.curCursorIdx = totalCursorCount + 0.1;
27701
27452
  }
27702
- this.selectionStartCursorIdx = this.curCursorIdx;
27703
27453
  const pos = this.computedCursorPosByCursorIdx(this.curCursorIdx, this.currRt);
27704
27454
  this.setCursorAndTextArea(pos.x, pos.y1, pos.y2, this.currRt);
27705
27455
  this.hideSelection();
@@ -27766,7 +27516,7 @@ class RichTextEditPlugin {
27766
27516
  if (placeholderFontSize) {
27767
27517
  textConfigItem.fontSize = placeholderFontSize;
27768
27518
  }
27769
- this.shadowPlaceHolder = createRichText(Object.assign(Object.assign({}, this.currRt.attribute), { x: 0, y: 0, pickable: false, editable: false, editOptions: null, angle: 0, _debug_bounds: false, textConfig: [textConfigItem] }));
27519
+ this.shadowPlaceHolder = createRichText(Object.assign(Object.assign({}, this.currRt.attribute), { x: 0, y: 0, angle: 0, _debug_bounds: false, textConfig: [textConfigItem] }));
27770
27520
  shadow.add(this.shadowPlaceHolder);
27771
27521
  }
27772
27522
  tryShowInputBounds() {
@@ -27779,12 +27529,11 @@ class RichTextEditPlugin {
27779
27529
  return;
27780
27530
  }
27781
27531
  const { attribute } = this.currRt;
27782
- let b = this.currRt.AABBBounds;
27532
+ const b = this.currRt.AABBBounds;
27783
27533
  let h = b.height();
27784
27534
  if (!attribute.textConfig.length && this.editLine) {
27785
27535
  const { points } = this.editLine.attribute;
27786
27536
  h = points[1].y - points[0].y;
27787
- b = getRichTextBounds(Object.assign({}, this.shadowPlaceHolder.attribute));
27788
27537
  }
27789
27538
  this.shadowBounds = this.shadowBounds || createRect({});
27790
27539
  this.shadowBounds.setAttributes({
@@ -27809,7 +27558,7 @@ class RichTextEditPlugin {
27809
27558
  if (textConfig && textConfig.length) {
27810
27559
  return;
27811
27560
  }
27812
- if (!(editOptions && editOptions.placeholder && editOptions.syncPlaceHolderToTextConfig)) {
27561
+ if (!(editOptions && editOptions.placeholder)) {
27813
27562
  return;
27814
27563
  }
27815
27564
  const { placeholder } = editOptions;
@@ -27900,15 +27649,16 @@ class RichTextEditPlugin {
27900
27649
  }
27901
27650
  }
27902
27651
  deFocus(trulyDeFocus = false) {
27903
- const currRt = this.currRt;
27904
- if (!currRt) {
27652
+ this.updateCbs && this.updateCbs.forEach(cb => cb('beforeDefocus', this, { trulyDeFocus }));
27653
+ const target = this.currRt;
27654
+ if (!target) {
27905
27655
  return;
27906
27656
  }
27907
- this.updateCbs && this.updateCbs.forEach(cb => cb('beforeDefocus', this, { trulyDeFocus }));
27908
27657
  if (trulyDeFocus) {
27909
27658
  this.trySyncPlaceholderToTextConfig();
27910
- currRt.detachShadow();
27659
+ target.detachShadow();
27911
27660
  }
27661
+ const currRt = this.currRt;
27912
27662
  this.currRt = null;
27913
27663
  if (this.editLine) {
27914
27664
  this.editLine.parent && this.editLine.parent.removeChild(this.editLine);
@@ -27940,10 +27690,8 @@ class RichTextEditPlugin {
27940
27690
  cleared = true;
27941
27691
  }
27942
27692
  cleared && currRt.setAttributes({ textConfig });
27943
- currRt.removeEventListener('pointerleave', this.handleLeave);
27944
27693
  }
27945
27694
  addAnimateToLine(line) {
27946
- line.setAttributes({ opacity: 1 });
27947
27695
  line.animates &&
27948
27696
  line.animates.forEach(animate => {
27949
27697
  animate.stop();
@@ -28002,9 +27750,6 @@ class RichTextEditPlugin {
28002
27750
  };
28003
27751
  let line0Info = this.getLineByPoint(cache, startCursorPos);
28004
27752
  let line1Info = this.getLineByPoint(cache, endCursorPos);
28005
- if (!line0Info || !line1Info) {
28006
- return;
28007
- }
28008
27753
  if (startCursorPos.y > endCursorPos.y ||
28009
27754
  (startCursorPos.y === endCursorPos.y && startCursorPos.x > endCursorPos.x)) {
28010
27755
  [startCursorPos, endCursorPos] = [endCursorPos, startCursorPos];
@@ -28138,10 +27883,7 @@ class RichTextEditPlugin {
28138
27883
  return -1;
28139
27884
  }
28140
27885
  isRichtext(e) {
28141
- return !!(e.target && e.target.type === 'richtext');
28142
- }
28143
- isEditableRichtext(e) {
28144
- return this.isRichtext(e) && !!e.target.attribute.editable;
27886
+ return !!(e.target && e.target.type === 'richtext' && e.target.attribute.editable);
28145
27887
  }
28146
27888
  triggerRender() {
28147
27889
  this.pluginService.stage.renderNextFrame();
@@ -28300,7 +28042,7 @@ class RichTextEditPlugin {
28300
28042
  }
28301
28043
  }
28302
28044
  _forceFocusByEvent(e) {
28303
- this.handleEnter();
28045
+ this.handleEnter(e);
28304
28046
  this.handlePointerDown(e);
28305
28047
  this.handlePointerUp(e);
28306
28048
  }