@visactor/vrender-core 0.21.0-alpha.3 → 0.21.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) hide show
  1. package/cjs/animate/Ticker/default-ticker.d.ts +4 -2
  2. package/cjs/animate/Ticker/default-ticker.js +8 -5
  3. package/cjs/animate/Ticker/default-ticker.js.map +1 -1
  4. package/cjs/animate/custom-animate.d.ts +2 -0
  5. package/cjs/animate/custom-animate.js +11 -2
  6. package/cjs/animate/custom-animate.js.map +1 -1
  7. package/cjs/common/3d-interceptor.js +1 -2
  8. package/cjs/common/bounds-context.js +2 -1
  9. package/cjs/common/morphing-utils.js +1 -1
  10. package/cjs/common/path-svg.js +1 -1
  11. package/cjs/common/polygon.js +2 -2
  12. package/cjs/common/rect-utils.js +1 -1
  13. package/cjs/common/render-area.js +1 -1
  14. package/cjs/common/render-command-list.js +1 -2
  15. package/cjs/common/render-curve.js +1 -1
  16. package/cjs/common/render-utils.js +1 -1
  17. package/cjs/common/seg-context.js +1 -1
  18. package/cjs/common/simplify.js +1 -1
  19. package/cjs/common/sort.js +1 -1
  20. package/cjs/common/split-path.js +1 -1
  21. package/cjs/common/store.js +1 -1
  22. package/cjs/common/text.js.map +1 -1
  23. package/cjs/core/application.js +2 -1
  24. package/cjs/core/camera.js +1 -1
  25. package/cjs/core/constants.js +1 -1
  26. package/cjs/core/contributions/textMeasure/AtextMeasure.d.ts +4 -55
  27. package/cjs/core/contributions/textMeasure/AtextMeasure.js +13 -92
  28. package/cjs/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
  29. package/cjs/core/contributions/textMeasure/layout.d.ts +1 -0
  30. package/cjs/core/contributions/textMeasure/layout.js +30 -20
  31. package/cjs/core/contributions/textMeasure/layout.js.map +1 -1
  32. package/cjs/core/core-modules.js +1 -1
  33. package/cjs/core/global-module.js +2 -0
  34. package/cjs/core/global.js +1 -1
  35. package/cjs/core/graphic-utils.js +1 -1
  36. package/cjs/core/index.js +1 -1
  37. package/cjs/core/layer-service.js +1 -1
  38. package/cjs/core/layer.js +1 -1
  39. package/cjs/core/light.js +1 -1
  40. package/cjs/core/stage.d.ts +2 -0
  41. package/cjs/core/stage.js +10 -6
  42. package/cjs/core/stage.js.map +1 -1
  43. package/cjs/core/window.js +1 -1
  44. package/cjs/graphic/builtin-symbol/arrow.js +2 -2
  45. package/cjs/graphic/builtin-symbol/arrow.js.map +1 -1
  46. package/cjs/graphic/builtin-symbol/arrow2-down.js +2 -2
  47. package/cjs/graphic/builtin-symbol/arrow2-down.js.map +1 -1
  48. package/cjs/graphic/builtin-symbol/arrow2-left.js +2 -2
  49. package/cjs/graphic/builtin-symbol/arrow2-left.js.map +1 -1
  50. package/cjs/graphic/builtin-symbol/arrow2-right.js +2 -2
  51. package/cjs/graphic/builtin-symbol/arrow2-right.js.map +1 -1
  52. package/cjs/graphic/builtin-symbol/arrow2-up.js +2 -2
  53. package/cjs/graphic/builtin-symbol/arrow2-up.js.map +1 -1
  54. package/cjs/graphic/builtin-symbol/base.d.ts +1 -0
  55. package/cjs/graphic/builtin-symbol/base.js +3 -0
  56. package/cjs/graphic/builtin-symbol/base.js.map +1 -1
  57. package/cjs/graphic/builtin-symbol/circle.js +3 -3
  58. package/cjs/graphic/builtin-symbol/circle.js.map +1 -1
  59. package/cjs/graphic/builtin-symbol/close.js +3 -3
  60. package/cjs/graphic/builtin-symbol/close.js.map +1 -1
  61. package/cjs/graphic/builtin-symbol/cross.js +2 -2
  62. package/cjs/graphic/builtin-symbol/cross.js.map +1 -1
  63. package/cjs/graphic/builtin-symbol/diamond.js +3 -3
  64. package/cjs/graphic/builtin-symbol/diamond.js.map +1 -1
  65. package/cjs/graphic/builtin-symbol/line-h.js +3 -3
  66. package/cjs/graphic/builtin-symbol/line-h.js.map +1 -1
  67. package/cjs/graphic/builtin-symbol/line-v.js +3 -3
  68. package/cjs/graphic/builtin-symbol/line-v.js.map +1 -1
  69. package/cjs/graphic/builtin-symbol/square.js +2 -2
  70. package/cjs/graphic/builtin-symbol/square.js.map +1 -1
  71. package/cjs/graphic/builtin-symbol/star.js +2 -2
  72. package/cjs/graphic/builtin-symbol/star.js.map +1 -1
  73. package/cjs/graphic/builtin-symbol/stroke.js +2 -2
  74. package/cjs/graphic/builtin-symbol/stroke.js.map +1 -1
  75. package/cjs/graphic/builtin-symbol/thin-triangle.js +2 -2
  76. package/cjs/graphic/builtin-symbol/thin-triangle.js.map +1 -1
  77. package/cjs/graphic/builtin-symbol/triangle-down.js +2 -2
  78. package/cjs/graphic/builtin-symbol/triangle-down.js.map +1 -1
  79. package/cjs/graphic/builtin-symbol/triangle-left.js +2 -2
  80. package/cjs/graphic/builtin-symbol/triangle-left.js.map +1 -1
  81. package/cjs/graphic/builtin-symbol/triangle-right.js +2 -2
  82. package/cjs/graphic/builtin-symbol/triangle-right.js.map +1 -1
  83. package/cjs/graphic/builtin-symbol/triangle-up.js +2 -2
  84. package/cjs/graphic/builtin-symbol/triangle-up.js.map +1 -1
  85. package/cjs/graphic/builtin-symbol/utils.d.ts +1 -0
  86. package/cjs/graphic/builtin-symbol/utils.js +6 -3
  87. package/cjs/graphic/builtin-symbol/utils.js.map +1 -1
  88. package/cjs/graphic/builtin-symbol/wedge.js +2 -2
  89. package/cjs/graphic/builtin-symbol/wedge.js.map +1 -1
  90. package/cjs/graphic/builtin-symbol/wye.js +2 -2
  91. package/cjs/graphic/builtin-symbol/wye.js.map +1 -1
  92. package/cjs/graphic/config.js +2 -2
  93. package/cjs/graphic/config.js.map +1 -1
  94. package/cjs/graphic/richtext/paragraph.js +3 -1
  95. package/cjs/graphic/richtext/paragraph.js.map +1 -1
  96. package/cjs/graphic/text.d.ts +11 -10
  97. package/cjs/graphic/text.js +174 -91
  98. package/cjs/graphic/text.js.map +1 -1
  99. package/cjs/graphic/wrap-text.js +4 -12
  100. package/cjs/graphic/wrap-text.js.map +1 -1
  101. package/cjs/interface/animate.d.ts +3 -1
  102. package/cjs/interface/animate.js.map +1 -1
  103. package/cjs/interface/context.d.ts +1 -0
  104. package/cjs/interface/context.js.map +1 -1
  105. package/cjs/interface/graphic/text.d.ts +3 -3
  106. package/cjs/interface/graphic/text.js.map +1 -1
  107. package/cjs/interface/graphic.d.ts +1 -0
  108. package/cjs/interface/graphic.js.map +1 -1
  109. package/cjs/interface/stage.d.ts +1 -0
  110. package/cjs/interface/stage.js.map +1 -1
  111. package/cjs/interface/text.d.ts +1 -6
  112. package/cjs/interface/text.js.map +1 -1
  113. package/cjs/render/contributions/render/contributions/arc-contribution-render.js +2 -2
  114. package/cjs/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
  115. package/cjs/render/contributions/render/contributions/circle-contribution-render.js +2 -2
  116. package/cjs/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
  117. package/cjs/render/contributions/render/contributions/rect-contribution-render.js +2 -2
  118. package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  119. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js +2 -2
  120. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  121. package/cjs/render/contributions/render/text-render.js +23 -1
  122. package/cjs/render/contributions/render/text-render.js.map +1 -1
  123. package/dist/index.es.js +524 -386
  124. package/es/animate/Ticker/default-ticker.d.ts +4 -2
  125. package/es/animate/Ticker/default-ticker.js +9 -6
  126. package/es/animate/Ticker/default-ticker.js.map +1 -1
  127. package/es/animate/custom-animate.d.ts +2 -0
  128. package/es/animate/custom-animate.js +11 -2
  129. package/es/animate/custom-animate.js.map +1 -1
  130. package/es/common/3d-interceptor.js +1 -2
  131. package/es/common/bounds-context.js +2 -1
  132. package/es/common/morphing-utils.js +1 -1
  133. package/es/common/path-svg.js +1 -1
  134. package/es/common/polygon.js +1 -1
  135. package/es/common/rect-utils.js +1 -1
  136. package/es/common/render-area.js +1 -1
  137. package/es/common/render-command-list.js +1 -2
  138. package/es/common/render-curve.js +1 -1
  139. package/es/common/render-utils.js +1 -1
  140. package/es/common/seg-context.js +1 -1
  141. package/es/common/simplify.js +1 -1
  142. package/es/common/sort.js +1 -1
  143. package/es/common/split-path.js +1 -1
  144. package/es/common/store.js +1 -1
  145. package/es/common/text.js.map +1 -1
  146. package/es/core/application.js +2 -1
  147. package/es/core/camera.js +1 -1
  148. package/es/core/constants.js +1 -1
  149. package/es/core/contributions/textMeasure/AtextMeasure.d.ts +4 -55
  150. package/es/core/contributions/textMeasure/AtextMeasure.js +13 -92
  151. package/es/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
  152. package/es/core/contributions/textMeasure/layout.d.ts +1 -0
  153. package/es/core/contributions/textMeasure/layout.js +30 -20
  154. package/es/core/contributions/textMeasure/layout.js.map +1 -1
  155. package/es/core/core-modules.js +1 -1
  156. package/es/core/global-module.js +2 -0
  157. package/es/core/global.js +1 -1
  158. package/es/core/graphic-utils.js +1 -1
  159. package/es/core/index.js +1 -1
  160. package/es/core/layer-service.js +1 -1
  161. package/es/core/layer.js +1 -1
  162. package/es/core/light.js +1 -1
  163. package/es/core/stage.d.ts +2 -0
  164. package/es/core/stage.js +10 -6
  165. package/es/core/stage.js.map +1 -1
  166. package/es/core/window.js +1 -1
  167. package/es/graphic/builtin-symbol/arrow.js +2 -2
  168. package/es/graphic/builtin-symbol/arrow.js.map +1 -1
  169. package/es/graphic/builtin-symbol/arrow2-down.js +2 -2
  170. package/es/graphic/builtin-symbol/arrow2-down.js.map +1 -1
  171. package/es/graphic/builtin-symbol/arrow2-left.js +2 -2
  172. package/es/graphic/builtin-symbol/arrow2-left.js.map +1 -1
  173. package/es/graphic/builtin-symbol/arrow2-right.js +2 -2
  174. package/es/graphic/builtin-symbol/arrow2-right.js.map +1 -1
  175. package/es/graphic/builtin-symbol/arrow2-up.js +2 -2
  176. package/es/graphic/builtin-symbol/arrow2-up.js.map +1 -1
  177. package/es/graphic/builtin-symbol/base.d.ts +1 -0
  178. package/es/graphic/builtin-symbol/base.js +3 -0
  179. package/es/graphic/builtin-symbol/base.js.map +1 -1
  180. package/es/graphic/builtin-symbol/circle.js +3 -3
  181. package/es/graphic/builtin-symbol/circle.js.map +1 -1
  182. package/es/graphic/builtin-symbol/close.js +3 -3
  183. package/es/graphic/builtin-symbol/close.js.map +1 -1
  184. package/es/graphic/builtin-symbol/cross.js +2 -2
  185. package/es/graphic/builtin-symbol/cross.js.map +1 -1
  186. package/es/graphic/builtin-symbol/diamond.js +3 -3
  187. package/es/graphic/builtin-symbol/diamond.js.map +1 -1
  188. package/es/graphic/builtin-symbol/line-h.js +3 -3
  189. package/es/graphic/builtin-symbol/line-h.js.map +1 -1
  190. package/es/graphic/builtin-symbol/line-v.js +3 -3
  191. package/es/graphic/builtin-symbol/line-v.js.map +1 -1
  192. package/es/graphic/builtin-symbol/square.js +2 -2
  193. package/es/graphic/builtin-symbol/square.js.map +1 -1
  194. package/es/graphic/builtin-symbol/star.js +2 -2
  195. package/es/graphic/builtin-symbol/star.js.map +1 -1
  196. package/es/graphic/builtin-symbol/stroke.js +2 -2
  197. package/es/graphic/builtin-symbol/stroke.js.map +1 -1
  198. package/es/graphic/builtin-symbol/thin-triangle.js +2 -2
  199. package/es/graphic/builtin-symbol/thin-triangle.js.map +1 -1
  200. package/es/graphic/builtin-symbol/triangle-down.js +2 -2
  201. package/es/graphic/builtin-symbol/triangle-down.js.map +1 -1
  202. package/es/graphic/builtin-symbol/triangle-left.js +2 -2
  203. package/es/graphic/builtin-symbol/triangle-left.js.map +1 -1
  204. package/es/graphic/builtin-symbol/triangle-right.js +2 -2
  205. package/es/graphic/builtin-symbol/triangle-right.js.map +1 -1
  206. package/es/graphic/builtin-symbol/triangle-up.js +2 -2
  207. package/es/graphic/builtin-symbol/triangle-up.js.map +1 -1
  208. package/es/graphic/builtin-symbol/utils.d.ts +1 -0
  209. package/es/graphic/builtin-symbol/utils.js +7 -4
  210. package/es/graphic/builtin-symbol/utils.js.map +1 -1
  211. package/es/graphic/builtin-symbol/wedge.js +2 -2
  212. package/es/graphic/builtin-symbol/wedge.js.map +1 -1
  213. package/es/graphic/builtin-symbol/wye.js +2 -2
  214. package/es/graphic/builtin-symbol/wye.js.map +1 -1
  215. package/es/graphic/config.js +2 -2
  216. package/es/graphic/config.js.map +1 -1
  217. package/es/graphic/richtext/paragraph.js +4 -2
  218. package/es/graphic/richtext/paragraph.js.map +1 -1
  219. package/es/graphic/text.d.ts +11 -10
  220. package/es/graphic/text.js +169 -90
  221. package/es/graphic/text.js.map +1 -1
  222. package/es/graphic/wrap-text.js +4 -12
  223. package/es/graphic/wrap-text.js.map +1 -1
  224. package/es/interface/animate.d.ts +3 -1
  225. package/es/interface/animate.js.map +1 -1
  226. package/es/interface/context.d.ts +1 -0
  227. package/es/interface/context.js.map +1 -1
  228. package/es/interface/graphic/text.d.ts +3 -3
  229. package/es/interface/graphic/text.js.map +1 -1
  230. package/es/interface/graphic.d.ts +1 -0
  231. package/es/interface/graphic.js.map +1 -1
  232. package/es/interface/stage.d.ts +1 -0
  233. package/es/interface/stage.js.map +1 -1
  234. package/es/interface/text.d.ts +1 -6
  235. package/es/interface/text.js.map +1 -1
  236. package/es/render/contributions/render/contributions/arc-contribution-render.js +2 -2
  237. package/es/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
  238. package/es/render/contributions/render/contributions/circle-contribution-render.js +2 -2
  239. package/es/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
  240. package/es/render/contributions/render/contributions/rect-contribution-render.js +2 -2
  241. package/es/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  242. package/es/render/contributions/render/contributions/symbol-contribution-render.js +2 -2
  243. package/es/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  244. package/es/render/contributions/render/text-render.js +23 -1
  245. package/es/render/contributions/render/text-render.js.map +1 -1
  246. package/package.json +4 -3
  247. package/cjs/graphic/text2.d.ts +0 -81
  248. package/cjs/graphic/text2.js +0 -288
  249. package/cjs/graphic/text2.js.map +0 -1
  250. package/es/graphic/text2.d.ts +0 -81
  251. package/es/graphic/text2.js +0 -293
  252. package/es/graphic/text2.js.map +0 -1
package/dist/index.es.js CHANGED
@@ -3016,7 +3016,6 @@ const DefaultStrokeStyle = Object.assign({ outerBorder: Object.assign(Object.ass
3016
3016
  const DefaultTextStyle = {
3017
3017
  text: '',
3018
3018
  maxLineWidth: Infinity,
3019
- maxWidth: Infinity,
3020
3019
  textAlign: 'left',
3021
3020
  textBaseline: 'alphabetic',
3022
3021
  fontSize: 16,
@@ -3056,7 +3055,7 @@ const DefaultConnectAttribute = {
3056
3055
  const DefaultDebugAttribute = {
3057
3056
  _debug_bounds: false
3058
3057
  };
3059
- const DefaultAttribute = Object.assign(Object.assign(Object.assign({ strokeSeg: null, renderable: true, pickable: true, shadowGraphic: undefined, childrenPickable: true, fillPickable: true, strokePickable: true, visible: true, zIndex: 0, layout: null, boundsPadding: 0, fillStrokeOrder: 0, renderStyle: 'default', pickMode: 'accurate', customPickShape: null, boundsMode: 'accurate', keepDirIn3d: true, shadowRootIdx: 1, globalZIndex: 1, globalCompositeOperation: '', overflow: 'hidden', shadowPickMode: 'graphic' }, DefaultDebugAttribute), DefaultStyle), DefaultTransform);
3058
+ const DefaultAttribute = Object.assign(Object.assign(Object.assign({ strokeSeg: null, renderable: true, pickable: true, shadowGraphic: undefined, childrenPickable: true, fillPickable: true, strokePickable: true, visible: true, zIndex: 0, layout: null, boundsPadding: 0, fillStrokeOrder: 0, renderStyle: 'default', pickMode: 'accurate', customPickShape: null, boundsMode: 'accurate', keepDirIn3d: true, shadowRootIdx: 1, globalZIndex: 1, globalCompositeOperation: '', overflow: 'hidden', shadowPickMode: 'graphic', keepStrokeScale: false }, DefaultDebugAttribute), DefaultStyle), DefaultTransform);
3060
3059
  function addAttributeToPrototype(obj, c, keys) {
3061
3060
  keys.forEach(key => {
3062
3061
  c.prototype[key] = obj[key];
@@ -3250,33 +3249,13 @@ let ATextMeasure = class ATextMeasure {
3250
3249
  this.context = service.context;
3251
3250
  service.bindTextMeasure(this);
3252
3251
  }
3253
- _measureTextWithoutAlignBaseline(text, options, compatible) {
3252
+ measureTextWidth(text, options) {
3253
+ if (!this.context) {
3254
+ return this.estimate(text, options).width;
3255
+ }
3254
3256
  this.context.setTextStyleWithoutAlignBaseline(options);
3255
- const metrics = this.context.measureText(text);
3256
- return compatible ? this.compatibleMetrics(metrics, options) : metrics;
3257
- }
3258
- _measureTextWithAlignBaseline(text, options, compatible) {
3259
- this.context.setTextStyle(options);
3260
- const metrics = this.context.measureText(text);
3261
- return compatible ? this.compatibleMetrics(metrics, options) : metrics;
3262
- }
3263
- compatibleMetrics(metrics, options) {
3264
- if (metrics.actualBoundingBoxAscent == null ||
3265
- metrics.actualBoundingBoxDescent == null ||
3266
- metrics.fontBoundingBoxAscent == null ||
3267
- metrics.fontBoundingBoxDescent == null) {
3268
- const { ascent, descent } = this.measureTextBoundADscentEstimate(options);
3269
- metrics.actualBoundingBoxAscent = ascent;
3270
- metrics.actualBoundingBoxDescent = descent;
3271
- metrics.fontBoundingBoxAscent = ascent;
3272
- metrics.fontBoundingBoxDescent = descent;
3273
- }
3274
- if (metrics.actualBoundingBoxLeft == null || metrics.actualBoundingBoxRight == null) {
3275
- const { left, right } = this.measureTextBoundLeftRightEstimate(options);
3276
- metrics.actualBoundingBoxLeft = left;
3277
- metrics.actualBoundingBoxRight = right;
3278
- }
3279
- return metrics;
3257
+ const textMeasure = this.context.measureText(text);
3258
+ return textMeasure.width;
3280
3259
  }
3281
3260
  estimate(text, { fontSize = DefaultTextAttribute.fontSize }) {
3282
3261
  let eCharLen = 0;
@@ -3289,125 +3268,24 @@ let ATextMeasure = class ATextMeasure {
3289
3268
  height: fontSize
3290
3269
  };
3291
3270
  }
3292
- measureTextWidth(text, options, textMeasure) {
3293
- if (!this.context) {
3294
- return this.estimate(text, options).width;
3295
- }
3296
- textMeasure = textMeasure !== null && textMeasure !== void 0 ? textMeasure : this._measureTextWithoutAlignBaseline(text, options);
3297
- return textMeasure.width;
3298
- }
3299
- measureTextBoundsWidth(text, options, textMeasure) {
3300
- if (!this.context) {
3301
- return this.estimate(text, options).width;
3302
- }
3303
- textMeasure = textMeasure !== null && textMeasure !== void 0 ? textMeasure : this._measureTextWithoutAlignBaseline(text, options);
3304
- return textMeasure.width;
3305
- }
3306
- measureTextBoundsLeftRight(text, options, textMeasure) {
3307
- if (!this.context) {
3308
- return this.measureTextBoundLeftRightEstimate(options);
3309
- }
3310
- textMeasure = textMeasure !== null && textMeasure !== void 0 ? textMeasure : this._measureTextWithAlignBaseline(text, options, true);
3311
- return {
3312
- left: textMeasure.actualBoundingBoxLeft,
3313
- right: textMeasure.actualBoundingBoxRight
3314
- };
3315
- }
3316
- measureTextPixelHeight(text, options, textMeasure) {
3271
+ measureTextPixelHeight(text, options) {
3317
3272
  var _a;
3318
3273
  if (!this.context) {
3319
3274
  return (_a = options.fontSize) !== null && _a !== void 0 ? _a : DefaultTextStyle.fontSize;
3320
3275
  }
3321
- textMeasure = textMeasure !== null && textMeasure !== void 0 ? textMeasure : this._measureTextWithoutAlignBaseline(text, options, true);
3276
+ this.context.setTextStyleWithoutAlignBaseline(options);
3277
+ const textMeasure = this.context.measureText(text);
3322
3278
  return Math.abs(textMeasure.actualBoundingBoxAscent - textMeasure.actualBoundingBoxDescent);
3323
3279
  }
3324
- measureTextPixelADscent(text, options, textMeasure) {
3325
- if (!this.context) {
3326
- return this.measureTextBoundADscentEstimate(options);
3327
- }
3328
- textMeasure = textMeasure !== null && textMeasure !== void 0 ? textMeasure : this._measureTextWithAlignBaseline(text, options, true);
3329
- return {
3330
- ascent: textMeasure.actualBoundingBoxAscent,
3331
- descent: textMeasure.actualBoundingBoxDescent
3332
- };
3333
- }
3334
- measureTextBoundHieght(text, options, textMeasure) {
3280
+ measureTextBoundHieght(text, options) {
3335
3281
  var _a;
3336
3282
  if (!this.context) {
3337
3283
  return (_a = options.fontSize) !== null && _a !== void 0 ? _a : DefaultTextStyle.fontSize;
3338
3284
  }
3339
- textMeasure = textMeasure !== null && textMeasure !== void 0 ? textMeasure : this._measureTextWithoutAlignBaseline(text, options, true);
3285
+ this.context.setTextStyleWithoutAlignBaseline(options);
3286
+ const textMeasure = this.context.measureText(text);
3340
3287
  return Math.abs(textMeasure.fontBoundingBoxAscent - textMeasure.fontBoundingBoxDescent);
3341
3288
  }
3342
- measureTextBoundADscent(text, options, textMeasure) {
3343
- if (!this.context) {
3344
- return this.measureTextBoundADscentEstimate(options);
3345
- }
3346
- textMeasure = textMeasure !== null && textMeasure !== void 0 ? textMeasure : this._measureTextWithAlignBaseline(text, options, true);
3347
- return {
3348
- ascent: textMeasure.fontBoundingBoxAscent,
3349
- descent: textMeasure.fontBoundingBoxDescent
3350
- };
3351
- }
3352
- measureTextBoundADscentEstimate(options) {
3353
- var _a;
3354
- const fontSize = (_a = options.fontSize) !== null && _a !== void 0 ? _a : DefaultTextStyle.fontSize;
3355
- const { textBaseline } = options;
3356
- if (textBaseline === 'bottom') {
3357
- return {
3358
- ascent: fontSize,
3359
- descent: 0
3360
- };
3361
- }
3362
- else if (textBaseline === 'middle') {
3363
- return {
3364
- ascent: fontSize / 2,
3365
- descent: fontSize / 2
3366
- };
3367
- }
3368
- else if (textBaseline === 'alphabetic') {
3369
- return {
3370
- ascent: 0.79 * fontSize,
3371
- descent: 0.21 * fontSize
3372
- };
3373
- }
3374
- return {
3375
- ascent: 0,
3376
- descent: fontSize
3377
- };
3378
- }
3379
- measureTextBoundLeftRightEstimate(options) {
3380
- var _a;
3381
- const fontSize = (_a = options.fontSize) !== null && _a !== void 0 ? _a : DefaultTextStyle.fontSize;
3382
- const { textAlign } = options;
3383
- if (textAlign === 'center') {
3384
- return {
3385
- left: fontSize / 2,
3386
- right: fontSize / 2
3387
- };
3388
- }
3389
- else if (textAlign === 'right' || textAlign === 'end') {
3390
- return {
3391
- left: fontSize,
3392
- right: 0
3393
- };
3394
- }
3395
- return {
3396
- left: 0,
3397
- right: fontSize
3398
- };
3399
- }
3400
- measureTextPixelADscentAndWidth(text, options) {
3401
- if (!this.context) {
3402
- return Object.assign(Object.assign({}, this.measureTextBoundADscentEstimate(options)), { width: this.estimate(text, options).width });
3403
- }
3404
- const out = this._measureTextWithoutAlignBaseline(text, options, true);
3405
- return {
3406
- ascent: out.actualBoundingBoxAscent,
3407
- descent: out.actualBoundingBoxDescent,
3408
- width: out.width
3409
- };
3410
- }
3411
3289
  measureText(text, options) {
3412
3290
  if (!this.context) {
3413
3291
  return this.estimate(text, options);
@@ -6963,7 +6841,7 @@ class TimeOutTickHandler {
6963
6841
  }
6964
6842
  }
6965
6843
 
6966
- class DefaultTicker {
6844
+ class DefaultTicker extends EventEmitter {
6967
6845
  set mode(m) {
6968
6846
  if (this._mode === m) {
6969
6847
  return;
@@ -6975,18 +6853,19 @@ class DefaultTicker {
6975
6853
  return this._mode;
6976
6854
  }
6977
6855
  constructor(timelines = []) {
6856
+ super();
6978
6857
  this.handleTick = (handler, params) => {
6979
6858
  const { once = false } = params !== null && params !== void 0 ? params : {};
6980
6859
  if (this.ifCanStop()) {
6981
6860
  this.stop();
6982
6861
  return;
6983
6862
  }
6984
- this._handlerTick(handler);
6863
+ this._handlerTick();
6985
6864
  if (!once) {
6986
6865
  handler.tick(this.interval, this.handleTick);
6987
6866
  }
6988
6867
  };
6989
- this._handlerTick = (handler) => {
6868
+ this._handlerTick = () => {
6990
6869
  const tickerHandler = this.tickerHandler;
6991
6870
  const time = tickerHandler.getTime();
6992
6871
  let delta = 0;
@@ -7001,6 +6880,7 @@ class DefaultTicker {
7001
6880
  this.timelines.forEach(t => {
7002
6881
  t.tick(delta);
7003
6882
  });
6883
+ this.emit('afterTick');
7004
6884
  };
7005
6885
  this.init();
7006
6886
  this.lastFrameTime = -1;
@@ -7140,6 +7020,11 @@ class DefaultTicker {
7140
7020
  this.setupTickHandler();
7141
7021
  this.lastFrameTime = -1;
7142
7022
  }
7023
+ trySyncTickStatus() {
7024
+ if (this.status === STATUS$1.RUNNING) {
7025
+ this._handlerTick();
7026
+ }
7027
+ }
7143
7028
  }
7144
7029
 
7145
7030
  class ManualTickHandler {
@@ -8960,6 +8845,11 @@ class TagPointsUpdate extends ACustomAnimate {
8960
8845
  this.clipRange =
8961
8846
  this.toPoints[lastMatchedIndex][this.clipRangeByDimension] /
8962
8847
  this.toPoints[this.toPoints.length - 1][this.clipRangeByDimension];
8848
+ if (this.clipRange === 1) {
8849
+ this.shrinkClipRange =
8850
+ this.toPoints[lastMatchedIndex][this.clipRangeByDimension] /
8851
+ this.fromPoints[this.fromPoints.length - 1][this.clipRangeByDimension];
8852
+ }
8963
8853
  if (!isValidNumber(this.clipRange)) {
8964
8854
  this.clipRange = 0;
8965
8855
  }
@@ -8999,6 +8889,12 @@ class TagPointsUpdate extends ACustomAnimate {
8999
8889
  return newPoint;
9000
8890
  });
9001
8891
  }
8892
+ onFirstRun() {
8893
+ const lastClipRange = this.target.attribute.clipRange;
8894
+ if (isValidNumber(lastClipRange * this.clipRange)) {
8895
+ this.clipRange *= lastClipRange;
8896
+ }
8897
+ }
9002
8898
  onUpdate(end, ratio, out) {
9003
8899
  this.points = this.points.map((point, index) => {
9004
8900
  const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
@@ -9006,6 +8902,17 @@ class TagPointsUpdate extends ACustomAnimate {
9006
8902
  return newPoint;
9007
8903
  });
9008
8904
  if (this.clipRange) {
8905
+ if (this.shrinkClipRange) {
8906
+ if (!end) {
8907
+ out.points = this.fromPoints;
8908
+ out.clipRange = this.clipRange - (this.clipRange - this.shrinkClipRange) * ratio;
8909
+ }
8910
+ else {
8911
+ out.points = this.toPoints;
8912
+ out.clipRange = 1;
8913
+ }
8914
+ return;
8915
+ }
9009
8916
  out.clipRange = this.clipRange + (1 - this.clipRange) * ratio;
9010
8917
  }
9011
8918
  if (this.segmentsCache && this.to.segments) {
@@ -15531,14 +15438,14 @@ class DefaultArcRenderContribution {
15531
15438
  if (!(doOuterBorder || doInnerBorder)) {
15532
15439
  return;
15533
15440
  }
15534
- const { innerPadding = arcAttribute.innerPadding, outerPadding = arcAttribute.outerPadding, startAngle = arcAttribute.startAngle, endAngle = arcAttribute.endAngle, opacity = arcAttribute.opacity, x: originX = arcAttribute.x, y: originY = arcAttribute.y, scaleX = arcAttribute.scaleX, scaleY = arcAttribute.scaleY } = arc.attribute;
15441
+ const { innerPadding = arcAttribute.innerPadding, outerPadding = arcAttribute.outerPadding, startAngle = arcAttribute.startAngle, endAngle = arcAttribute.endAngle, opacity = arcAttribute.opacity, x: originX = arcAttribute.x, y: originY = arcAttribute.y, scaleX = arcAttribute.scaleX, scaleY = arcAttribute.scaleY, keepStrokeScale = arcAttribute.keepStrokeScale } = arc.attribute;
15535
15442
  let { innerRadius = arcAttribute.innerRadius, outerRadius = arcAttribute.outerRadius } = arc.attribute;
15536
15443
  outerRadius += outerPadding;
15537
15444
  innerRadius -= innerPadding;
15538
15445
  const renderBorder = (borderStyle, key) => {
15539
15446
  const doStroke = !!(borderStyle && borderStyle.stroke);
15540
15447
  const { distance = arcAttribute[key].distance } = borderStyle;
15541
- const d = getScaledStroke(context, distance, context.dpr);
15448
+ const d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr);
15542
15449
  const deltaAngle = distance / outerRadius;
15543
15450
  const sign = key === 'outerBorder' ? 1 : -1;
15544
15451
  arc.setAttributes({
@@ -15583,11 +15490,11 @@ class DefaultCircleRenderContribution {
15583
15490
  if (!(doOuterBorder || doInnerBorder)) {
15584
15491
  return;
15585
15492
  }
15586
- const { radius = circleAttribute.radius, startAngle = circleAttribute.startAngle, endAngle = circleAttribute.endAngle, opacity = circleAttribute.opacity, x: originX = circleAttribute.x, y: originY = circleAttribute.y, scaleX = circleAttribute.scaleX, scaleY = circleAttribute.scaleY } = circle.attribute;
15493
+ const { radius = circleAttribute.radius, startAngle = circleAttribute.startAngle, endAngle = circleAttribute.endAngle, opacity = circleAttribute.opacity, x: originX = circleAttribute.x, y: originY = circleAttribute.y, scaleX = circleAttribute.scaleX, scaleY = circleAttribute.scaleY, keepStrokeScale = circleAttribute.keepStrokeScale } = circle.attribute;
15587
15494
  const renderBorder = (borderStyle, key) => {
15588
15495
  const doStroke = !!(borderStyle && borderStyle.stroke);
15589
15496
  const { distance = circleAttribute[key].distance } = borderStyle;
15590
- const d = getScaledStroke(context, distance, context.dpr);
15497
+ const d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr);
15591
15498
  const sign = key === 'outerBorder' ? 1 : -1;
15592
15499
  context.beginPath();
15593
15500
  context.arc(x, y, radius + sign * d, startAngle, endAngle);
@@ -15772,7 +15679,7 @@ class DefaultRectRenderContribution {
15772
15679
  if (!(doOuterBorder || doInnerBorder)) {
15773
15680
  return;
15774
15681
  }
15775
- const { cornerRadius = rectAttribute.cornerRadius, opacity = rectAttribute.opacity, x: originX = rectAttribute.x, y: originY = rectAttribute.y, scaleX = rectAttribute.scaleX, scaleY = rectAttribute.scaleY, x1, y1 } = rect.attribute;
15682
+ const { cornerRadius = rectAttribute.cornerRadius, opacity = rectAttribute.opacity, x: originX = rectAttribute.x, y: originY = rectAttribute.y, scaleX = rectAttribute.scaleX, scaleY = rectAttribute.scaleY, x1, y1, keepStrokeScale = rectAttribute.keepStrokeScale } = rect.attribute;
15776
15683
  let { width, height } = rect.attribute;
15777
15684
  width = (width !== null && width !== void 0 ? width : x1 - x) || 0;
15778
15685
  height = (height !== null && height !== void 0 ? height : y1 - y) || 0;
@@ -15780,7 +15687,7 @@ class DefaultRectRenderContribution {
15780
15687
  const doStroke = !!(borderStyle && borderStyle.stroke);
15781
15688
  const sign = key === 'outerBorder' ? -1 : 1;
15782
15689
  const { distance = rectAttribute[key].distance } = borderStyle;
15783
- const d = getScaledStroke(context, distance, context.dpr);
15690
+ const d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr);
15784
15691
  const nextX = x + sign * d;
15785
15692
  const nextY = y + sign * d;
15786
15693
  const dw = d * 2;
@@ -16020,11 +15927,11 @@ class DefaultSymbolRenderContribution {
16020
15927
  if (!(doOuterBorder || doInnerBorder)) {
16021
15928
  return;
16022
15929
  }
16023
- const { size = symbolAttribute.size, opacity = symbolAttribute.opacity, x: originX = symbolAttribute.x, y: originY = symbolAttribute.y, scaleX = symbolAttribute.scaleX, scaleY = symbolAttribute.scaleY } = symbol.attribute;
15930
+ const { size = symbolAttribute.size, opacity = symbolAttribute.opacity, x: originX = symbolAttribute.x, y: originY = symbolAttribute.y, scaleX = symbolAttribute.scaleX, scaleY = symbolAttribute.scaleY, keepStrokeScale = symbolAttribute.keepStrokeScale } = symbol.attribute;
16024
15931
  const renderBorder = (borderStyle, key) => {
16025
15932
  const doStroke = !!(borderStyle && borderStyle.stroke);
16026
15933
  const { distance = symbolAttribute[key].distance } = borderStyle;
16027
- const d = getScaledStroke(context, distance, context.dpr);
15934
+ const d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr);
16028
15935
  const sign = key === 'outerBorder' ? 1 : -1;
16029
15936
  context.beginPath();
16030
15937
  if (parsedPath.drawOffset(context, size, x, y, sign * d) === false) {
@@ -17966,82 +17873,132 @@ let DefaultCanvasTextRender = class DefaultCanvasTextRender extends BaseRender {
17966
17873
  context.setTransformForCurrent();
17967
17874
  }
17968
17875
  };
17969
- context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);
17970
- if (direction === 'horizontal') {
17971
- const { multilineLayout } = text;
17972
- if (!multilineLayout) {
17973
- context.highPerformanceRestore();
17974
- return;
17975
- }
17976
- const { xOffset, yOffset } = multilineLayout.bbox;
17977
- if (doStroke) {
17978
- if (strokeCb) {
17979
- strokeCb(context, text.attribute, textAttribute);
17876
+ if (text.isMultiLine) {
17877
+ context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);
17878
+ if (direction === 'horizontal') {
17879
+ const { multilineLayout } = text;
17880
+ if (!multilineLayout) {
17881
+ context.highPerformanceRestore();
17882
+ return;
17980
17883
  }
17981
- else if (sVisible) {
17982
- context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute);
17983
- multilineLayout.lines.forEach(line => {
17984
- context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
17985
- });
17884
+ const { xOffset, yOffset } = multilineLayout.bbox;
17885
+ if (doStroke) {
17886
+ if (strokeCb) {
17887
+ strokeCb(context, text.attribute, textAttribute);
17888
+ }
17889
+ else if (sVisible) {
17890
+ context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute);
17891
+ multilineLayout.lines.forEach(line => {
17892
+ context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
17893
+ });
17894
+ }
17895
+ }
17896
+ if (doFill) {
17897
+ if (fillCb) {
17898
+ fillCb(context, text.attribute, textAttribute);
17899
+ }
17900
+ else if (fVisible) {
17901
+ context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute);
17902
+ multilineLayout.lines.forEach(line => {
17903
+ context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
17904
+ this.drawUnderLine(underline, lineThrough, text, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y - textDrawOffsetY('bottom', fontSize) - 0.05 * fontSize, z, textAttribute, context, {
17905
+ width: line.width
17906
+ });
17907
+ });
17908
+ }
17986
17909
  }
17987
17910
  }
17988
- if (doFill) {
17989
- if (fillCb) {
17990
- fillCb(context, text.attribute, textAttribute);
17911
+ else {
17912
+ text.tryUpdateAABBBounds();
17913
+ const cache = text.cache;
17914
+ const { verticalList } = cache;
17915
+ context.textAlign = 'left';
17916
+ context.textBaseline = 'top';
17917
+ const totalHeight = lineHeight * verticalList.length;
17918
+ let totalW = 0;
17919
+ verticalList.forEach(verticalData => {
17920
+ const _w = verticalData.reduce((a, b) => a + (b.width || 0), 0);
17921
+ totalW = max(_w, totalW);
17922
+ });
17923
+ let offsetY = 0;
17924
+ let offsetX = 0;
17925
+ if (textBaseline === 'bottom') {
17926
+ offsetX = -totalHeight;
17991
17927
  }
17992
- else if (fVisible) {
17993
- context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute);
17994
- multilineLayout.lines.forEach(line => {
17995
- context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
17996
- this.drawUnderLine(underline, lineThrough, text, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y - textDrawOffsetY('bottom', fontSize) - 0.05 * fontSize, z, textAttribute, context, {
17997
- width: line.width
17998
- });
17999
- });
17928
+ else if (textBaseline === 'middle') {
17929
+ offsetX = -totalHeight / 2;
17930
+ }
17931
+ if (textAlign === 'center') {
17932
+ offsetY -= totalW / 2;
18000
17933
  }
17934
+ else if (textAlign === 'right') {
17935
+ offsetY -= totalW;
17936
+ }
17937
+ verticalList.forEach((verticalData, i) => {
17938
+ const currentW = verticalData.reduce((a, b) => a + (b.width || 0), 0);
17939
+ const dw = totalW - currentW;
17940
+ let currentOffsetY = offsetY;
17941
+ if (textAlign === 'center') {
17942
+ currentOffsetY += dw / 2;
17943
+ }
17944
+ else if (textAlign === 'right') {
17945
+ currentOffsetY += dw;
17946
+ }
17947
+ verticalData.forEach(item => {
17948
+ const { text, width, direction } = item;
17949
+ drawText(text, totalHeight - (i + 1) * lineHeight + offsetX, currentOffsetY, direction);
17950
+ currentOffsetY += width;
17951
+ });
17952
+ });
18001
17953
  }
18002
17954
  }
18003
17955
  else {
18004
- text.tryUpdateAABBBounds();
18005
- const cache = text.cache;
18006
- const { verticalList } = cache;
18007
- context.textAlign = 'left';
18008
- context.textBaseline = 'top';
18009
- const totalHeight = lineHeight * verticalList.length;
18010
- let totalW = 0;
18011
- verticalList.forEach(verticalData => {
18012
- const _w = verticalData.reduce((a, b) => a + (b.width || 0), 0);
18013
- totalW = max(_w, totalW);
18014
- });
18015
- let offsetY = 0;
18016
- let offsetX = 0;
18017
- if (textBaseline === 'bottom') {
18018
- offsetX = -totalHeight;
18019
- }
18020
- else if (textBaseline === 'middle') {
18021
- offsetX = -totalHeight / 2;
18022
- }
18023
- if (textAlign === 'center') {
18024
- offsetY -= totalW / 2;
18025
- }
18026
- else if (textAlign === 'right') {
18027
- offsetY -= totalW;
18028
- }
18029
- verticalList.forEach((verticalData, i) => {
18030
- const currentW = verticalData.reduce((a, b) => a + (b.width || 0), 0);
18031
- const dw = totalW - currentW;
18032
- let currentOffsetY = offsetY;
18033
- if (textAlign === 'center') {
18034
- currentOffsetY += dw / 2;
17956
+ if (direction === 'horizontal') {
17957
+ context.setTextStyle(text.attribute, textAttribute, z);
17958
+ const t = text.clipedText;
17959
+ let dy = 0;
17960
+ if (lineHeight !== fontSize) {
17961
+ if (textBaseline === 'top') {
17962
+ dy = (lineHeight - fontSize) / 2;
17963
+ }
17964
+ else if (textBaseline === 'middle') ;
17965
+ else if (textBaseline === 'bottom') {
17966
+ dy = -(lineHeight - fontSize) / 2;
17967
+ }
17968
+ else ;
18035
17969
  }
18036
- else if (textAlign === 'right') {
18037
- currentOffsetY += dw;
17970
+ drawText(t, 0, dy, 0);
17971
+ }
17972
+ else {
17973
+ text.tryUpdateAABBBounds();
17974
+ const cache = text.cache;
17975
+ if (cache) {
17976
+ context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);
17977
+ const { verticalList } = cache;
17978
+ let offsetY = 0;
17979
+ const totalW = verticalList[0].reduce((a, b) => a + (b.width || 0), 0);
17980
+ let offsetX = 0;
17981
+ if (textBaseline === 'bottom') {
17982
+ offsetX = -lineHeight;
17983
+ }
17984
+ else if (textBaseline === 'middle') {
17985
+ offsetX = -lineHeight / 2;
17986
+ }
17987
+ if (textAlign === 'center') {
17988
+ offsetY -= totalW / 2;
17989
+ }
17990
+ else if (textAlign === 'right') {
17991
+ offsetY -= totalW;
17992
+ }
17993
+ context.textAlign = 'left';
17994
+ context.textBaseline = 'top';
17995
+ verticalList[0].forEach(item => {
17996
+ const { text, width, direction } = item;
17997
+ drawText(text, offsetX, offsetY, direction);
17998
+ offsetY += width;
17999
+ });
18038
18000
  }
18039
- verticalData.forEach(item => {
18040
- const { text, width, direction } = item;
18041
- drawText(text, totalHeight - (i + 1) * lineHeight + offsetX, currentOffsetY, direction);
18042
- currentOffsetY += width;
18043
- });
18044
- });
18001
+ }
18045
18002
  }
18046
18003
  transform3dMatrixToContextMatrix && this.restoreTransformUseContext2d(text, textAttribute, z, context);
18047
18004
  this.afterRenderStep(text, context, x, y, doFill, doStroke, fVisible, sVisible, textAttribute, drawContext, fillCb, strokeCb);
@@ -19111,6 +19068,40 @@ class CanvasTextLayout {
19111
19068
  }
19112
19069
  return bbox;
19113
19070
  }
19071
+ GetLayout(str, width, height, textAlign, textBaseline, lineHeight, suffix, wordBreak, suffixPosition) {
19072
+ const linesLayout = [];
19073
+ const bboxWH = [width, height];
19074
+ const bboxOffset = [0, 0];
19075
+ while (str.length > 0) {
19076
+ const { str: clipText } = this.textMeasure.clipTextWithSuffix(str, this.textOptions, width, suffix, wordBreak, suffixPosition);
19077
+ linesLayout.push({
19078
+ str: clipText,
19079
+ width: this.textMeasure.measureTextWidth(clipText, this.textOptions)
19080
+ });
19081
+ str = str.substring(clipText.length);
19082
+ }
19083
+ if (textAlign === 'left' || textAlign === 'start') ;
19084
+ else if (textAlign === 'center') {
19085
+ bboxOffset[0] = bboxWH[0] / -2;
19086
+ }
19087
+ else if (textAlign === 'right' || textAlign === 'end') {
19088
+ bboxOffset[0] = -bboxWH[0];
19089
+ }
19090
+ if (textBaseline === 'top') ;
19091
+ else if (textBaseline === 'middle') {
19092
+ bboxOffset[1] = bboxWH[1] / -2;
19093
+ }
19094
+ else if (textBaseline === 'bottom') {
19095
+ bboxOffset[1] = -bboxWH[1];
19096
+ }
19097
+ const bbox = {
19098
+ xOffset: bboxOffset[0],
19099
+ yOffset: bboxOffset[1],
19100
+ width: bboxWH[0],
19101
+ height: bboxWH[1]
19102
+ };
19103
+ return this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
19104
+ }
19114
19105
  GetLayoutByLines(lines, textAlign, textBaseline, lineHeight, suffix = '', wordBreak, lineWidth, suffixPosition = 'end') {
19115
19106
  lines = lines.map(l => l.toString());
19116
19107
  const linesLayout = [];
@@ -19118,13 +19109,10 @@ class CanvasTextLayout {
19118
19109
  if (typeof lineWidth === 'number' && lineWidth !== Infinity) {
19119
19110
  let width;
19120
19111
  for (let i = 0, len = lines.length; i < len; i++) {
19121
- const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions);
19122
- width = Math.min(metrics.width, lineWidth);
19112
+ width = Math.min(this.textMeasure.measureTextWidth(lines[i], this.textOptions), lineWidth);
19123
19113
  linesLayout.push({
19124
19114
  str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
19125
- width,
19126
- ascent: metrics.ascent,
19127
- descent: metrics.descent
19115
+ width
19128
19116
  });
19129
19117
  }
19130
19118
  bboxWH[0] = lineWidth;
@@ -19135,10 +19123,9 @@ class CanvasTextLayout {
19135
19123
  let text;
19136
19124
  for (let i = 0, len = lines.length; i < len; i++) {
19137
19125
  text = lines[i];
19138
- const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions);
19139
- width = metrics.width;
19126
+ width = this.textMeasure.measureTextWidth(text, this.textOptions);
19140
19127
  lineWidth = Math.max(lineWidth, width);
19141
- linesLayout.push({ str: text, width, ascent: metrics.ascent, descent: metrics.descent });
19128
+ linesLayout.push({ str: text, width });
19142
19129
  }
19143
19130
  bboxWH[0] = lineWidth;
19144
19131
  }
@@ -19187,7 +19174,7 @@ class CanvasTextLayout {
19187
19174
  else if (textAlign === 'right' || textAlign === 'end') {
19188
19175
  line.leftOffset = bbox.width - line.width;
19189
19176
  }
19190
- line.topOffset = lineHeight / 2 + (line.ascent - line.descent) / 2 + origin[1];
19177
+ line.topOffset = (lineHeight - this.textOptions.fontSize) / 2 + this.textOptions.fontSize * 0.79 + origin[1];
19191
19178
  origin[1] += lineHeight;
19192
19179
  return line;
19193
19180
  }
@@ -19196,7 +19183,6 @@ class CanvasTextLayout {
19196
19183
  const TEXT_UPDATE_TAG_KEY = [
19197
19184
  'text',
19198
19185
  'maxLineWidth',
19199
- 'maxWidth',
19200
19186
  'textAlign',
19201
19187
  'textBaseline',
19202
19188
  'heightLimit',
@@ -19224,14 +19210,20 @@ class Text extends Graphic {
19224
19210
  var _a;
19225
19211
  const attribute = this.attribute;
19226
19212
  const textTheme = this.getGraphicTheme();
19227
- const maxWidth = this.getMaxWidth(textTheme);
19228
- if (!Number.isFinite(maxWidth)) {
19213
+ if (!this.isSimplify()) {
19214
+ return undefined;
19215
+ }
19216
+ const { maxLineWidth = textTheme.maxLineWidth } = attribute;
19217
+ if (!Number.isFinite(maxLineWidth)) {
19229
19218
  return ((_a = attribute.text) !== null && _a !== void 0 ? _a : textTheme.text).toString();
19230
19219
  }
19231
19220
  this.tryUpdateAABBBounds();
19232
19221
  return this.cache.clipedText;
19233
19222
  }
19234
19223
  get clipedWidth() {
19224
+ if (!this.isSimplify()) {
19225
+ return undefined;
19226
+ }
19235
19227
  this.tryUpdateAABBBounds();
19236
19228
  return this.cache.clipedWidth;
19237
19229
  }
@@ -19239,11 +19231,10 @@ class Text extends Graphic {
19239
19231
  var _a, _b;
19240
19232
  const textTheme = this.getGraphicTheme();
19241
19233
  const attribute = this.attribute;
19242
- const maxWidth = this.getMaxWidth(textTheme);
19243
- if (!Number.isFinite(maxWidth)) {
19234
+ const { maxLineWidth = textTheme.maxLineWidth, text, whiteSpace = textTheme.whiteSpace } = attribute;
19235
+ if (!Number.isFinite(maxLineWidth)) {
19244
19236
  return false;
19245
19237
  }
19246
- const { text } = this.attribute;
19247
19238
  this.tryUpdateAABBBounds();
19248
19239
  if ((_b = (_a = this.cache) === null || _a === void 0 ? void 0 : _a.layoutData) === null || _b === void 0 ? void 0 : _b.lines) {
19249
19240
  let mergedText = '';
@@ -19262,9 +19253,15 @@ class Text extends Graphic {
19262
19253
  return this.clipedText !== attribute.text.toString();
19263
19254
  }
19264
19255
  get multilineLayout() {
19256
+ if (!this.isMultiLine) {
19257
+ return undefined;
19258
+ }
19265
19259
  this.tryUpdateAABBBounds();
19266
19260
  return this.cache.layoutData;
19267
19261
  }
19262
+ isSimplify() {
19263
+ return !this.isMultiLine && this.attribute.direction !== 'vertical';
19264
+ }
19268
19265
  get isMultiLine() {
19269
19266
  return Array.isArray(this.attribute.text) || this.attribute.whiteSpace === 'normal';
19270
19267
  }
@@ -19332,66 +19329,13 @@ class Text extends Graphic {
19332
19329
  transformBoundsWithMatrix(aabbBounds, aabbBounds, this.transMatrix);
19333
19330
  return aabbBounds;
19334
19331
  }
19335
- updateSingallineAABBBounds(text) {
19336
- this.updateMultilineAABBBounds([text]);
19337
- const layoutData = this.cache.layoutData;
19338
- if (layoutData) {
19339
- const line = layoutData.lines[0];
19340
- this.cache.clipedText = line.str;
19341
- this.cache.clipedWidth = line.width;
19342
- }
19343
- return this._AABBBounds;
19344
- }
19345
- updateMultilineAABBBounds(text) {
19346
- const textTheme = this.getGraphicTheme();
19347
- const { direction = textTheme.direction, underlineOffset = textTheme.underlineOffset } = this.attribute;
19348
- const b = direction === 'horizontal'
19349
- ? this.updateHorizontalMultilineAABBBounds(text)
19350
- : this.updateVerticalMultilineAABBBounds(text);
19351
- if (direction === 'horizontal') {
19352
- if (underlineOffset) {
19353
- this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset);
19354
- }
19355
- }
19356
- return b;
19357
- }
19358
- updateHorizontalMultilineAABBBounds(text) {
19359
- var _a;
19360
- const textTheme = this.getGraphicTheme();
19361
- const attribute = this.attribute;
19362
- const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, wrap = textTheme.wrap, ignoreBuf = textTheme.ignoreBuf, lineWidth = textTheme.lineWidth, whiteSpace = textTheme.whiteSpace, suffixPosition = textTheme.suffixPosition } = attribute;
19363
- const buf = ignoreBuf ? 0 : 2;
19364
- const lineHeight = this.getLineHeight(attribute, textTheme) + buf;
19365
- if (whiteSpace === 'normal' || wrap) {
19366
- return this.updateWrapAABBBounds(text);
19367
- }
19368
- if (!this.shouldUpdateShape() && ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.layoutData)) {
19369
- const bbox = this.cache.layoutData.bbox;
19370
- this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);
19371
- if (stroke) {
19372
- this._AABBBounds.expand(lineWidth / 2);
19373
- }
19374
- return this._AABBBounds;
19375
- }
19376
- const textMeasure = application.graphicUtil.textMeasure;
19377
- const layoutObj = new CanvasTextLayout(fontFamily, { fontSize, fontWeight, fontFamily }, textMeasure);
19378
- const layoutData = layoutObj.GetLayoutByLines(text, textAlign, textBaseline, lineHeight, ellipsis === true ? textTheme.ellipsis : ellipsis || undefined, false, maxLineWidth, suffixPosition);
19379
- const { bbox } = layoutData;
19380
- this.cache.layoutData = layoutData;
19381
- this.clearUpdateShapeTag();
19382
- this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);
19383
- if (stroke) {
19384
- this._AABBBounds.expand(lineWidth / 2);
19385
- }
19386
- return this._AABBBounds;
19387
- }
19388
19332
  updateWrapAABBBounds(text) {
19389
- var _a, _b, _c;
19333
+ var _a, _b, _c, _d;
19390
19334
  const textTheme = this.getGraphicTheme();
19391
19335
  const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, wordBreak = textTheme.wordBreak, fontWeight = textTheme.fontWeight, ignoreBuf = textTheme.ignoreBuf, suffixPosition = textTheme.suffixPosition, heightLimit = 0, lineClamp } = this.attribute;
19336
+ const lineHeight = (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (this.attribute.fontSize || textTheme.fontSize);
19392
19337
  const buf = ignoreBuf ? 0 : 2;
19393
- const lineHeight = this.getLineHeight(this.attribute, textTheme) + buf;
19394
- if (!this.shouldUpdateShape() && ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.layoutData)) {
19338
+ if (!this.shouldUpdateShape() && ((_b = this.cache) === null || _b === void 0 ? void 0 : _b.layoutData)) {
19395
19339
  const bbox = this.cache.layoutData.bbox;
19396
19340
  this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);
19397
19341
  if (stroke) {
@@ -19400,8 +19344,7 @@ class Text extends Graphic {
19400
19344
  return this._AABBBounds;
19401
19345
  }
19402
19346
  const textMeasure = application.graphicUtil.textMeasure;
19403
- const textOptions = { fontSize, fontWeight, fontFamily };
19404
- const layoutObj = new CanvasTextLayout(fontFamily, textOptions, textMeasure);
19347
+ const layoutObj = new CanvasTextLayout(fontFamily, { fontSize, fontWeight, fontFamily }, textMeasure);
19405
19348
  const lines = isArray(text) ? text.map(l => l.toString()) : [text.toString()];
19406
19349
  const linesLayout = [];
19407
19350
  const bboxWH = [0, 0];
@@ -19418,22 +19361,19 @@ class Text extends Graphic {
19418
19361
  const str = lines[i];
19419
19362
  let needCut = true;
19420
19363
  if (i === lineCountLimit - 1) {
19421
- const clip = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, false, suffixPosition, i !== lines.length - 1);
19422
- const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);
19364
+ const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, false, suffixPosition, i !== lines.length - 1);
19423
19365
  linesLayout.push({
19424
19366
  str: clip.str,
19425
- width: clip.width,
19426
- ascent: matrics.ascent,
19427
- descent: matrics.descent
19367
+ width: clip.width
19428
19368
  });
19429
19369
  break;
19430
19370
  }
19431
- const clip = textMeasure.clipText(str, textOptions, maxLineWidth, wordBreak === 'break-word');
19432
- if (str !== '' && clip.str === '') {
19371
+ const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, wordBreak !== 'break-all', wordBreak === 'keep-all');
19372
+ if ((str !== '' && clip.str === '') || clip.wordBreaked) {
19433
19373
  if (ellipsis) {
19434
- const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, false, suffixPosition);
19435
- clip.str = (_b = clipEllipsis.str) !== null && _b !== void 0 ? _b : '';
19436
- clip.width = (_c = clipEllipsis.width) !== null && _c !== void 0 ? _c : 0;
19374
+ const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, false, suffixPosition);
19375
+ clip.str = (_c = clipEllipsis.str) !== null && _c !== void 0 ? _c : '';
19376
+ clip.width = (_d = clipEllipsis.width) !== null && _d !== void 0 ? _d : 0;
19437
19377
  }
19438
19378
  else {
19439
19379
  clip.str = '';
@@ -19441,16 +19381,21 @@ class Text extends Graphic {
19441
19381
  }
19442
19382
  needCut = false;
19443
19383
  }
19444
- const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);
19445
19384
  linesLayout.push({
19446
19385
  str: clip.str,
19447
- width: clip.width,
19448
- ascent: matrics.ascent,
19449
- descent: matrics.descent
19386
+ width: clip.width
19450
19387
  });
19388
+ let cutLength = clip.str.length;
19389
+ if (clip.wordBreaked && !(str !== '' && clip.str === '')) {
19390
+ needCut = true;
19391
+ cutLength = clip.wordBreaked;
19392
+ }
19451
19393
  if (clip.str.length === str.length) ;
19452
19394
  else if (needCut) {
19453
- const newStr = str.substring(clip.str.length);
19395
+ let newStr = str.substring(cutLength);
19396
+ if (wordBreak === 'keep-all') {
19397
+ newStr = newStr.replace(/^\s+/g, '');
19398
+ }
19454
19399
  lines.splice(i + 1, 0, newStr);
19455
19400
  }
19456
19401
  }
@@ -19467,26 +19412,22 @@ class Text extends Graphic {
19467
19412
  let text;
19468
19413
  for (let i = 0, len = lines.length; i < len; i++) {
19469
19414
  if (i === lineCountLimit - 1) {
19470
- const clip = textMeasure.clipTextWithSuffix(lines[i], textOptions, maxLineWidth, ellipsis, false, suffixPosition);
19471
- const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);
19415
+ const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, false, suffixPosition);
19472
19416
  linesLayout.push({
19473
19417
  str: clip.str,
19474
- width: clip.width,
19475
- ascent: matrics.ascent,
19476
- descent: matrics.descent
19418
+ width: clip.width
19477
19419
  });
19478
19420
  lineWidth = Math.max(lineWidth, clip.width);
19479
19421
  break;
19480
19422
  }
19481
19423
  text = lines[i];
19482
- width = textMeasure.measureTextWidth(text, textOptions);
19424
+ width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, wordBreak === 'break-word');
19483
19425
  lineWidth = Math.max(lineWidth, width);
19484
- const matrics = textMeasure.measureTextPixelADscentAndWidth(text, textOptions);
19485
- linesLayout.push({ str: text, width, ascent: matrics.ascent, descent: matrics.descent });
19426
+ linesLayout.push({ str: text, width });
19486
19427
  }
19487
19428
  bboxWH[0] = lineWidth;
19488
19429
  }
19489
- bboxWH[1] = linesLayout.length * lineHeight;
19430
+ bboxWH[1] = linesLayout.length * (lineHeight + buf);
19490
19431
  const bbox = {
19491
19432
  xOffset: 0,
19492
19433
  yOffset: 0,
@@ -19503,19 +19444,212 @@ class Text extends Graphic {
19503
19444
  }
19504
19445
  return this._AABBBounds;
19505
19446
  }
19506
- updateVerticalMultilineAABBBounds(text) {
19447
+ updateSingallineAABBBounds(text) {
19448
+ const textTheme = this.getGraphicTheme();
19449
+ const { direction = textTheme.direction, underlineOffset = textTheme.underlineOffset } = this.attribute;
19450
+ const b = direction === 'horizontal'
19451
+ ? this.updateHorizontalSinglelineAABBBounds(text)
19452
+ : this.updateVerticalSinglelineAABBBounds(text);
19453
+ if (direction === 'horizontal') {
19454
+ if (underlineOffset) {
19455
+ this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset);
19456
+ }
19457
+ }
19458
+ return b;
19459
+ }
19460
+ updateMultilineAABBBounds(text) {
19461
+ const textTheme = this.getGraphicTheme();
19462
+ const { direction = textTheme.direction, underlineOffset = textTheme.underlineOffset } = this.attribute;
19463
+ const b = direction === 'horizontal'
19464
+ ? this.updateHorizontalMultilineAABBBounds(text)
19465
+ : this.updateVerticalMultilineAABBBounds(text);
19466
+ if (direction === 'horizontal') {
19467
+ if (underlineOffset) {
19468
+ this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset);
19469
+ }
19470
+ }
19471
+ return b;
19472
+ }
19473
+ updateHorizontalSinglelineAABBBounds(text) {
19507
19474
  var _a, _b;
19508
19475
  const textTheme = this.getGraphicTheme();
19476
+ const { wrap = textTheme.wrap } = this.attribute;
19477
+ if (wrap) {
19478
+ return this.updateWrapAABBBounds([text]);
19479
+ }
19509
19480
  const textMeasure = application.graphicUtil.textMeasure;
19510
19481
  let width;
19482
+ let str;
19511
19483
  const attribute = this.attribute;
19484
+ const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontFamily = textTheme.fontFamily, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, ignoreBuf = textTheme.ignoreBuf, whiteSpace = textTheme.whiteSpace, suffixPosition = textTheme.suffixPosition } = attribute;
19485
+ if (whiteSpace === 'normal') {
19486
+ return this.updateWrapAABBBounds(text);
19487
+ }
19488
+ const buf = ignoreBuf ? 0 : Math.max(2, fontSize * 0.075);
19489
+ const textFontSize = attribute.fontSize || textTheme.fontSize;
19490
+ const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) !== null && _a !== void 0 ? _a : textFontSize + buf;
19491
+ if (!this.shouldUpdateShape() && this.cache) {
19492
+ width = (_b = this.cache.clipedWidth) !== null && _b !== void 0 ? _b : 0;
19493
+ const dx = textDrawOffsetX(textAlign, width);
19494
+ const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
19495
+ this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight);
19496
+ if (stroke) {
19497
+ this._AABBBounds.expand(lineWidth / 2);
19498
+ }
19499
+ return this._AABBBounds;
19500
+ }
19501
+ if (Number.isFinite(maxLineWidth)) {
19502
+ if (ellipsis) {
19503
+ const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis);
19504
+ const data = textMeasure.clipTextWithSuffix(text.toString(), { fontSize, fontWeight, fontFamily }, maxLineWidth, strEllipsis, false, suffixPosition);
19505
+ str = data.str;
19506
+ width = data.width;
19507
+ }
19508
+ else {
19509
+ const data = textMeasure.clipText(text.toString(), { fontSize, fontWeight, fontFamily }, maxLineWidth, false);
19510
+ str = data.str;
19511
+ width = data.width;
19512
+ }
19513
+ this.cache.clipedText = str;
19514
+ this.cache.clipedWidth = width;
19515
+ }
19516
+ else {
19517
+ width = textMeasure.measureTextWidth(text.toString(), { fontSize, fontWeight, fontFamily });
19518
+ this.cache.clipedText = text.toString();
19519
+ this.cache.clipedWidth = width;
19520
+ }
19521
+ this.clearUpdateShapeTag();
19522
+ const dx = textDrawOffsetX(textAlign, width);
19523
+ let lh = lineHeight;
19524
+ if (application.global && application.global.isSafari()) {
19525
+ lh += fontSize * 0.2;
19526
+ }
19527
+ const dy = textLayoutOffsetY(textBaseline, lh, fontSize, buf);
19528
+ this._AABBBounds.set(dx, dy, dx + width, dy + lh);
19529
+ if (stroke) {
19530
+ this._AABBBounds.expand(lineWidth / 2);
19531
+ }
19532
+ return this._AABBBounds;
19533
+ }
19534
+ getBaselineMapAlign() {
19535
+ return Text.baselineMapAlign;
19536
+ }
19537
+ getAlignMapBaseline() {
19538
+ return Text.alignMapBaseline;
19539
+ }
19540
+ updateVerticalSinglelineAABBBounds(text) {
19541
+ var _a, _b, _c;
19542
+ const textTheme = this.getGraphicTheme();
19543
+ const textMeasure = application.graphicUtil.textMeasure;
19544
+ let width;
19545
+ const attribute = this.attribute;
19546
+ const { ignoreBuf = textTheme.ignoreBuf } = attribute;
19547
+ const buf = ignoreBuf ? 0 : 2;
19548
+ const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, fontFamily = textTheme.fontFamily, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, verticalMode = textTheme.verticalMode, suffixPosition = textTheme.suffixPosition } = attribute;
19549
+ const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
19550
+ let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;
19551
+ if (!verticalMode) {
19552
+ const t = textAlign;
19553
+ textAlign = (_b = Text.baselineMapAlign[textBaseline]) !== null && _b !== void 0 ? _b : 'left';
19554
+ textBaseline = (_c = Text.alignMapBaseline[t]) !== null && _c !== void 0 ? _c : 'top';
19555
+ }
19556
+ if (!this.shouldUpdateShape() && this.cache) {
19557
+ width = this.cache.clipedWidth;
19558
+ const dx = textDrawOffsetX(textAlign, width);
19559
+ const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
19560
+ this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width);
19561
+ if (stroke) {
19562
+ this._AABBBounds.expand(lineWidth / 2);
19563
+ }
19564
+ return this._AABBBounds;
19565
+ }
19566
+ let verticalList = [
19567
+ verticalLayout(text.toString())
19568
+ ];
19569
+ if (Number.isFinite(maxLineWidth)) {
19570
+ if (ellipsis) {
19571
+ const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis);
19572
+ const data = textMeasure.clipTextWithSuffixVertical(verticalList[0], { fontSize, fontWeight, fontFamily }, maxLineWidth, strEllipsis, false, suffixPosition);
19573
+ verticalList = [data.verticalList];
19574
+ width = data.width;
19575
+ }
19576
+ else {
19577
+ const data = textMeasure.clipTextVertical(verticalList[0], { fontSize, fontWeight, fontFamily }, maxLineWidth, false);
19578
+ verticalList = [data.verticalList];
19579
+ width = data.width;
19580
+ }
19581
+ this.cache.verticalList = verticalList;
19582
+ this.cache.clipedWidth = width;
19583
+ }
19584
+ else {
19585
+ width = 0;
19586
+ verticalList[0].forEach(t => {
19587
+ const w = t.direction === TextDirection.HORIZONTAL
19588
+ ? fontSize
19589
+ : textMeasure.measureTextWidth(t.text, { fontSize, fontWeight, fontFamily });
19590
+ width += w;
19591
+ t.width = w;
19592
+ });
19593
+ this.cache.verticalList = verticalList;
19594
+ this.cache.clipedWidth = width;
19595
+ }
19596
+ this.clearUpdateShapeTag();
19597
+ const dx = textDrawOffsetX(textAlign, width);
19598
+ const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
19599
+ this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width);
19600
+ if (stroke) {
19601
+ this._AABBBounds.expand(lineWidth / 2);
19602
+ }
19603
+ return this._AABBBounds;
19604
+ }
19605
+ updateHorizontalMultilineAABBBounds(text) {
19606
+ var _a, _b;
19607
+ const textTheme = this.getGraphicTheme();
19608
+ const { wrap = textTheme.wrap } = this.attribute;
19609
+ if (wrap) {
19610
+ return this.updateWrapAABBBounds(text);
19611
+ }
19612
+ const attribute = this.attribute;
19613
+ const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, whiteSpace = textTheme.whiteSpace, suffixPosition = textTheme.suffixPosition } = attribute;
19614
+ const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize);
19615
+ if (whiteSpace === 'normal') {
19616
+ return this.updateWrapAABBBounds(text);
19617
+ }
19618
+ if (!this.shouldUpdateShape() && ((_b = this.cache) === null || _b === void 0 ? void 0 : _b.layoutData)) {
19619
+ const bbox = this.cache.layoutData.bbox;
19620
+ this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);
19621
+ if (stroke) {
19622
+ this._AABBBounds.expand(lineWidth / 2);
19623
+ }
19624
+ return this._AABBBounds;
19625
+ }
19626
+ const textMeasure = application.graphicUtil.textMeasure;
19627
+ const layoutObj = new CanvasTextLayout(fontFamily, { fontSize, fontWeight, fontFamily }, textMeasure);
19628
+ const layoutData = layoutObj.GetLayoutByLines(text, textAlign, textBaseline, lineHeight, ellipsis === true ? textTheme.ellipsis : ellipsis || undefined, false, maxLineWidth, suffixPosition);
19629
+ const { bbox } = layoutData;
19630
+ this.cache.layoutData = layoutData;
19631
+ this.clearUpdateShapeTag();
19632
+ this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);
19633
+ if (stroke) {
19634
+ this._AABBBounds.expand(lineWidth / 2);
19635
+ }
19636
+ return this._AABBBounds;
19637
+ }
19638
+ updateVerticalMultilineAABBBounds(text) {
19639
+ var _a, _b, _c;
19640
+ const textTheme = this.getGraphicTheme();
19641
+ const textMeasure = application.graphicUtil.textMeasure;
19642
+ let width;
19643
+ const attribute = this.attribute;
19644
+ const { ignoreBuf = textTheme.ignoreBuf } = attribute;
19645
+ const buf = ignoreBuf ? 0 : 2;
19512
19646
  const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, fontFamily = textTheme.fontFamily, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, verticalMode = textTheme.verticalMode, suffixPosition = textTheme.suffixPosition } = attribute;
19513
- const lineHeight = this.getLineHeight(attribute, textTheme);
19647
+ const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
19514
19648
  let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;
19515
19649
  if (!verticalMode) {
19516
19650
  const t = textAlign;
19517
- textAlign = (_a = Text.baselineMapAlign[textBaseline]) !== null && _a !== void 0 ? _a : 'left';
19518
- textBaseline = (_b = Text.alignMapBaseline[t]) !== null && _b !== void 0 ? _b : 'top';
19651
+ textAlign = (_b = Text.baselineMapAlign[textBaseline]) !== null && _b !== void 0 ? _b : 'left';
19652
+ textBaseline = (_c = Text.alignMapBaseline[t]) !== null && _c !== void 0 ? _c : 'top';
19519
19653
  }
19520
19654
  width = 0;
19521
19655
  if (!this.shouldUpdateShape() && this.cache) {
@@ -19575,15 +19709,6 @@ class Text extends Graphic {
19575
19709
  }
19576
19710
  return this._AABBBounds;
19577
19711
  }
19578
- getMaxWidth(theme) {
19579
- var _a, _b;
19580
- const attribute = this.attribute;
19581
- return (_b = (_a = attribute.maxLineWidth) !== null && _a !== void 0 ? _a : attribute.maxWidth) !== null && _b !== void 0 ? _b : theme.maxWidth;
19582
- }
19583
- getLineHeight(attribute, textTheme) {
19584
- var _a;
19585
- return ((_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize));
19586
- }
19587
19712
  needUpdateTags(keys, k = TEXT_UPDATE_TAG_KEY) {
19588
19713
  return super.needUpdateTags(keys, k);
19589
19714
  }
@@ -19596,12 +19721,6 @@ class Text extends Graphic {
19596
19721
  getNoWorkAnimateAttr() {
19597
19722
  return Text.NOWORK_ANIMATE_ATTR;
19598
19723
  }
19599
- getBaselineMapAlign() {
19600
- return Text.baselineMapAlign;
19601
- }
19602
- getAlignMapBaseline() {
19603
- return Text.alignMapBaseline;
19604
- }
19605
19724
  }
19606
19725
  Text.NOWORK_ANIMATE_ATTR = Object.assign({ ellipsis: 1, wordBreak: 1, direction: 1, textAlign: 1, textBaseline: 1, fontFamily: 1, fontWeight: 1 }, NOWORK_ANIMATE_ATTR);
19607
19726
  Text.baselineMapAlign = {
@@ -19665,9 +19784,7 @@ class WrapText extends Text {
19665
19784
  const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, false, suffixPosition);
19666
19785
  linesLayout.push({
19667
19786
  str: clip.str,
19668
- width: clip.width,
19669
- ascent: 0,
19670
- descent: 0
19787
+ width: clip.width
19671
19788
  });
19672
19789
  break;
19673
19790
  }
@@ -19686,9 +19803,7 @@ class WrapText extends Text {
19686
19803
  }
19687
19804
  linesLayout.push({
19688
19805
  str: clip.str,
19689
- width: clip.width,
19690
- ascent: 0,
19691
- descent: 0
19806
+ width: clip.width
19692
19807
  });
19693
19808
  if (clip.str.length === str.length) ;
19694
19809
  else if (needCut) {
@@ -19712,9 +19827,7 @@ class WrapText extends Text {
19712
19827
  const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, false, suffixPosition);
19713
19828
  linesLayout.push({
19714
19829
  str: clip.str,
19715
- width: clip.width,
19716
- ascent: 0,
19717
- descent: 0
19830
+ width: clip.width
19718
19831
  });
19719
19832
  lineWidth = Math.max(lineWidth, clip.width);
19720
19833
  break;
@@ -19722,7 +19835,7 @@ class WrapText extends Text {
19722
19835
  text = lines[i];
19723
19836
  width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, wordBreak === 'break-word');
19724
19837
  lineWidth = Math.max(lineWidth, width);
19725
- linesLayout.push({ str: text, width, ascent: 0, descent: 0 });
19838
+ linesLayout.push({ str: text, width });
19726
19839
  }
19727
19840
  bboxWH[0] = lineWidth;
19728
19841
  }
@@ -19785,6 +19898,9 @@ class BaseSymbol {
19785
19898
  bounds.y2 = size[1] / 2;
19786
19899
  }
19787
19900
  }
19901
+ parseSize(size) {
19902
+ return isNumber(size) ? size : Math.min(size[0], size[1]);
19903
+ }
19788
19904
  }
19789
19905
 
19790
19906
  function circle(ctx, r, x, y, z) {
@@ -19803,15 +19919,15 @@ class CircleSymbol extends BaseSymbol {
19803
19919
  this.pathStr = 'M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0';
19804
19920
  }
19805
19921
  draw(ctx, size, x, y, z) {
19806
- const r = size / 2;
19922
+ const r = this.parseSize(size) / 2;
19807
19923
  return circle(ctx, r, x, y, z);
19808
19924
  }
19809
19925
  drawOffset(ctx, size, x, y, offset, z) {
19810
- const r = size / 2 + offset;
19926
+ const r = this.parseSize(size) / 2 + offset;
19811
19927
  return circle(ctx, r, x, y, z);
19812
19928
  }
19813
19929
  drawToSvgPath(size, x, y, z) {
19814
- const r = size / 2;
19930
+ const r = this.parseSize(size) / 2;
19815
19931
  return `M ${x - r}, ${y} a ${r},${r} 0 1,0 ${r * 2},0 a ${r},${r} 0 1,0 -${r * 2},0`;
19816
19932
  }
19817
19933
  }
@@ -19856,11 +19972,11 @@ class CrossSymbol extends BaseSymbol {
19856
19972
  this.pathStr = 'M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z';
19857
19973
  }
19858
19974
  draw(ctx, size, x, y, z) {
19859
- const r = size / 6;
19975
+ const r = this.parseSize(size) / 6;
19860
19976
  return cross(ctx, r, x, y, z);
19861
19977
  }
19862
19978
  drawOffset(ctx, size, x, y, offset, z) {
19863
- const r = size / 6;
19979
+ const r = this.parseSize(size) / 6;
19864
19980
  return crossOffset(ctx, r, x, y, offset, z);
19865
19981
  }
19866
19982
  }
@@ -19881,15 +19997,15 @@ class DiamondSymbol extends BaseSymbol {
19881
19997
  this.pathStr = 'M-0.5,0L0,-0.5L0.5,0L0,0.5Z';
19882
19998
  }
19883
19999
  draw(ctx, size, x, y, z) {
19884
- const r = size / 2;
20000
+ const r = this.parseSize(size) / 2;
19885
20001
  return diamond(ctx, r, x, y, z);
19886
20002
  }
19887
20003
  drawFitDir(ctx, size, x, y, z) {
19888
- const r = size / 2;
20004
+ const r = this.parseSize(size) / 2;
19889
20005
  return diamond(ctx, r, x, y, z);
19890
20006
  }
19891
20007
  drawOffset(ctx, size, x, y, offset, z) {
19892
- const r = size / 2 + offset;
20008
+ const r = this.parseSize(size) / 2 + offset;
19893
20009
  return diamond(ctx, r, x, y, z);
19894
20010
  }
19895
20011
  }
@@ -19907,11 +20023,11 @@ class SquareSymbol extends BaseSymbol {
19907
20023
  this.pathStr = 'M-0.5,-0.5h1v1h-1Z';
19908
20024
  }
19909
20025
  draw(ctx, size, x, y) {
19910
- const r = size / 2;
20026
+ const r = this.parseSize(size) / 2;
19911
20027
  return square(ctx, r, x, y);
19912
20028
  }
19913
20029
  drawOffset(ctx, size, x, y, offset) {
19914
- const r = size / 2 + offset;
20030
+ const r = this.parseSize(size) / 2 + offset;
19915
20031
  return square(ctx, r, x, y);
19916
20032
  }
19917
20033
  }
@@ -19931,11 +20047,11 @@ class TriangleUpSymbol extends BaseSymbol {
19931
20047
  this.pathStr = 'M0.5,0.5 L-0.5,0.5 L0,-0.5 Z';
19932
20048
  }
19933
20049
  draw(ctx, size, x, y) {
19934
- const r = size / 2;
20050
+ const r = this.parseSize(size) / 2;
19935
20051
  return trianglUpOffset(ctx, r, x, y);
19936
20052
  }
19937
20053
  drawOffset(ctx, size, x, y, offset) {
19938
- const r = size / 2;
20054
+ const r = this.parseSize(size) / 2;
19939
20055
  return trianglUpOffset(ctx, r, x, y, offset);
19940
20056
  }
19941
20057
  }
@@ -19974,11 +20090,11 @@ class StarSymbol extends BaseSymbol {
19974
20090
  this.pathStr = 'M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z';
19975
20091
  }
19976
20092
  draw(ctx, size, transX, transY) {
19977
- const r = size / 2;
20093
+ const r = this.parseSize(size) / 2;
19978
20094
  return star(ctx, r, transX, transY);
19979
20095
  }
19980
20096
  drawOffset(ctx, size, transX, transY, offset) {
19981
- const r = size / 2 + offset;
20097
+ const r = this.parseSize(size) / 2 + offset;
19982
20098
  return star(ctx, r, transX, transY);
19983
20099
  }
19984
20100
  }
@@ -20007,11 +20123,11 @@ class ArrowSymbol extends BaseSymbol {
20007
20123
  this.pathStr = 'M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z';
20008
20124
  }
20009
20125
  draw(ctx, size, transX, transY) {
20010
- const r = size / 2;
20126
+ const r = this.parseSize(size) / 2;
20011
20127
  return arrow(ctx, r, transX, transY);
20012
20128
  }
20013
20129
  drawOffset(ctx, size, transX, transY, offset) {
20014
- const r = size / 2 + offset;
20130
+ const r = this.parseSize(size) / 2 + offset;
20015
20131
  return arrow(ctx, r, transX, transY);
20016
20132
  }
20017
20133
  }
@@ -20032,11 +20148,11 @@ class WedgeSymbol extends BaseSymbol {
20032
20148
  this.pathStr = 'M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z';
20033
20149
  }
20034
20150
  draw(ctx, size, transX, transY) {
20035
- const r = size / 2;
20151
+ const r = this.parseSize(size) / 2;
20036
20152
  return wedge(ctx, r, transX, transY);
20037
20153
  }
20038
20154
  drawOffset(ctx, size, transX, transY, offset) {
20039
- const r = size / 2 + offset;
20155
+ const r = this.parseSize(size) / 2 + offset;
20040
20156
  return wedge(ctx, r, transX, transY);
20041
20157
  }
20042
20158
  }
@@ -20054,11 +20170,11 @@ class StrokeSymbol extends BaseSymbol {
20054
20170
  this.pathStr = '';
20055
20171
  }
20056
20172
  draw(ctx, size, transX, transY) {
20057
- const r = size / 2;
20173
+ const r = this.parseSize(size) / 2;
20058
20174
  return stroke(ctx, r, transX, transY);
20059
20175
  }
20060
20176
  drawOffset(ctx, size, transX, transY, offset) {
20061
- const r = size / 2 + offset;
20177
+ const r = this.parseSize(size) / 2 + offset;
20062
20178
  return stroke(ctx, r, transX, transY);
20063
20179
  }
20064
20180
  }
@@ -20093,11 +20209,11 @@ class WyeSymbol extends BaseSymbol {
20093
20209
  this.pathStr = 'M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z';
20094
20210
  }
20095
20211
  draw(ctx, size, transX, transY) {
20096
- const r = size / 2;
20212
+ const r = this.parseSize(size) / 2;
20097
20213
  return wye(ctx, r, transX, transY);
20098
20214
  }
20099
20215
  drawOffset(ctx, size, transX, transY, offset) {
20100
- const r = size / 2 + offset;
20216
+ const r = this.parseSize(size) / 2 + offset;
20101
20217
  return wye(ctx, r, transX, transY);
20102
20218
  }
20103
20219
  }
@@ -20117,11 +20233,11 @@ class TriangleLeftSymbol extends BaseSymbol {
20117
20233
  this.pathStr = 'M-0.5,0 L0.5,0.5 L0.5,-0.5 Z';
20118
20234
  }
20119
20235
  draw(ctx, size, x, y) {
20120
- const r = size / 2;
20236
+ const r = this.parseSize(size) / 2;
20121
20237
  return trianglLeftOffset(ctx, r, x, y, 0);
20122
20238
  }
20123
20239
  drawOffset(ctx, size, x, y, offset) {
20124
- const r = size / 2;
20240
+ const r = this.parseSize(size) / 2;
20125
20241
  return trianglLeftOffset(ctx, r, x, y, offset);
20126
20242
  }
20127
20243
  }
@@ -20141,11 +20257,11 @@ class TriangleRightSymbol extends BaseSymbol {
20141
20257
  this.pathStr = 'M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z';
20142
20258
  }
20143
20259
  draw(ctx, size, x, y) {
20144
- const r = size / 2;
20260
+ const r = this.parseSize(size) / 2;
20145
20261
  return trianglRightOffset(ctx, r, x, y);
20146
20262
  }
20147
20263
  drawOffset(ctx, size, x, y, offset) {
20148
- const r = size / 2;
20264
+ const r = this.parseSize(size) / 2;
20149
20265
  return trianglRightOffset(ctx, r, x, y, offset);
20150
20266
  }
20151
20267
  }
@@ -20165,11 +20281,11 @@ class TriangleDownSymbol extends BaseSymbol {
20165
20281
  this.pathStr = 'M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z';
20166
20282
  }
20167
20283
  draw(ctx, size, x, y) {
20168
- const r = size / 2;
20284
+ const r = this.parseSize(size) / 2;
20169
20285
  return trianglDownOffset(ctx, r, x, y);
20170
20286
  }
20171
20287
  drawOffset(ctx, size, x, y, offset) {
20172
- const r = size / 2;
20288
+ const r = this.parseSize(size) / 2;
20173
20289
  return trianglDownOffset(ctx, r, x, y, offset);
20174
20290
  }
20175
20291
  }
@@ -20191,11 +20307,11 @@ class ThinTriangleSymbol extends BaseSymbol {
20191
20307
  this.pathStr = 'M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z';
20192
20308
  }
20193
20309
  draw(ctx, size, x, y) {
20194
- const r = size / 2 / sqrt3;
20310
+ const r = this.parseSize(size) / 2 / sqrt3;
20195
20311
  return thinTriangle(ctx, r, x, y);
20196
20312
  }
20197
20313
  drawOffset(ctx, size, x, y, offset) {
20198
- const r = size / 2 / sqrt3 + offset;
20314
+ const r = this.parseSize(size) / 2 / sqrt3 + offset;
20199
20315
  return thinTriangle(ctx, r, x, y);
20200
20316
  }
20201
20317
  }
@@ -20215,11 +20331,11 @@ class Arrow2LeftSymbol extends BaseSymbol {
20215
20331
  this.pathStr = 'M 0.25 -0.5 L -0.25 0 l 0.25 0.5';
20216
20332
  }
20217
20333
  draw(ctx, size, transX, transY) {
20218
- const r = size / 4;
20334
+ const r = this.parseSize(size) / 4;
20219
20335
  return arrow2Left(ctx, r, transX, transY);
20220
20336
  }
20221
20337
  drawOffset(ctx, size, transX, transY, offset) {
20222
- const r = size / 4 + offset;
20338
+ const r = this.parseSize(size) / 4 + offset;
20223
20339
  return arrow2Left(ctx, r, transX, transY);
20224
20340
  }
20225
20341
  }
@@ -20239,11 +20355,11 @@ class Arrow2RightSymbol extends BaseSymbol {
20239
20355
  this.pathStr = 'M -0.25 -0.5 l 0.25 0 l -0.25 0.5';
20240
20356
  }
20241
20357
  draw(ctx, size, transX, transY) {
20242
- const r = size / 4;
20358
+ const r = this.parseSize(size) / 4;
20243
20359
  return arrow2Right(ctx, r, transX, transY);
20244
20360
  }
20245
20361
  drawOffset(ctx, size, transX, transY, offset) {
20246
- const r = size / 4 + offset;
20362
+ const r = this.parseSize(size) / 4 + offset;
20247
20363
  return arrow2Right(ctx, r, transX, transY);
20248
20364
  }
20249
20365
  }
@@ -20263,11 +20379,11 @@ class Arrow2UpSymbol extends BaseSymbol {
20263
20379
  this.pathStr = 'M -0.5 0.25 L 0 -0.25 l 0.5 0.25';
20264
20380
  }
20265
20381
  draw(ctx, size, transX, transY) {
20266
- const r = size / 4;
20382
+ const r = this.parseSize(size) / 4;
20267
20383
  return arrow2Up(ctx, r, transX, transY);
20268
20384
  }
20269
20385
  drawOffset(ctx, size, transX, transY, offset) {
20270
- const r = size / 4 + offset;
20386
+ const r = this.parseSize(size) / 4 + offset;
20271
20387
  return arrow2Up(ctx, r, transX, transY);
20272
20388
  }
20273
20389
  }
@@ -20287,11 +20403,11 @@ class Arrow2DownSymbol extends BaseSymbol {
20287
20403
  this.pathStr = 'M -0.5 -0.25 L 0 0.25 l 0.5 -0.25';
20288
20404
  }
20289
20405
  draw(ctx, size, transX, transY) {
20290
- const r = size / 4;
20406
+ const r = this.parseSize(size) / 4;
20291
20407
  return arrow2Down(ctx, r, transX, transY);
20292
20408
  }
20293
20409
  drawOffset(ctx, size, transX, transY, offset) {
20294
- const r = size / 4 + offset;
20410
+ const r = this.parseSize(size) / 4 + offset;
20295
20411
  return arrow2Down(ctx, r, transX, transY);
20296
20412
  }
20297
20413
  }
@@ -20309,15 +20425,15 @@ class LineVSymbol extends BaseSymbol {
20309
20425
  this.pathStr = 'M0,-0.5L0,0.5';
20310
20426
  }
20311
20427
  draw(ctx, size, x, y, z) {
20312
- const r = size / 2;
20428
+ const r = this.parseSize(size) / 2;
20313
20429
  return lineV(ctx, r, x, y);
20314
20430
  }
20315
20431
  drawOffset(ctx, size, x, y, offset, z) {
20316
- const r = size / 2 + offset;
20432
+ const r = this.parseSize(size) / 2 + offset;
20317
20433
  return lineV(ctx, r, x, y);
20318
20434
  }
20319
20435
  drawToSvgPath(size, x, y, z) {
20320
- const r = size / 2;
20436
+ const r = this.parseSize(size) / 2;
20321
20437
  return `M ${x}, ${y - r} L ${x},${y + r}`;
20322
20438
  }
20323
20439
  }
@@ -20335,15 +20451,15 @@ class LineHSymbol extends BaseSymbol {
20335
20451
  this.pathStr = 'M-0.5,0L0.5,0';
20336
20452
  }
20337
20453
  draw(ctx, size, x, y, z) {
20338
- const r = size / 2;
20454
+ const r = this.parseSize(size) / 2;
20339
20455
  return lineH(ctx, r, x, y);
20340
20456
  }
20341
20457
  drawOffset(ctx, size, x, y, offset, z) {
20342
- const r = size / 2 + offset;
20458
+ const r = this.parseSize(size) / 2 + offset;
20343
20459
  return lineH(ctx, r, x, y);
20344
20460
  }
20345
20461
  drawToSvgPath(size, x, y, z) {
20346
- const r = size / 2;
20462
+ const r = this.parseSize(size) / 2;
20347
20463
  return `M ${x - r}, ${y} L ${x + r},${y}`;
20348
20464
  }
20349
20465
  }
@@ -20363,15 +20479,15 @@ class CloseSymbol extends BaseSymbol {
20363
20479
  this.pathStr = 'M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5';
20364
20480
  }
20365
20481
  draw(ctx, size, x, y, z) {
20366
- const r = size / 2;
20482
+ const r = this.parseSize(size) / 2;
20367
20483
  return close(ctx, r, x, y);
20368
20484
  }
20369
20485
  drawOffset(ctx, size, x, y, offset, z) {
20370
- const r = size / 2 + offset;
20486
+ const r = this.parseSize(size) / 2 + offset;
20371
20487
  return close(ctx, r, x, y);
20372
20488
  }
20373
20489
  drawToSvgPath(size, x, y, z) {
20374
- const r = size / 2;
20490
+ const r = this.parseSize(size) / 2;
20375
20491
  return `M ${x - r}, ${y - r} L ${x + r},${y + r} M ${x + r}, ${y - r} L ${x - r},${y + r}`;
20376
20492
  }
20377
20493
  }
@@ -20422,6 +20538,7 @@ class CustomSymbolClass {
20422
20538
  this.isSvg = isSvg;
20423
20539
  }
20424
20540
  drawOffset(ctx, size, x, y, offset, z, cb) {
20541
+ size = this.parseSize(size);
20425
20542
  if (this.isSvg) {
20426
20543
  if (!this.svgCache) {
20427
20544
  return false;
@@ -20437,9 +20554,14 @@ class CustomSymbolClass {
20437
20554
  return false;
20438
20555
  }
20439
20556
  draw(ctx, size, x, y, z, cb) {
20557
+ size = this.parseSize(size);
20440
20558
  return this.drawOffset(ctx, size, x, y, 0, z, cb);
20441
20559
  }
20560
+ parseSize(size) {
20561
+ return isNumber(size) ? size : Math.min(size[0], size[1]);
20562
+ }
20442
20563
  bounds(size, bounds) {
20564
+ size = this.parseSize(size);
20443
20565
  if (this.isSvg) {
20444
20566
  if (!this.svgCache) {
20445
20567
  return;
@@ -21459,7 +21581,8 @@ class Paragraph {
21459
21581
  left = 0;
21460
21582
  baseline = 0;
21461
21583
  }
21462
- if (this.character.stroke) {
21584
+ const { lineWidth = 1 } = this.character;
21585
+ if (this.character.stroke && lineWidth) {
21463
21586
  applyStrokeStyle(ctx, this.character);
21464
21587
  ctx.strokeText(text, left, baseline);
21465
21588
  }
@@ -24616,6 +24739,7 @@ class Stage extends Group {
24616
24739
  constructor(params = {}) {
24617
24740
  var _a;
24618
24741
  super({});
24742
+ this.tickedBeforeRender = true;
24619
24743
  this._onVisibleChange = (visible) => {
24620
24744
  if (this._skipRender < 0) {
24621
24745
  return;
@@ -24642,6 +24766,15 @@ class Stage extends Group {
24642
24766
  this._afterRender && this._afterRender(stage);
24643
24767
  this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage));
24644
24768
  this._afterNextRenderCbs = null;
24769
+ this.tickedBeforeRender = false;
24770
+ };
24771
+ this.afterTickCb = () => {
24772
+ var _a;
24773
+ this.tickedBeforeRender = true;
24774
+ if (((_a = this.params.optimize) === null || _a === void 0 ? void 0 : _a.tickRenderMode) === 'performance') ;
24775
+ else {
24776
+ this.state !== 'rendering' && this.render();
24777
+ }
24645
24778
  };
24646
24779
  this.params = params;
24647
24780
  this.theme = new Theme();
@@ -24709,6 +24842,7 @@ class Stage extends Group {
24709
24842
  if (params.background && isString(this._background) && this._background.includes('/')) {
24710
24843
  this.setAttributes({ background: this._background });
24711
24844
  }
24845
+ this.ticker.on('afterTick', this.afterTickCb);
24712
24846
  }
24713
24847
  pauseRender(sr = -1) {
24714
24848
  this._skipRender = sr;
@@ -25022,6 +25156,9 @@ class Stage extends Group {
25022
25156
  this.timeline.resume();
25023
25157
  const state = this.state;
25024
25158
  this.state = 'rendering';
25159
+ if (!this.tickedBeforeRender) {
25160
+ this.ticker.trySyncTickStatus();
25161
+ }
25025
25162
  this.layerService.prepareStageLayer(this);
25026
25163
  if (!this._skipRender) {
25027
25164
  this.lastRenderparams = params;
@@ -25219,6 +25356,7 @@ class Stage extends Group {
25219
25356
  }
25220
25357
  this.window.release();
25221
25358
  this.ticker.remTimeline(this.timeline);
25359
+ this.ticker.removeListener('afterTick', this.afterTickCb);
25222
25360
  this.renderService.renderTreeRoots = [];
25223
25361
  }
25224
25362
  setStage(stage) {