@visactor/vrender-core 0.20.0-alpha.0 → 0.20.0-alpha.1

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 (248) hide show
  1. package/cjs/allocator/matrix-allocate.d.ts +1 -1
  2. package/cjs/allocator/matrix-allocate.js +2 -4
  3. package/cjs/allocator/matrix-allocate.js.map +1 -1
  4. package/cjs/animate/animate.js +4 -2
  5. package/cjs/animate/animate.js.map +1 -1
  6. package/cjs/animate/custom-animate.d.ts +5 -16
  7. package/cjs/animate/custom-animate.js +9 -62
  8. package/cjs/animate/custom-animate.js.map +1 -1
  9. package/cjs/animate/group-fade.d.ts +16 -0
  10. package/cjs/animate/group-fade.js +66 -0
  11. package/cjs/animate/group-fade.js.map +1 -0
  12. package/cjs/animate/index.d.ts +1 -0
  13. package/cjs/animate/index.js +2 -1
  14. package/cjs/animate/index.js.map +1 -1
  15. package/cjs/canvas/util.d.ts +0 -1
  16. package/cjs/canvas/util.js +7 -17
  17. package/cjs/canvas/util.js.map +1 -1
  18. package/cjs/common/3d-interceptor.d.ts +3 -0
  19. package/cjs/common/3d-interceptor.js +51 -0
  20. package/cjs/common/3d-interceptor.js.map +1 -0
  21. package/cjs/common/bezier-utils.js +2 -1
  22. package/cjs/common/bounds-context.js +1 -2
  23. package/cjs/common/canvas-utils.d.ts +1 -1
  24. package/cjs/common/canvas-utils.js +15 -30
  25. package/cjs/common/canvas-utils.js.map +1 -1
  26. package/cjs/common/matrix.d.ts +11 -3
  27. package/cjs/common/matrix.js +97 -19
  28. package/cjs/common/matrix.js.map +1 -1
  29. package/cjs/common/morphing-utils.js +1 -1
  30. package/cjs/common/path-svg.js +1 -1
  31. package/cjs/common/polygon.js +2 -2
  32. package/cjs/common/rect-utils.js +1 -1
  33. package/cjs/common/render-area.js +1 -1
  34. package/cjs/common/render-command-list.js +1 -1
  35. package/cjs/common/render-curve.js +23 -33
  36. package/cjs/common/render-curve.js.map +1 -1
  37. package/cjs/common/render-utils.js +2 -1
  38. package/cjs/common/seg-context.js +1 -1
  39. package/cjs/common/simplify.js +1 -1
  40. package/cjs/common/sort.js +16 -13
  41. package/cjs/common/sort.js.map +1 -1
  42. package/cjs/common/split-path.js +1 -1
  43. package/cjs/common/store.js +1 -1
  44. package/cjs/common/text.d.ts +0 -2
  45. package/cjs/common/text.js +4 -11
  46. package/cjs/common/text.js.map +1 -1
  47. package/cjs/common/utils.js +1 -1
  48. package/cjs/common/utils.js.map +1 -1
  49. package/cjs/core/application.js +1 -2
  50. package/cjs/core/camera.js +4 -4
  51. package/cjs/core/camera.js.map +1 -1
  52. package/cjs/core/constants.js +1 -1
  53. package/cjs/core/core-modules.js +1 -1
  54. package/cjs/core/global-module.js +0 -2
  55. package/cjs/core/global.js +1 -1
  56. package/cjs/core/graphic-utils.js +1 -1
  57. package/cjs/core/index.js +1 -1
  58. package/cjs/core/layer-service.js +1 -1
  59. package/cjs/core/layer.js +1 -1
  60. package/cjs/core/light.js +1 -1
  61. package/cjs/core/stage.js +15 -9
  62. package/cjs/core/stage.js.map +1 -1
  63. package/cjs/core/window.js +1 -1
  64. package/cjs/graphic/builtin-symbol/utils.js +1 -5
  65. package/cjs/graphic/builtin-symbol/utils.js.map +1 -1
  66. package/cjs/graphic/config.js +1 -0
  67. package/cjs/graphic/config.js.map +1 -1
  68. package/cjs/graphic/graphic-service/graphic-service.d.ts +2 -8
  69. package/cjs/graphic/graphic-service/graphic-service.js +17 -107
  70. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  71. package/cjs/graphic/richtext/utils.js +12 -21
  72. package/cjs/graphic/richtext/utils.js.map +1 -1
  73. package/cjs/graphic/richtext.d.ts +1 -1
  74. package/cjs/graphic/richtext.js +2 -2
  75. package/cjs/graphic/richtext.js.map +1 -1
  76. package/cjs/graphic/text.js +1 -1
  77. package/cjs/graphic/text.js.map +1 -1
  78. package/cjs/index.d.ts +1 -0
  79. package/cjs/index.js +3 -3
  80. package/cjs/index.js.map +1 -1
  81. package/cjs/interface/graphic/group.d.ts +1 -1
  82. package/cjs/interface/graphic/group.js.map +1 -1
  83. package/cjs/interface/graphic/richText.d.ts +1 -0
  84. package/cjs/interface/graphic/richText.js.map +1 -1
  85. package/cjs/picker/pick-interceptor.d.ts +1 -1
  86. package/cjs/picker/pick-interceptor.js +2 -42
  87. package/cjs/picker/pick-interceptor.js.map +1 -1
  88. package/cjs/picker/picker-service.js +4 -5
  89. package/cjs/picker/picker-service.js.map +1 -1
  90. package/cjs/plugins/builtin-plugin/edit-module.d.ts +22 -0
  91. package/cjs/plugins/builtin-plugin/edit-module.js +94 -0
  92. package/cjs/plugins/builtin-plugin/edit-module.js.map +1 -0
  93. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +1 -1
  94. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  95. package/cjs/plugins/builtin-plugin/react-attribute-plugin.d.ts +2 -1
  96. package/cjs/plugins/builtin-plugin/react-attribute-plugin.js +15 -7
  97. package/cjs/plugins/builtin-plugin/react-attribute-plugin.js.map +1 -1
  98. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.d.ts +76 -0
  99. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +338 -0
  100. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -0
  101. package/cjs/render/contributions/render/arc-render.js +1 -4
  102. package/cjs/render/contributions/render/arc-render.js.map +1 -1
  103. package/cjs/render/contributions/render/area-render.js +1 -1
  104. package/cjs/render/contributions/render/area-render.js.map +1 -1
  105. package/cjs/render/contributions/render/base-3d-render.d.ts +10 -0
  106. package/cjs/render/contributions/render/base-3d-render.js +63 -0
  107. package/cjs/render/contributions/render/base-3d-render.js.map +1 -0
  108. package/cjs/render/contributions/render/base-render.js +5 -5
  109. package/cjs/render/contributions/render/base-render.js.map +1 -1
  110. package/cjs/render/contributions/render/draw-interceptor.js +7 -51
  111. package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
  112. package/cjs/render/contributions/render/group-render.js +4 -5
  113. package/cjs/render/contributions/render/group-render.js.map +1 -1
  114. package/cjs/render/contributions/render/pyramid3d-render.d.ts +3 -5
  115. package/cjs/render/contributions/render/pyramid3d-render.js +4 -54
  116. package/cjs/render/contributions/render/pyramid3d-render.js.map +1 -1
  117. package/cjs/render/contributions/render/rect3d-render.d.ts +3 -5
  118. package/cjs/render/contributions/render/rect3d-render.js +4 -53
  119. package/cjs/render/contributions/render/rect3d-render.js.map +1 -1
  120. package/cjs/render/contributions/render/symbol-render.js +9 -18
  121. package/cjs/render/contributions/render/symbol-render.js.map +1 -1
  122. package/cjs/render/contributions/render/utils.js +2 -5
  123. package/cjs/render/contributions/render/utils.js.map +1 -1
  124. package/dist/index.es.js +1288 -978
  125. package/es/allocator/matrix-allocate.d.ts +1 -1
  126. package/es/allocator/matrix-allocate.js +3 -3
  127. package/es/allocator/matrix-allocate.js.map +1 -1
  128. package/es/animate/animate.js +4 -2
  129. package/es/animate/animate.js.map +1 -1
  130. package/es/animate/custom-animate.d.ts +5 -16
  131. package/es/animate/custom-animate.js +9 -58
  132. package/es/animate/custom-animate.js.map +1 -1
  133. package/es/animate/group-fade.d.ts +16 -0
  134. package/es/animate/group-fade.js +56 -0
  135. package/es/animate/group-fade.js.map +1 -0
  136. package/es/animate/index.d.ts +1 -0
  137. package/es/animate/index.js +2 -0
  138. package/es/animate/index.js.map +1 -1
  139. package/es/canvas/util.d.ts +0 -1
  140. package/es/canvas/util.js +7 -17
  141. package/es/canvas/util.js.map +1 -1
  142. package/es/common/3d-interceptor.d.ts +3 -0
  143. package/es/common/3d-interceptor.js +47 -0
  144. package/es/common/3d-interceptor.js.map +1 -0
  145. package/es/common/bezier-utils.js +2 -1
  146. package/es/common/bounds-context.js +1 -2
  147. package/es/common/canvas-utils.d.ts +1 -1
  148. package/es/common/canvas-utils.js +15 -30
  149. package/es/common/canvas-utils.js.map +1 -1
  150. package/es/common/matrix.d.ts +11 -3
  151. package/es/common/matrix.js +90 -17
  152. package/es/common/matrix.js.map +1 -1
  153. package/es/common/morphing-utils.js +1 -1
  154. package/es/common/path-svg.js +1 -1
  155. package/es/common/polygon.js +1 -1
  156. package/es/common/rect-utils.js +1 -1
  157. package/es/common/render-area.js +1 -1
  158. package/es/common/render-command-list.js +1 -1
  159. package/es/common/render-curve.js +23 -33
  160. package/es/common/render-curve.js.map +1 -1
  161. package/es/common/render-utils.js +2 -1
  162. package/es/common/seg-context.js +1 -1
  163. package/es/common/simplify.js +1 -1
  164. package/es/common/sort.js +16 -13
  165. package/es/common/sort.js.map +1 -1
  166. package/es/common/split-path.js +1 -1
  167. package/es/common/store.js +1 -1
  168. package/es/common/text.d.ts +0 -2
  169. package/es/common/text.js +1 -7
  170. package/es/common/text.js.map +1 -1
  171. package/es/common/utils.js +1 -1
  172. package/es/common/utils.js.map +1 -1
  173. package/es/core/application.js +1 -2
  174. package/es/core/camera.js +6 -4
  175. package/es/core/camera.js.map +1 -1
  176. package/es/core/constants.js +1 -1
  177. package/es/core/core-modules.js +1 -1
  178. package/es/core/global-module.js +0 -2
  179. package/es/core/global.js +1 -1
  180. package/es/core/graphic-utils.js +1 -1
  181. package/es/core/index.js +1 -1
  182. package/es/core/layer-service.js +1 -1
  183. package/es/core/layer.js +1 -1
  184. package/es/core/light.js +1 -1
  185. package/es/core/stage.js +15 -9
  186. package/es/core/stage.js.map +1 -1
  187. package/es/core/window.js +1 -1
  188. package/es/graphic/builtin-symbol/utils.js +1 -4
  189. package/es/graphic/builtin-symbol/utils.js.map +1 -1
  190. package/es/graphic/config.js +1 -0
  191. package/es/graphic/config.js.map +1 -1
  192. package/es/graphic/graphic-service/graphic-service.d.ts +2 -8
  193. package/es/graphic/graphic-service/graphic-service.js +9 -97
  194. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  195. package/es/graphic/richtext/utils.js +9 -20
  196. package/es/graphic/richtext/utils.js.map +1 -1
  197. package/es/graphic/richtext.d.ts +1 -1
  198. package/es/graphic/richtext.js +2 -2
  199. package/es/graphic/richtext.js.map +1 -1
  200. package/es/graphic/text.js +2 -2
  201. package/es/graphic/text.js.map +1 -1
  202. package/es/index.d.ts +1 -0
  203. package/es/index.js +2 -0
  204. package/es/index.js.map +1 -1
  205. package/es/interface/graphic/group.d.ts +1 -1
  206. package/es/interface/graphic/group.js.map +1 -1
  207. package/es/interface/graphic/richText.d.ts +1 -0
  208. package/es/interface/graphic/richText.js.map +1 -1
  209. package/es/picker/pick-interceptor.d.ts +1 -1
  210. package/es/picker/pick-interceptor.js +4 -44
  211. package/es/picker/pick-interceptor.js.map +1 -1
  212. package/es/picker/picker-service.js +1 -1
  213. package/es/picker/picker-service.js.map +1 -1
  214. package/es/plugins/builtin-plugin/edit-module.d.ts +22 -0
  215. package/es/plugins/builtin-plugin/edit-module.js +86 -0
  216. package/es/plugins/builtin-plugin/edit-module.js.map +1 -0
  217. package/es/plugins/builtin-plugin/html-attribute-plugin.js +1 -1
  218. package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  219. package/es/plugins/builtin-plugin/react-attribute-plugin.d.ts +2 -1
  220. package/es/plugins/builtin-plugin/react-attribute-plugin.js +15 -7
  221. package/es/plugins/builtin-plugin/react-attribute-plugin.js.map +1 -1
  222. package/es/plugins/builtin-plugin/richtext-edit-plugin.d.ts +76 -0
  223. package/es/plugins/builtin-plugin/richtext-edit-plugin.js +334 -0
  224. package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -0
  225. package/es/render/contributions/render/arc-render.js +1 -4
  226. package/es/render/contributions/render/arc-render.js.map +1 -1
  227. package/es/render/contributions/render/area-render.js +1 -1
  228. package/es/render/contributions/render/area-render.js.map +1 -1
  229. package/es/render/contributions/render/base-3d-render.d.ts +10 -0
  230. package/es/render/contributions/render/base-3d-render.js +57 -0
  231. package/es/render/contributions/render/base-3d-render.js.map +1 -0
  232. package/es/render/contributions/render/base-render.js +3 -1
  233. package/es/render/contributions/render/base-render.js.map +1 -1
  234. package/es/render/contributions/render/draw-interceptor.js +7 -51
  235. package/es/render/contributions/render/draw-interceptor.js.map +1 -1
  236. package/es/render/contributions/render/group-render.js +3 -1
  237. package/es/render/contributions/render/group-render.js.map +1 -1
  238. package/es/render/contributions/render/pyramid3d-render.d.ts +3 -5
  239. package/es/render/contributions/render/pyramid3d-render.js +4 -56
  240. package/es/render/contributions/render/pyramid3d-render.js.map +1 -1
  241. package/es/render/contributions/render/rect3d-render.d.ts +3 -5
  242. package/es/render/contributions/render/rect3d-render.js +4 -55
  243. package/es/render/contributions/render/rect3d-render.js.map +1 -1
  244. package/es/render/contributions/render/symbol-render.js +9 -18
  245. package/es/render/contributions/render/symbol-render.js.map +1 -1
  246. package/es/render/contributions/render/utils.js +2 -5
  247. package/es/render/contributions/render/utils.js.map +1 -1
  248. package/package.json +4 -4
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, PointService, Point, abs, max, min, atan2, Matrix, pi2, Logger, pi, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, isString, has, isUndefined, isArray, cos, sin, pointAt, isNumber, getDecimalPlaces, getAngleByPoint, isNumberClose, isNil, Bounds, getIntersectPoint, Color, DEFAULT_COLORS, normalTransform, isValidUrl, isBase64, epsilon, acos, sqrt, LRU, lowerCamelCaseToMiddle, transformBoundsWithMatrix, arrayEqual, getRectIntersect, isRectIntersect, clampAngleByRadian, asin, calculateAnchorOfBounds, styleStringToObject } from '@visactor/vutils';
1
+ import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, PointService, Point, abs, max, min, atan2, Matrix, pi2, Logger, isPointInLine, pi, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, isString, has, isUndefined, isArray, cos, sin, pointAt, isNumber, getDecimalPlaces, isValidNumber, clamp, getAngleByPoint, isNumberClose, isNil, Bounds, getIntersectPoint, Color, DEFAULT_COLORS, normalTransform, isValidUrl, isBase64, epsilon, acos, sqrt, LRU, lowerCamelCaseToMiddle, transformBoundsWithMatrix, arrayEqual, getRectIntersect, isRectIntersect, getContextFont, clampAngleByRadian, asin, merge, calculateAnchorOfBounds, styleStringToObject } from '@visactor/vutils';
2
2
 
3
3
  class Generator {
4
4
  static GenAutoIncrementId() {
@@ -2790,7 +2790,7 @@ class CustomPath2D extends CurvePath {
2790
2790
  for (let i = 0, len = commandStrList.length; i < len; ++i) {
2791
2791
  current = commandStrList[i];
2792
2792
  if (sX !== 1 || sY !== 1) {
2793
- current = scale$1(current, sX, sY);
2793
+ current = scale(current, sX, sY);
2794
2794
  }
2795
2795
  switch (current[0]) {
2796
2796
  case 'l':
@@ -3040,7 +3040,7 @@ class CustomPath2D extends CurvePath {
3040
3040
  }
3041
3041
  }
3042
3042
  const temp = ['l', 0, 0, 0, 0, 0, 0, 0];
3043
- function scale$1(current, sX, sY) {
3043
+ function scale(current, sX, sY) {
3044
3044
  const c = (temp[0] = current[0]);
3045
3045
  if (c === 'a' || c === 'A') {
3046
3046
  temp[1] = sX * current[1];
@@ -3173,7 +3173,7 @@ const DefaultRectAttribute = Object.assign(Object.assign({}, DefaultAttribute),
3173
3173
  const DefaultRect3dAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, x1: 0, y1: 0, cornerRadius: 0, length: 0 });
3174
3174
  const DefaultSymbolAttribute = Object.assign(Object.assign({}, DefaultAttribute), { symbolType: 'circle', size: 10, keepDirIn3d: true });
3175
3175
  const DefaultTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), { strokeBoundsBuffer: 0, keepDirIn3d: true });
3176
- const DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), { 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 });
3176
+ const DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), { editable: false, 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 });
3177
3177
  const DefaultImageAttribute = Object.assign(Object.assign({ repeatX: 'no-repeat', repeatY: 'no-repeat', image: '', width: 0, height: 0 }, DefaultAttribute), { fill: true, cornerRadius: 0 });
3178
3178
  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 });
3179
3179
 
@@ -3216,15 +3216,7 @@ const defaultFormatting = {
3216
3216
  const regLetter = /\w|\(|\)|-/;
3217
3217
  const regPunctuation = /[.?!,;:/,。?!、;:]/;
3218
3218
  const regFirstSpace = /\S/;
3219
- function applyFillStyle(ctx, character) {
3220
- const fillStyle = (character && character.fill) || defaultFormatting.fill;
3221
- if (!fillStyle) {
3222
- ctx.globalAlpha = 0;
3223
- return;
3224
- }
3225
- const { fillOpacity = 1, opacity = 1 } = character;
3226
- ctx.globalAlpha = fillOpacity * opacity;
3227
- ctx.fillStyle = fillStyle;
3219
+ const setTextStyle = (ctx, character) => {
3228
3220
  let fontSize = character.fontSize || 16;
3229
3221
  switch (character.script) {
3230
3222
  case 'super':
@@ -3240,6 +3232,17 @@ function applyFillStyle(ctx, character) {
3240
3232
  fontSize,
3241
3233
  fontFamily: character.fontFamily || 'sans-serif'
3242
3234
  });
3235
+ };
3236
+ function applyFillStyle(ctx, character) {
3237
+ const fillStyle = (character && character.fill) || defaultFormatting.fill;
3238
+ if (!fillStyle) {
3239
+ ctx.globalAlpha = 0;
3240
+ return;
3241
+ }
3242
+ const { fillOpacity = 1, opacity = 1 } = character;
3243
+ ctx.globalAlpha = fillOpacity * opacity;
3244
+ ctx.fillStyle = fillStyle;
3245
+ setTextStyle(ctx, character);
3243
3246
  }
3244
3247
  function applyStrokeStyle(ctx, character) {
3245
3248
  const strokeStyle = (character && character.stroke) || defaultFormatting.stroke;
@@ -3251,21 +3254,7 @@ function applyStrokeStyle(ctx, character) {
3251
3254
  ctx.globalAlpha = strokeOpacity * opacity;
3252
3255
  ctx.lineWidth = character && typeof character.lineWidth === 'number' ? character.lineWidth : 1;
3253
3256
  ctx.strokeStyle = strokeStyle;
3254
- let fontSize = character.fontSize || 16;
3255
- switch (character.script) {
3256
- case 'super':
3257
- case 'sub':
3258
- fontSize *= 0.8;
3259
- break;
3260
- }
3261
- ctx.setTextStyle({
3262
- textAlign: 'left',
3263
- textBaseline: character.textBaseline || 'alphabetic',
3264
- fontStyle: character.fontStyle || '',
3265
- fontWeight: character.fontWeight || '',
3266
- fontSize,
3267
- fontFamily: character.fontFamily || 'sans-serif'
3268
- });
3257
+ setTextStyle(ctx, character);
3269
3258
  }
3270
3259
  function getStrByWithCanvas(desc, width, character, guessIndex, needTestLetter) {
3271
3260
  if (!width || width <= 0) {
@@ -3834,21 +3823,6 @@ function normalizeRadian(angle) {
3834
3823
  }
3835
3824
  return angle;
3836
3825
  }
3837
- function windingLine(x0, y0, x1, y1, x, y) {
3838
- if ((y > y0 && y > y1) || (y < y0 && y < y1)) {
3839
- return 0;
3840
- }
3841
- if (y1 === y0) {
3842
- return 0;
3843
- }
3844
- const t = (y - y0) / (y1 - y0);
3845
- let dir = y1 < y0 ? 1 : -1;
3846
- if (t === 1 || t === 0) {
3847
- dir = y1 < y0 ? 0.5 : -0.5;
3848
- }
3849
- const x_ = t * (x1 - x0) + x0;
3850
- return x_ === x ? Infinity : x_ > x ? dir : 0;
3851
- }
3852
3826
  function containQuadStroke(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {
3853
3827
  if (lineWidth === 0) {
3854
3828
  return false;
@@ -4229,7 +4203,7 @@ function containPath(commands, lineWidth, isStroke, x, y) {
4229
4203
  const isFirst = i === 0;
4230
4204
  if (command[0] === enumCommandMap.M && i > 1) {
4231
4205
  if (!isStroke) {
4232
- w += windingLine(xi, yi, x0, y0, x, y);
4206
+ w += isPointInLine(xi, yi, x0, y0, x, y);
4233
4207
  }
4234
4208
  }
4235
4209
  if (isFirst) {
@@ -4270,7 +4244,7 @@ function containPath(commands, lineWidth, isStroke, x, y) {
4270
4244
  }
4271
4245
  }
4272
4246
  else {
4273
- w += windingLine(xi, yi, c1, c2, x, y) || 0;
4247
+ w += isPointInLine(xi, yi, c1, c2, x, y) || 0;
4274
4248
  }
4275
4249
  xi = c1;
4276
4250
  yi = c2;
@@ -4303,7 +4277,7 @@ function containPath(commands, lineWidth, isStroke, x, y) {
4303
4277
  x1 = Math.cos(theta) * c3 + c1;
4304
4278
  y1 = Math.sin(theta) * c3 + c2;
4305
4279
  if (!isFirst) {
4306
- w += windingLine(xi, yi, x1, y1, x, y);
4280
+ w += isPointInLine(xi, yi, x1, y1, x, y);
4307
4281
  }
4308
4282
  else {
4309
4283
  x0 = x1;
@@ -4334,8 +4308,8 @@ function containPath(commands, lineWidth, isStroke, x, y) {
4334
4308
  }
4335
4309
  }
4336
4310
  else {
4337
- w += windingLine(x1, y0, x1, y1, x, y);
4338
- w += windingLine(x0, y1, x0, y0, x, y);
4311
+ w += isPointInLine(x1, y0, x1, y1, x, y);
4312
+ w += isPointInLine(x0, y1, x0, y0, x, y);
4339
4313
  }
4340
4314
  break;
4341
4315
  case enumCommandMap.Z:
@@ -4345,7 +4319,7 @@ function containPath(commands, lineWidth, isStroke, x, y) {
4345
4319
  }
4346
4320
  }
4347
4321
  else {
4348
- w += windingLine(xi, yi, x0, y0, x, y);
4322
+ w += isPointInLine(xi, yi, x0, y0, x, y);
4349
4323
  }
4350
4324
  xi = x0;
4351
4325
  yi = y0;
@@ -4353,7 +4327,7 @@ function containPath(commands, lineWidth, isStroke, x, y) {
4353
4327
  }
4354
4328
  }
4355
4329
  if (!isStroke && !isAroundEqual(yi, y0)) {
4356
- w += windingLine(xi, yi, x0, y0, x, y) || 0;
4330
+ w += isPointInLine(xi, yi, x0, y0, x, y) || 0;
4357
4331
  }
4358
4332
  return w !== 0;
4359
4333
  }
@@ -7429,7 +7403,7 @@ class ACustomAnimate {
7429
7403
  return;
7430
7404
  }
7431
7405
  getEndProps() {
7432
- return;
7406
+ return this.to;
7433
7407
  }
7434
7408
  getFromProps() {
7435
7409
  return this.from;
@@ -7528,7 +7502,7 @@ class Animate {
7528
7502
  const stage = this.target.stage;
7529
7503
  stage && stage.renderNextFrame();
7530
7504
  }
7531
- if (this.subAnimates.length === 1 && this.tailAnimate.duration === customAnimate.duration) {
7505
+ if (this.subAnimates.length === 1 && this.tailAnimate.totalDuration === customAnimate.duration) {
7532
7506
  this.trySetAttribute(customAnimate.getFromProps(), customAnimate.mode);
7533
7507
  }
7534
7508
  return this;
@@ -8851,8 +8825,10 @@ class MotionPath extends ACustomAnimate {
8851
8825
  }
8852
8826
  class TagPointsUpdate extends ACustomAnimate {
8853
8827
  constructor(from, to, duration, easing, params) {
8828
+ var _a, _b;
8854
8829
  super(from, to, duration, easing, params);
8855
- this.newPointAnimateType = (params === null || params === void 0 ? void 0 : params.newPointAnimateType) === 'appear' ? 'appear' : 'grow';
8830
+ this.newPointAnimateType = (_a = params === null || params === void 0 ? void 0 : params.newPointAnimateType) !== null && _a !== void 0 ? _a : 'grow';
8831
+ this.clipRangeByDimension = (_b = params === null || params === void 0 ? void 0 : params.clipRangeByDimension) !== null && _b !== void 0 ? _b : 'x';
8856
8832
  }
8857
8833
  onBind() {
8858
8834
  var _a, _b;
@@ -8884,6 +8860,24 @@ class TagPointsUpdate extends ACustomAnimate {
8884
8860
  break;
8885
8861
  }
8886
8862
  }
8863
+ if (this.newPointAnimateType === 'clip') {
8864
+ if (this.toPoints.length !== 0) {
8865
+ if (Number.isFinite(lastMatchedIndex)) {
8866
+ this.clipRange =
8867
+ this.toPoints[lastMatchedIndex][this.clipRangeByDimension] /
8868
+ this.toPoints[this.toPoints.length - 1][this.clipRangeByDimension];
8869
+ if (!isValidNumber(this.clipRange)) {
8870
+ this.clipRange = 0;
8871
+ }
8872
+ else {
8873
+ this.clipRange = clamp(this.clipRange, 0, 1);
8874
+ }
8875
+ }
8876
+ else {
8877
+ this.clipRange = 0;
8878
+ }
8879
+ }
8880
+ }
8887
8881
  let prevMatchedPoint = this.toPoints[0];
8888
8882
  this.interpolatePoints = this.toPoints.map((point, index) => {
8889
8883
  const matchedPoint = tagMap.get(point.context);
@@ -8891,7 +8885,7 @@ class TagPointsUpdate extends ACustomAnimate {
8891
8885
  prevMatchedPoint = matchedPoint;
8892
8886
  return [matchedPoint, point];
8893
8887
  }
8894
- if (this.newPointAnimateType === 'appear') {
8888
+ if (this.newPointAnimateType === 'appear' || this.newPointAnimateType === 'clip') {
8895
8889
  return [point, point];
8896
8890
  }
8897
8891
  if (index < firstMatchedIndex && firstMatchedPoint) {
@@ -8917,6 +8911,9 @@ class TagPointsUpdate extends ACustomAnimate {
8917
8911
  newPoint.context = point.context;
8918
8912
  return newPoint;
8919
8913
  });
8914
+ if (this.clipRange) {
8915
+ out.clipRange = this.clipRange + (1 - this.clipRange) * ratio;
8916
+ }
8920
8917
  out.points = this.points;
8921
8918
  }
8922
8919
  }
@@ -9123,62 +9120,6 @@ class RotateBySphereAnimate extends ACustomAnimate {
9123
9120
  cb && cb(out);
9124
9121
  }
9125
9122
  }
9126
- class GroupFadeIn extends ACustomAnimate {
9127
- getEndProps() {
9128
- return {};
9129
- }
9130
- onBind() {
9131
- this.target.setTheme({
9132
- common: {
9133
- opacity: 0
9134
- }
9135
- });
9136
- return;
9137
- }
9138
- onEnd() {
9139
- this.target.setTheme({
9140
- common: {
9141
- opacity: 1
9142
- }
9143
- });
9144
- return;
9145
- }
9146
- onUpdate(end, ratio, out) {
9147
- this.target.setTheme({
9148
- common: {
9149
- opacity: ratio
9150
- }
9151
- });
9152
- }
9153
- }
9154
- class GroupFadeOut extends ACustomAnimate {
9155
- getEndProps() {
9156
- return {};
9157
- }
9158
- onBind() {
9159
- this.target.setTheme({
9160
- common: {
9161
- opacity: 1
9162
- }
9163
- });
9164
- return;
9165
- }
9166
- onEnd() {
9167
- this.target.setTheme({
9168
- common: {
9169
- opacity: 0
9170
- }
9171
- });
9172
- return;
9173
- }
9174
- onUpdate(end, ratio, out) {
9175
- this.target.setTheme({
9176
- common: {
9177
- opacity: 1 - ratio
9178
- }
9179
- });
9180
- }
9181
- }
9182
9123
  class AttributeAnimate extends ACustomAnimate {
9183
9124
  constructor(to, duration, easing) {
9184
9125
  super({}, to, duration, easing);
@@ -10756,6 +10697,63 @@ const multiToOneMorph = (fromGraphics, toGraphic, animationConfig) => {
10756
10697
  }
10757
10698
  };
10758
10699
 
10700
+ class GroupFadeIn extends ACustomAnimate {
10701
+ getEndProps() {
10702
+ return {};
10703
+ }
10704
+ onBind() {
10705
+ this.target.setTheme({
10706
+ common: {
10707
+ opacity: 0
10708
+ }
10709
+ });
10710
+ return;
10711
+ }
10712
+ onEnd() {
10713
+ this.target.setTheme({
10714
+ common: {
10715
+ opacity: 1
10716
+ }
10717
+ });
10718
+ return;
10719
+ }
10720
+ onUpdate(end, ratio, out) {
10721
+ this.target.setTheme({
10722
+ common: {
10723
+ opacity: ratio
10724
+ }
10725
+ });
10726
+ }
10727
+ }
10728
+ class GroupFadeOut extends ACustomAnimate {
10729
+ getEndProps() {
10730
+ return {};
10731
+ }
10732
+ onBind() {
10733
+ this.target.setTheme({
10734
+ common: {
10735
+ opacity: 1
10736
+ }
10737
+ });
10738
+ return;
10739
+ }
10740
+ onEnd() {
10741
+ this.target.setTheme({
10742
+ common: {
10743
+ opacity: 0
10744
+ }
10745
+ });
10746
+ return;
10747
+ }
10748
+ onUpdate(end, ratio, out) {
10749
+ this.target.setTheme({
10750
+ common: {
10751
+ opacity: 1 - ratio
10752
+ }
10753
+ });
10754
+ }
10755
+ }
10756
+
10759
10757
  const PARALLEL_NUMBER = 10;
10760
10758
  class ResourceLoader {
10761
10759
  static GetImage(url, mark) {
@@ -13183,9 +13181,7 @@ function drawArcPath$1(arc, context, cx, cy, outerRadius, innerRadius, partStrok
13183
13181
  const clockwise = endAngle > startAngle;
13184
13182
  let collapsedToLine = false;
13185
13183
  if (outerRadius < innerRadius) {
13186
- const temp = outerRadius;
13187
- outerRadius = innerRadius;
13188
- innerRadius = temp;
13184
+ [innerRadius, outerRadius] = [outerRadius, innerRadius];
13189
13185
  }
13190
13186
  if (outerRadius <= epsilon) {
13191
13187
  context.moveTo(cx, cy);
@@ -13558,19 +13554,6 @@ const TextRenderContribution = Symbol.for('TextRenderContribution');
13558
13554
  const CommonRenderContribution = Symbol.for('CommonRenderContribution');
13559
13555
  const InteractiveSubRenderContribution = Symbol.for('InteractiveSubRenderContribution');
13560
13556
 
13561
- function getContextFont(text, defaultAttr = {}, fontSizeScale) {
13562
- if (!fontSizeScale) {
13563
- fontSizeScale = 1;
13564
- }
13565
- const { fontStyle = defaultAttr.fontStyle, fontVariant = defaultAttr.fontVariant, fontWeight = defaultAttr.fontWeight, fontSize = defaultAttr.fontSize, fontFamily = defaultAttr.fontFamily } = text;
13566
- return ('' +
13567
- (fontStyle ? fontStyle + ' ' : '') +
13568
- (fontVariant ? fontVariant + ' ' : '') +
13569
- (fontWeight ? fontWeight + ' ' : '') +
13570
- fontSize * fontSizeScale +
13571
- 'px ' +
13572
- (fontFamily ? fontFamily : 'sans-serif'));
13573
- }
13574
13557
  function textDrawOffsetY(baseline, h) {
13575
13558
  const offset = baseline === 'top'
13576
13559
  ? Math.ceil(0.79 * h)
@@ -13661,109 +13644,7 @@ class DefaultSymbolOuterBorderBoundsContribution extends DefaultOuterBorderBound
13661
13644
  }
13662
13645
  }
13663
13646
 
13664
- const MatrixAllocate = Symbol.for('MatrixAllocate');
13665
- const Mat4Allocate = Symbol.for('Mat4Allocate');
13666
- function createMat4() {
13667
- return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
13668
- }
13669
- class DefaultMatrixAllocate {
13670
- constructor() {
13671
- this.pools = [];
13672
- }
13673
- allocate(a, b, c, d, e, f) {
13674
- if (!this.pools.length) {
13675
- return new Matrix(a, b, c, d, e, f);
13676
- }
13677
- const m = this.pools.pop();
13678
- m.a = a;
13679
- m.b = b;
13680
- m.c = c;
13681
- m.d = d;
13682
- m.e = e;
13683
- m.f = f;
13684
- return m;
13685
- }
13686
- allocateByObj(matrix) {
13687
- if (!this.pools.length) {
13688
- return new Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
13689
- }
13690
- const m = this.pools.pop();
13691
- m.a = matrix.a;
13692
- m.b = matrix.b;
13693
- m.c = matrix.c;
13694
- m.d = matrix.d;
13695
- m.e = matrix.e;
13696
- m.f = matrix.f;
13697
- return m;
13698
- }
13699
- free(d) {
13700
- this.pools.push(d);
13701
- }
13702
- get length() {
13703
- return this.pools.length;
13704
- }
13705
- release(...params) {
13706
- this.pools = [];
13707
- }
13708
- }
13709
- class DefaultMat4Allocate {
13710
- constructor() {
13711
- this.pools = [];
13712
- }
13713
- static identity(out) {
13714
- out[0] = 1;
13715
- out[1] = 0;
13716
- out[2] = 0;
13717
- out[3] = 0;
13718
- out[4] = 0;
13719
- out[5] = 1;
13720
- out[6] = 0;
13721
- out[7] = 0;
13722
- out[8] = 0;
13723
- out[9] = 0;
13724
- out[10] = 1;
13725
- out[11] = 0;
13726
- out[12] = 0;
13727
- out[13] = 0;
13728
- out[14] = 0;
13729
- out[15] = 1;
13730
- return out;
13731
- }
13732
- allocate() {
13733
- if (!this.pools.length) {
13734
- return createMat4();
13735
- }
13736
- const m = this.pools.pop();
13737
- DefaultMat4Allocate.identity(m);
13738
- return m;
13739
- }
13740
- allocateByObj(d) {
13741
- let m;
13742
- if (!this.pools.length) {
13743
- m = createMat4();
13744
- }
13745
- else {
13746
- m = this.pools.pop();
13747
- }
13748
- for (let i = 0; i < m.length; i++) {
13749
- m[i] = d[i];
13750
- }
13751
- return m;
13752
- }
13753
- free(m) {
13754
- m && this.pools.push(m);
13755
- }
13756
- get length() {
13757
- return this.pools.length;
13758
- }
13759
- release(...params) {
13760
- this.pools = [];
13761
- }
13762
- }
13763
- const matrixAllocate = new DefaultMatrixAllocate();
13764
- const mat4Allocate = new DefaultMat4Allocate();
13765
-
13766
- function identity(out) {
13647
+ function identityMat4(out) {
13767
13648
  out[0] = 1;
13768
13649
  out[1] = 0;
13769
13650
  out[2] = 0;
@@ -13998,7 +13879,7 @@ function multiplyMat4Mat3(out, a, b) {
13998
13879
  out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
13999
13880
  return out;
14000
13881
  }
14001
- function scale(out, a, v) {
13882
+ function scaleMat4(out, a, v) {
14002
13883
  const x = v[0];
14003
13884
  const y = v[1];
14004
13885
  const z = v[2];
@@ -14071,6 +13952,204 @@ function multiplyMat4Mat4(out, a, b) {
14071
13952
  out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
14072
13953
  return out;
14073
13954
  }
13955
+ function lookAt(out, eye, center, up) {
13956
+ let x0;
13957
+ let x1;
13958
+ let x2;
13959
+ let y0;
13960
+ let y1;
13961
+ let y2;
13962
+ let z0;
13963
+ let z1;
13964
+ let z2;
13965
+ let len;
13966
+ const eyex = eye[0];
13967
+ const eyey = eye[1];
13968
+ const eyez = eye[2];
13969
+ const upx = up[0];
13970
+ const upy = up[1];
13971
+ const upz = up[2];
13972
+ const centerx = center[0];
13973
+ const centery = center[1];
13974
+ const centerz = center[2];
13975
+ if (Math.abs(eyex - centerx) < epsilon && Math.abs(eyey - centery) < epsilon && Math.abs(eyez - centerz) < epsilon) {
13976
+ return identityMat4(out);
13977
+ }
13978
+ z0 = eyex - centerx;
13979
+ z1 = eyey - centery;
13980
+ z2 = eyez - centerz;
13981
+ len = 1 / Math.hypot(z0, z1, z2);
13982
+ z0 *= len;
13983
+ z1 *= len;
13984
+ z2 *= len;
13985
+ x0 = upy * z2 - upz * z1;
13986
+ x1 = upz * z0 - upx * z2;
13987
+ x2 = upx * z1 - upy * z0;
13988
+ len = Math.hypot(x0, x1, x2);
13989
+ if (!len) {
13990
+ x0 = 0;
13991
+ x1 = 0;
13992
+ x2 = 0;
13993
+ }
13994
+ else {
13995
+ len = 1 / len;
13996
+ x0 *= len;
13997
+ x1 *= len;
13998
+ x2 *= len;
13999
+ }
14000
+ y0 = z1 * x2 - z2 * x1;
14001
+ y1 = z2 * x0 - z0 * x2;
14002
+ y2 = z0 * x1 - z1 * x0;
14003
+ len = Math.hypot(y0, y1, y2);
14004
+ if (!len) {
14005
+ y0 = 0;
14006
+ y1 = 0;
14007
+ y2 = 0;
14008
+ }
14009
+ else {
14010
+ len = 1 / len;
14011
+ y0 *= len;
14012
+ y1 *= len;
14013
+ y2 *= len;
14014
+ }
14015
+ out[0] = x0;
14016
+ out[1] = y0;
14017
+ out[2] = z0;
14018
+ out[3] = 0;
14019
+ out[4] = x1;
14020
+ out[5] = y1;
14021
+ out[6] = z1;
14022
+ out[7] = 0;
14023
+ out[8] = x2;
14024
+ out[9] = y2;
14025
+ out[10] = z2;
14026
+ out[11] = 0;
14027
+ out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);
14028
+ out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);
14029
+ out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);
14030
+ out[15] = 1;
14031
+ return out;
14032
+ }
14033
+ function ortho(out, left, right, bottom, top, near, far) {
14034
+ const lr = 1 / (left - right);
14035
+ const bt = 1 / (bottom - top);
14036
+ const nf = 1 / (near - far);
14037
+ out[0] = -2 * lr;
14038
+ out[1] = 0;
14039
+ out[2] = 0;
14040
+ out[3] = 0;
14041
+ out[4] = 0;
14042
+ out[5] = -2 * bt;
14043
+ out[6] = 0;
14044
+ out[7] = 0;
14045
+ out[8] = 0;
14046
+ out[9] = 0;
14047
+ out[10] = 2 * nf;
14048
+ out[11] = 0;
14049
+ out[12] = (left + right) * lr;
14050
+ out[13] = (top + bottom) * bt;
14051
+ out[14] = (far + near) * nf;
14052
+ out[15] = 1;
14053
+ return out;
14054
+ }
14055
+ function transformMat4(out, a, m) {
14056
+ const x = a[0];
14057
+ const y = a[1];
14058
+ const z = a[2];
14059
+ let w = m[3] * x + m[7] * y + m[11] * z + m[15];
14060
+ w = w || 1.0;
14061
+ out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
14062
+ out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
14063
+ out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
14064
+ return out;
14065
+ }
14066
+
14067
+ const MatrixAllocate = Symbol.for('MatrixAllocate');
14068
+ const Mat4Allocate = Symbol.for('Mat4Allocate');
14069
+ function createMat4() {
14070
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
14071
+ }
14072
+ class DefaultMatrixAllocate {
14073
+ constructor() {
14074
+ this.pools = [];
14075
+ }
14076
+ allocate(a, b, c, d, e, f) {
14077
+ if (!this.pools.length) {
14078
+ return new Matrix(a, b, c, d, e, f);
14079
+ }
14080
+ const m = this.pools.pop();
14081
+ m.a = a;
14082
+ m.b = b;
14083
+ m.c = c;
14084
+ m.d = d;
14085
+ m.e = e;
14086
+ m.f = f;
14087
+ return m;
14088
+ }
14089
+ allocateByObj(matrix) {
14090
+ if (!this.pools.length) {
14091
+ return new Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
14092
+ }
14093
+ const m = this.pools.pop();
14094
+ m.a = matrix.a;
14095
+ m.b = matrix.b;
14096
+ m.c = matrix.c;
14097
+ m.d = matrix.d;
14098
+ m.e = matrix.e;
14099
+ m.f = matrix.f;
14100
+ return m;
14101
+ }
14102
+ free(d) {
14103
+ this.pools.push(d);
14104
+ }
14105
+ get length() {
14106
+ return this.pools.length;
14107
+ }
14108
+ release(...params) {
14109
+ this.pools = [];
14110
+ }
14111
+ }
14112
+ class DefaultMat4Allocate {
14113
+ constructor() {
14114
+ this.pools = [];
14115
+ }
14116
+ static identity(out) {
14117
+ return identityMat4(out);
14118
+ }
14119
+ allocate() {
14120
+ if (!this.pools.length) {
14121
+ return createMat4();
14122
+ }
14123
+ const m = this.pools.pop();
14124
+ DefaultMat4Allocate.identity(m);
14125
+ return m;
14126
+ }
14127
+ allocateByObj(d) {
14128
+ let m;
14129
+ if (!this.pools.length) {
14130
+ m = createMat4();
14131
+ }
14132
+ else {
14133
+ m = this.pools.pop();
14134
+ }
14135
+ for (let i = 0; i < m.length; i++) {
14136
+ m[i] = d[i];
14137
+ }
14138
+ return m;
14139
+ }
14140
+ free(m) {
14141
+ m && this.pools.push(m);
14142
+ }
14143
+ get length() {
14144
+ return this.pools.length;
14145
+ }
14146
+ release(...params) {
14147
+ this.pools = [];
14148
+ }
14149
+ }
14150
+ const matrixAllocate = new DefaultMatrixAllocate();
14151
+ const mat4Allocate = new DefaultMat4Allocate();
14152
+
14074
14153
  function getExtraModelMatrix(dx, dy, graphic) {
14075
14154
  const { alpha, beta } = graphic.attribute;
14076
14155
  if (!alpha && !beta) {
@@ -14136,13 +14215,13 @@ function getModelMatrix(out, graphic, theme) {
14136
14215
  }
14137
14216
  _anchor[2] = (_a = anchor3d[2]) !== null && _a !== void 0 ? _a : 0;
14138
14217
  }
14139
- identity(out);
14218
+ identityMat4(out);
14140
14219
  translate(out, out, [x + dx, y + dy, z + dz]);
14141
14220
  translate(out, out, [_anchor[0], _anchor[1], _anchor[2]]);
14142
14221
  rotateX(out, out, beta);
14143
14222
  rotateY(out, out, alpha);
14144
14223
  translate(out, out, [-_anchor[0], -_anchor[1], _anchor[2]]);
14145
- scale(out, out, [scaleX, scaleY, scaleZ]);
14224
+ scaleMat4(out, out, [scaleX, scaleY, scaleZ]);
14146
14225
  if (angle) {
14147
14226
  const m = mat4Allocate.allocate();
14148
14227
  const _anchor = [0, 0];
@@ -14265,7 +14344,9 @@ let DefaultGraphicService = class DefaultGraphicService {
14265
14344
  const { x1, y1, x, y } = attribute;
14266
14345
  width = width !== null && width !== void 0 ? width : x1 - x;
14267
14346
  height = height !== null && height !== void 0 ? height : y1 - y;
14268
- aabbBounds.set(0, 0, width || 0, height || 0);
14347
+ if (isFinite(width) || isFinite(height) || isFinite(x) || isFinite(y)) {
14348
+ aabbBounds.set(0, 0, width || 0, height || 0);
14349
+ }
14269
14350
  }
14270
14351
  const tb1 = this.tempAABBBounds1;
14271
14352
  const tb2 = this.tempAABBBounds2;
@@ -14283,7 +14364,7 @@ let DefaultGraphicService = class DefaultGraphicService {
14283
14364
  updateGroupAABBBounds(attribute, groupTheme, aabbBounds, graphic) {
14284
14365
  const originalAABBBounds = aabbBounds;
14285
14366
  aabbBounds = aabbBounds.clone();
14286
- const { width, height, path, clip = groupTheme.clip } = attribute;
14367
+ const { width, height, path, clip = groupTheme.clip, display } = attribute;
14287
14368
  if (path && path.length) {
14288
14369
  path.forEach(g => {
14289
14370
  aabbBounds.union(g.AABBBounds);
@@ -14521,19 +14602,23 @@ let DefaultGraphicService = class DefaultGraphicService {
14521
14602
  return aabbBounds;
14522
14603
  }
14523
14604
  updateLineAABBBoundsByPoints(attribute, lineTheme, aabbBounds, graphic) {
14524
- const { points = lineTheme.points } = attribute;
14605
+ const { points = lineTheme.points, connectedType } = attribute;
14525
14606
  const b = aabbBounds;
14526
14607
  points.forEach(p => {
14527
- b.add(p.x, p.y);
14608
+ if (p.defined !== false || connectedType === 'zero') {
14609
+ b.add(p.x, p.y);
14610
+ }
14528
14611
  });
14529
14612
  return b;
14530
14613
  }
14531
14614
  updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds, graphic) {
14532
- const { segments = lineTheme.segments } = attribute;
14615
+ const { segments = lineTheme.segments, connectedType } = attribute;
14533
14616
  const b = aabbBounds;
14534
14617
  segments.forEach(s => {
14535
14618
  s.points.forEach(p => {
14536
- b.add(p.x, p.y);
14619
+ if (p.defined !== false || connectedType === 'zero') {
14620
+ b.add(p.x, p.y);
14621
+ }
14537
14622
  });
14538
14623
  });
14539
14624
  return b;
@@ -15379,7 +15464,7 @@ function getScaledStroke(context, width, dpr) {
15379
15464
  strokeWidth = (strokeWidth / Math.abs(scaleX + scaleY)) * 2 * dpr;
15380
15465
  return strokeWidth;
15381
15466
  }
15382
- function createColor(context, c, params, offsetX, offsetY) {
15467
+ function createColor(context, c, params, offsetX = 0, offsetY = 0) {
15383
15468
  if (!c || c === true) {
15384
15469
  return 'black';
15385
15470
  }
@@ -15400,89 +15485,49 @@ function createColor(context, c, params, offsetX, offsetY) {
15400
15485
  if (typeof color === 'string') {
15401
15486
  return color;
15402
15487
  }
15403
- if (color.gradient === 'linear') {
15404
- result = createLinearGradient(context, color, params, offsetX, offsetY);
15405
- }
15406
- else if (color.gradient === 'conical') {
15407
- result = createConicGradient(context, color, params, offsetX, offsetY);
15408
- }
15409
- else if (color.gradient === 'radial') {
15410
- result = createRadialGradient(context, color, params, offsetX, offsetY);
15488
+ if (params.AABBBounds && (!params.attribute || params.attribute.scaleX !== 0 || params.attribute.scaleY !== 0)) {
15489
+ const bounds = params.AABBBounds;
15490
+ let w = bounds.x2 - bounds.x1;
15491
+ let h = bounds.y2 - bounds.y1;
15492
+ let x = bounds.x1 - offsetX;
15493
+ let y = bounds.y1 - offsetY;
15494
+ if (params.attribute) {
15495
+ const { scaleX = 1, scaleY = 1 } = params.attribute;
15496
+ w /= scaleX;
15497
+ h /= scaleY;
15498
+ x /= scaleX;
15499
+ y /= scaleY;
15500
+ }
15501
+ if (color.gradient === 'linear') {
15502
+ result = createLinearGradient(context, color, x, y, w, h);
15503
+ }
15504
+ else if (color.gradient === 'conical') {
15505
+ result = createConicGradient(context, color, x, y, w, h);
15506
+ }
15507
+ else if (color.gradient === 'radial') {
15508
+ result = createRadialGradient(context, color, x, y, w, h);
15509
+ }
15411
15510
  }
15412
15511
  return result || 'orange';
15413
15512
  }
15414
- function createLinearGradient(context, color, params, offsetX = 0, offsetY = 0) {
15513
+ function createLinearGradient(context, color, x, y, w, h) {
15415
15514
  var _a, _b, _c, _d;
15416
- const bounds = params.AABBBounds;
15417
- if (!bounds) {
15418
- return;
15419
- }
15420
- let w = bounds.x2 - bounds.x1;
15421
- let h = bounds.y2 - bounds.y1;
15422
- let x = bounds.x1 - offsetX;
15423
- let y = bounds.y1 - offsetY;
15424
- if (params.attribute) {
15425
- const { scaleX = 1, scaleY = 1 } = params.attribute;
15426
- if (scaleX * scaleY === 0) {
15427
- return;
15428
- }
15429
- w /= scaleX;
15430
- h /= scaleY;
15431
- x /= scaleX;
15432
- y /= scaleY;
15433
- }
15434
15515
  const canvasGradient = context.createLinearGradient(x + ((_a = color.x0) !== null && _a !== void 0 ? _a : 0) * w, y + ((_b = color.y0) !== null && _b !== void 0 ? _b : 0) * h, x + ((_c = color.x1) !== null && _c !== void 0 ? _c : 1) * w, y + ((_d = color.y1) !== null && _d !== void 0 ? _d : 0) * h);
15435
15516
  color.stops.forEach(stop => {
15436
15517
  canvasGradient.addColorStop(stop.offset, stop.color);
15437
15518
  });
15438
15519
  return canvasGradient;
15439
15520
  }
15440
- function createRadialGradient(context, color, params, offsetX = 0, offsetY = 0) {
15521
+ function createRadialGradient(context, color, x, y, w, h) {
15441
15522
  var _a, _b, _c, _d, _e, _f;
15442
- const bounds = params.AABBBounds;
15443
- if (!bounds) {
15444
- return;
15445
- }
15446
- let w = bounds.x2 - bounds.x1;
15447
- let h = bounds.y2 - bounds.y1;
15448
- let x = bounds.x1 - offsetX;
15449
- let y = bounds.y1 - offsetY;
15450
- if (params.attribute) {
15451
- const { scaleX = 1, scaleY = 1 } = params.attribute;
15452
- if (scaleX * scaleY === 0) {
15453
- return;
15454
- }
15455
- x /= scaleX;
15456
- y /= scaleY;
15457
- w /= scaleX;
15458
- h /= scaleY;
15459
- }
15460
15523
  const canvasGradient = context.createRadialGradient(x + ((_a = color.x0) !== null && _a !== void 0 ? _a : 0.5) * w, y + ((_b = color.y0) !== null && _b !== void 0 ? _b : 0.5) * h, Math.max(w, h) * ((_c = color.r0) !== null && _c !== void 0 ? _c : 0), x + ((_d = color.x1) !== null && _d !== void 0 ? _d : 0.5) * w, y + ((_e = color.y1) !== null && _e !== void 0 ? _e : 0.5) * h, Math.max(w, h) * ((_f = color.r1) !== null && _f !== void 0 ? _f : 0.5));
15461
15524
  color.stops.forEach(stop => {
15462
15525
  canvasGradient.addColorStop(stop.offset, stop.color);
15463
15526
  });
15464
15527
  return canvasGradient;
15465
15528
  }
15466
- function createConicGradient(context, color, params, offsetX = 0, offsetY = 0) {
15529
+ function createConicGradient(context, color, x, y, w, h) {
15467
15530
  var _a, _b;
15468
- const bounds = params.AABBBounds;
15469
- if (!bounds) {
15470
- return;
15471
- }
15472
- let w = bounds.x2 - bounds.x1;
15473
- let h = bounds.y2 - bounds.y1;
15474
- let x = bounds.x1 - offsetX;
15475
- let y = bounds.y1 - offsetY;
15476
- if (params.attribute) {
15477
- const { scaleX = 1, scaleY = 1 } = params.attribute;
15478
- if (scaleX * scaleY === 0) {
15479
- return;
15480
- }
15481
- w /= scaleX;
15482
- h /= scaleY;
15483
- x /= scaleX;
15484
- y /= scaleY;
15485
- }
15486
15531
  const canvasGradient = context.createConicGradient(x + ((_a = color.x) !== null && _a !== void 0 ? _a : 0) * w, y + ((_b = color.y) !== null && _b !== void 0 ? _b : 0) * h, color.startAngle, color.endAngle);
15487
15532
  color.stops.forEach(stop => {
15488
15533
  canvasGradient.addColorStop(stop.offset, stop.color);
@@ -16303,9 +16348,7 @@ let DefaultCanvasArcRender = class DefaultCanvasArcRender extends BaseRender {
16303
16348
  const clockwise = endAngle > startAngle;
16304
16349
  let collapsedToLine = false;
16305
16350
  if (outerRadius < innerRadius) {
16306
- const temp = outerRadius;
16307
- outerRadius = innerRadius;
16308
- innerRadius = temp;
16351
+ [innerRadius, outerRadius] = [outerRadius, innerRadius];
16309
16352
  }
16310
16353
  const cornerRadius = arc.getParsedCornerRadius();
16311
16354
  const { outerDeltaAngle, innerDeltaAngle, outerStartAngle, outerEndAngle, innerEndAngle, innerStartAngle } = arc.getParsePadAngle(startAngle, endAngle);
@@ -16588,9 +16631,45 @@ function drawSegItem(ctx, curve, endPercent, params) {
16588
16631
  }
16589
16632
  }
16590
16633
 
16591
- function drawSegments(path, segPath, percent, clipRangeByDimension, params) {
16634
+ function drawEachCurve(path, curve, lastCurve, defined0, offsetX, offsetY, offsetZ) {
16592
16635
  var _a;
16593
- const { offsetX = 0, offsetY = 0, offsetZ = 0, mode = 'none', drawConnect = false, zeroX = 0, zeroY = 0 } = params || {};
16636
+ let p0 = curve.p0;
16637
+ let newDefined0 = defined0;
16638
+ if (lastCurve && lastCurve.originP1 === lastCurve.originP2) {
16639
+ p0 = lastCurve.p0;
16640
+ }
16641
+ if (curve.defined) {
16642
+ if (!defined0) {
16643
+ path.lineTo(p0.x + offsetX, p0.y + offsetY, offsetZ);
16644
+ newDefined0 = !defined0;
16645
+ }
16646
+ }
16647
+ else {
16648
+ const { originP1, originP2 } = curve;
16649
+ let validP;
16650
+ if (originP1 && originP1.defined !== false) {
16651
+ validP = p0;
16652
+ }
16653
+ else if (originP1 && originP2.defined !== false) {
16654
+ validP = (_a = curve.p3) !== null && _a !== void 0 ? _a : curve.p1;
16655
+ }
16656
+ if (defined0) {
16657
+ newDefined0 = !defined0;
16658
+ const x = validP ? validP.x : curve.p0.x;
16659
+ const y = validP ? validP.y : curve.p0.y;
16660
+ path.moveTo(x + offsetX, y + offsetY, offsetZ);
16661
+ }
16662
+ else {
16663
+ if (validP) {
16664
+ newDefined0 = !defined0;
16665
+ path.lineTo(validP.x + offsetX, validP.y + offsetY, offsetZ);
16666
+ }
16667
+ }
16668
+ }
16669
+ return newDefined0;
16670
+ }
16671
+ function drawSegments(path, segPath, percent, clipRangeByDimension, params) {
16672
+ const { offsetX = 0, offsetY = 0, offsetZ = 0, mode = 'none', drawConnect = false } = params || {};
16594
16673
  if (drawConnect && mode === 'none') {
16595
16674
  return;
16596
16675
  }
@@ -16604,51 +16683,19 @@ function drawSegments(path, segPath, percent, clipRangeByDimension, params) {
16604
16683
  let defined0 = true;
16605
16684
  let lastCurve;
16606
16685
  curves.forEach((curve, i) => {
16607
- var _a;
16608
- let p0 = curve.p0;
16609
16686
  if (curve.originP1 === curve.originP2) {
16610
16687
  lastCurve = curve;
16611
16688
  return;
16612
16689
  }
16613
- if (lastCurve && lastCurve.originP1 === lastCurve.originP2) {
16614
- p0 = lastCurve.p0;
16615
- }
16616
- if (curve.defined) {
16617
- if (!defined0) {
16618
- path.lineTo(p0.x + offsetX, p0.y + offsetY, offsetZ);
16619
- defined0 = !defined0;
16620
- }
16621
- }
16622
- else {
16623
- const { originP1, originP2 } = curve;
16624
- let validP;
16625
- if (originP1 && originP1.defined !== false) {
16626
- validP = p0;
16627
- }
16628
- else if (originP1 && originP2.defined !== false) {
16629
- validP = (_a = curve.p3) !== null && _a !== void 0 ? _a : curve.p1;
16630
- }
16631
- if (defined0) {
16632
- defined0 = !defined0;
16633
- const x = validP ? validP.x : curve.p0.x;
16634
- const y = validP ? validP.y : curve.p0.y;
16635
- path.moveTo(x + offsetX, y + offsetY, offsetZ);
16636
- }
16637
- else {
16638
- if (validP) {
16639
- defined0 = !defined0;
16640
- path.lineTo(validP.x + offsetX, validP.y + offsetY, offsetZ);
16641
- }
16642
- }
16643
- }
16644
- lastCurve = curve;
16645
- });
16646
- }
16647
- else {
16648
- curves.forEach(curve => {
16649
- if (!curve.defined) {
16650
- needMoveTo = true;
16651
- return;
16690
+ defined0 = drawEachCurve(path, curve, lastCurve, defined0, offsetX, offsetY, offsetZ);
16691
+ lastCurve = curve;
16692
+ });
16693
+ }
16694
+ else {
16695
+ curves.forEach(curve => {
16696
+ if (!curve.defined) {
16697
+ needMoveTo = true;
16698
+ return;
16652
16699
  }
16653
16700
  if (needMoveTo) {
16654
16701
  path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ);
@@ -16686,42 +16733,11 @@ function drawSegments(path, segPath, percent, clipRangeByDimension, params) {
16686
16733
  break;
16687
16734
  }
16688
16735
  if (drawConnect) {
16689
- let p0 = curve.p0;
16690
16736
  if (curve.originP1 === curve.originP2) {
16691
16737
  lastCurve = curve;
16692
16738
  continue;
16693
16739
  }
16694
- if (lastCurve && lastCurve.originP1 === lastCurve.originP2) {
16695
- p0 = lastCurve.p0;
16696
- }
16697
- if (curve.defined) {
16698
- if (!defined0) {
16699
- path.lineTo(p0.x + offsetX, p0.y + offsetY, offsetZ);
16700
- defined0 = !defined0;
16701
- }
16702
- }
16703
- else {
16704
- const { originP1, originP2 } = curve;
16705
- let validP;
16706
- if (originP1 && originP1.defined !== false) {
16707
- validP = p0;
16708
- }
16709
- else if (originP1 && originP2.defined !== false) {
16710
- validP = (_a = curve.p3) !== null && _a !== void 0 ? _a : curve.p1;
16711
- }
16712
- if (defined0) {
16713
- defined0 = !defined0;
16714
- const x = validP ? validP.x : curve.p0.x;
16715
- const y = validP ? validP.y : curve.p0.y;
16716
- path.moveTo(x + offsetX, y + offsetY, offsetZ);
16717
- }
16718
- else {
16719
- if (validP) {
16720
- defined0 = !defined0;
16721
- path.lineTo(validP.x + offsetX, validP.y + offsetY, offsetZ);
16722
- }
16723
- }
16724
- }
16740
+ defined0 = drawEachCurve(path, curve, lastCurve, defined0, offsetX, offsetY, offsetZ);
16725
16741
  lastCurve = curve;
16726
16742
  }
16727
16743
  else {
@@ -17592,7 +17608,13 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
17592
17608
  }
17593
17609
  const xTotalLength = abs(endP.x - startP.x);
17594
17610
  const yTotalLength = abs(endP.y - startP.y);
17595
- if (!Number.isFinite(xTotalLength + yTotalLength)) {
17611
+ if (endP.x1 == null) {
17612
+ direction = Direction$1.ROW;
17613
+ }
17614
+ else if (endP.y1 == null) {
17615
+ direction = Direction$1.COLUMN;
17616
+ }
17617
+ else if (!Number.isFinite(xTotalLength + yTotalLength)) {
17596
17618
  direction = Direction$1.ROW;
17597
17619
  }
17598
17620
  else {
@@ -17827,73 +17849,46 @@ let DefaultCanvasSymbolRender = class DefaultCanvasSymbolRender extends BaseRend
17827
17849
  const { keepDirIn3d = symbolAttribute.keepDirIn3d } = symbol.attribute;
17828
17850
  const z = (_a = this.z) !== null && _a !== void 0 ? _a : 0;
17829
17851
  context.beginPath();
17852
+ const callback = (p, a) => {
17853
+ var _a, _b, _c;
17854
+ if (symbol._parsedPath.svgCache) {
17855
+ const obj = Object.assign({}, a);
17856
+ obj.fill = (_a = a.fill) !== null && _a !== void 0 ? _a : symbol.attribute.fill;
17857
+ obj.opacity = (_b = a.fill) !== null && _b !== void 0 ? _b : symbol.attribute.opacity;
17858
+ obj.fillOpacity = symbol.attribute.fillOpacity;
17859
+ obj.stroke = (_c = a.stroke) !== null && _c !== void 0 ? _c : symbol.attribute.stroke;
17860
+ a = obj;
17861
+ }
17862
+ if (a.fill) {
17863
+ if (fillCb) {
17864
+ fillCb(context, symbol.attribute, symbolAttribute);
17865
+ }
17866
+ else {
17867
+ context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute);
17868
+ context.fill();
17869
+ }
17870
+ }
17871
+ if (a.stroke) {
17872
+ if (strokeCb) {
17873
+ strokeCb(context, symbol.attribute, symbolAttribute);
17874
+ }
17875
+ else {
17876
+ context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute);
17877
+ context.stroke();
17878
+ }
17879
+ }
17880
+ };
17830
17881
  if (keepDirIn3d && context.camera && context.project) {
17831
17882
  const p = context.project(x, y, z);
17832
17883
  const camera = context.camera;
17833
17884
  context.camera = null;
17834
- if (parsedPath.draw(context, isArray(size) ? [size[0] * scaleX, size[1] * scaleY] : size * scaleX, p.x, p.y, undefined, (p, a) => {
17835
- var _a, _b, _c;
17836
- if (symbol._parsedPath.svgCache) {
17837
- const obj = Object.assign({}, a);
17838
- obj.fill = (_a = a.fill) !== null && _a !== void 0 ? _a : symbol.attribute.fill;
17839
- obj.opacity = (_b = a.fill) !== null && _b !== void 0 ? _b : symbol.attribute.opacity;
17840
- obj.fillOpacity = symbol.attribute.fillOpacity;
17841
- obj.stroke = (_c = a.stroke) !== null && _c !== void 0 ? _c : symbol.attribute.stroke;
17842
- a = obj;
17843
- }
17844
- if (a.fill) {
17845
- if (fillCb) {
17846
- fillCb(context, symbol.attribute, symbolAttribute);
17847
- }
17848
- else {
17849
- context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute);
17850
- context.fill();
17851
- }
17852
- }
17853
- if (a.stroke) {
17854
- if (strokeCb) {
17855
- strokeCb(context, symbol.attribute, symbolAttribute);
17856
- }
17857
- else {
17858
- context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute);
17859
- context.stroke();
17860
- }
17861
- }
17862
- }) === false) {
17885
+ if (parsedPath.draw(context, isArray(size) ? [size[0] * scaleX, size[1] * scaleY] : size * scaleX, p.x, p.y, undefined, callback) === false) {
17863
17886
  context.closePath();
17864
17887
  }
17865
17888
  context.camera = camera;
17866
17889
  }
17867
17890
  else {
17868
- if (parsedPath.draw(context, size, x, y, z, (p, a) => {
17869
- var _a, _b, _c;
17870
- if (symbol._parsedPath.svgCache) {
17871
- const obj = Object.assign({}, a);
17872
- obj.fill = (_a = a.fill) !== null && _a !== void 0 ? _a : symbol.attribute.fill;
17873
- obj.opacity = (_b = a.opacity) !== null && _b !== void 0 ? _b : symbol.attribute.opacity;
17874
- obj.fillOpacity = symbol.attribute.fillOpacity;
17875
- obj.stroke = (_c = a.stroke) !== null && _c !== void 0 ? _c : symbol.attribute.stroke;
17876
- a = obj;
17877
- }
17878
- if (a.fill) {
17879
- if (fillCb) {
17880
- fillCb(context, symbol.attribute, symbolAttribute);
17881
- }
17882
- else {
17883
- context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute);
17884
- context.fill();
17885
- }
17886
- }
17887
- if (a.stroke) {
17888
- if (strokeCb) {
17889
- strokeCb(context, symbol.attribute, symbolAttribute);
17890
- }
17891
- else {
17892
- context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute);
17893
- context.stroke();
17894
- }
17895
- }
17896
- }) === false) {
17891
+ if (parsedPath.draw(context, size, x, y, z, callback) === false) {
17897
17892
  context.closePath();
17898
17893
  }
17899
17894
  }
@@ -18611,6 +18606,103 @@ const ImageRender = Symbol.for('ImageRender');
18611
18606
  const RenderSelector = Symbol.for('RenderSelector');
18612
18607
  const DrawContribution = Symbol.for('DrawContribution');
18613
18608
 
18609
+ const draw3dItem = (context, graphic, callback, output) => {
18610
+ let isPie = false;
18611
+ let is3d = false;
18612
+ graphic.forEachChildren((c) => {
18613
+ isPie = c.numberType === ARC3D_NUMBER_TYPE;
18614
+ return !isPie;
18615
+ });
18616
+ graphic.forEachChildren((c) => {
18617
+ is3d = !!c.findFace;
18618
+ return !is3d;
18619
+ });
18620
+ let result;
18621
+ if (isPie) {
18622
+ const children = graphic.getChildren();
18623
+ const sortedChildren = [...children];
18624
+ sortedChildren.sort((a, b) => {
18625
+ var _a, _b, _c, _d;
18626
+ let angle1 = ((_b = (_a = a.attribute.startAngle) !== null && _a !== void 0 ? _a : 0 + a.attribute.endAngle) !== null && _b !== void 0 ? _b : 0) / 2;
18627
+ let angle2 = ((_d = (_c = b.attribute.startAngle) !== null && _c !== void 0 ? _c : 0 + b.attribute.endAngle) !== null && _d !== void 0 ? _d : 0) / 2;
18628
+ while (angle1 < 0) {
18629
+ angle1 += pi2;
18630
+ }
18631
+ while (angle2 < 0) {
18632
+ angle2 += pi2;
18633
+ }
18634
+ return angle2 - angle1;
18635
+ });
18636
+ sortedChildren.forEach(c => {
18637
+ c._next = null;
18638
+ c._prev = null;
18639
+ });
18640
+ graphic.removeAllChild();
18641
+ graphic.update();
18642
+ sortedChildren.forEach(c => {
18643
+ graphic.appendChild(c);
18644
+ });
18645
+ output.hack_pieFace = 'outside';
18646
+ result = callback(isPie, is3d);
18647
+ if (!result || !result.graphic) {
18648
+ output.hack_pieFace = 'inside';
18649
+ result = callback(isPie, is3d);
18650
+ }
18651
+ if (!result || !result.graphic) {
18652
+ output.hack_pieFace = 'top';
18653
+ result = callback(isPie, is3d);
18654
+ }
18655
+ graphic.removeAllChild();
18656
+ children.forEach(c => {
18657
+ c._next = null;
18658
+ c._prev = null;
18659
+ });
18660
+ children.forEach(c => {
18661
+ graphic.appendChild(c);
18662
+ });
18663
+ }
18664
+ else if (is3d) {
18665
+ const children = graphic.getChildren();
18666
+ const zChildren = children.map(g => {
18667
+ const face3d = g.findFace();
18668
+ const vertices = face3d.vertices;
18669
+ const viewdVerticesZ = vertices.map(v => {
18670
+ var _a;
18671
+ return context.view(v[0], v[1], (_a = v[2] + g.attribute.z) !== null && _a !== void 0 ? _a : 0)[2];
18672
+ });
18673
+ const ave_z = viewdVerticesZ.reduce((a, b) => a + b, 0);
18674
+ return {
18675
+ ave_z,
18676
+ g
18677
+ };
18678
+ });
18679
+ zChildren.sort((a, b) => b.ave_z - a.ave_z);
18680
+ graphic.removeAllChild();
18681
+ zChildren.forEach(i => {
18682
+ i.g._next = null;
18683
+ i.g._prev = null;
18684
+ });
18685
+ graphic.update();
18686
+ zChildren.forEach(i => {
18687
+ graphic.add(i.g);
18688
+ });
18689
+ result = callback(isPie, is3d);
18690
+ graphic.removeAllChild();
18691
+ children.forEach(g => {
18692
+ g._next = null;
18693
+ g._prev = null;
18694
+ });
18695
+ graphic.update();
18696
+ children.forEach(g => {
18697
+ graphic.add(g);
18698
+ });
18699
+ }
18700
+ else {
18701
+ result = callback(isPie, is3d);
18702
+ }
18703
+ return result;
18704
+ };
18705
+
18614
18706
  const DrawItemInterceptor = Symbol.for('DrawItemInterceptor');
18615
18707
  const tempDirtyBounds = new AABBBounds();
18616
18708
  const tempBackupDirtyBounds = new AABBBounds();
@@ -18619,13 +18711,25 @@ class ShadowRootDrawItemInterceptorContribution {
18619
18711
  this.order = 1;
18620
18712
  }
18621
18713
  afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
18622
- if (graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx) {
18714
+ if (graphic.attribute.shadowRootIdx == null &&
18715
+ graphic.shadowRoot &&
18716
+ graphic.shadowRoot.attribute.shadowRootIdx < 0) {
18717
+ return false;
18718
+ }
18719
+ if (graphic.attribute.shadowRootIdx > 0 ||
18720
+ !graphic.attribute.shadowRootIdx ||
18721
+ (graphic.shadowRoot && graphic.shadowRoot.attribute.shadowRootIdx > 0)) {
18623
18722
  this.drawItem(graphic, renderService, drawContext, drawContribution, params);
18624
18723
  }
18625
18724
  return false;
18626
18725
  }
18627
18726
  beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
18628
- if (graphic.attribute.shadowRootIdx < 0) {
18727
+ if (graphic.attribute.shadowRootIdx == null &&
18728
+ graphic.shadowRoot &&
18729
+ graphic.shadowRoot.attribute.shadowRootIdx > 0) {
18730
+ return false;
18731
+ }
18732
+ if (graphic.attribute.shadowRootIdx < 0 || (graphic.shadowRoot && graphic.shadowRoot.attribute.shadowRootIdx < 0)) {
18629
18733
  this.drawItem(graphic, renderService, drawContext, drawContribution, params);
18630
18734
  }
18631
18735
  return false;
@@ -18835,95 +18939,9 @@ class Canvas3DDrawItemInterceptor {
18835
18939
  }
18836
18940
  context.setTransform(1, 0, 0, 1, 0, 0, true);
18837
18941
  if (graphic.isContainer) {
18838
- let isPie = false;
18839
- let is3d = false;
18840
- graphic.forEachChildren((c) => {
18841
- isPie = c.numberType === ARC3D_NUMBER_TYPE;
18842
- return !isPie;
18843
- });
18844
- graphic.forEachChildren((c) => {
18845
- is3d = !!c.findFace;
18846
- return !is3d;
18847
- });
18848
- if (isPie) {
18849
- const children = graphic.getChildren();
18850
- const sortedChildren = [...children];
18851
- sortedChildren.sort((a, b) => {
18852
- var _a, _b, _c, _d;
18853
- let angle1 = (((_a = a.attribute.startAngle) !== null && _a !== void 0 ? _a : 0) + ((_b = a.attribute.endAngle) !== null && _b !== void 0 ? _b : 0)) / 2;
18854
- let angle2 = (((_c = b.attribute.startAngle) !== null && _c !== void 0 ? _c : 0) + ((_d = b.attribute.endAngle) !== null && _d !== void 0 ? _d : 0)) / 2;
18855
- while (angle1 < 0) {
18856
- angle1 += pi2;
18857
- }
18858
- while (angle2 < 0) {
18859
- angle2 += pi2;
18860
- }
18861
- return angle2 - angle1;
18862
- });
18863
- sortedChildren.forEach(c => {
18864
- c._next = null;
18865
- c._prev = null;
18866
- });
18867
- graphic.removeAllChild();
18868
- graphic.update();
18869
- sortedChildren.forEach(c => {
18870
- graphic.appendChild(c);
18871
- });
18872
- const m = graphic.parent.globalTransMatrix;
18873
- drawContext.hack_pieFace = 'outside';
18874
- drawContribution.renderGroup(graphic, drawContext, m);
18875
- drawContext.hack_pieFace = 'inside';
18876
- drawContribution.renderGroup(graphic, drawContext, m);
18877
- drawContext.hack_pieFace = 'top';
18878
- drawContribution.renderGroup(graphic, drawContext, m);
18879
- graphic.removeAllChild();
18880
- children.forEach(c => {
18881
- c._next = null;
18882
- c._prev = null;
18883
- });
18884
- children.forEach(c => {
18885
- graphic.appendChild(c);
18886
- });
18887
- }
18888
- else if (is3d) {
18889
- const children = graphic.getChildren();
18890
- const zChildren = children.map(g => {
18891
- const face3d = g.findFace();
18892
- const vertices = face3d.vertices;
18893
- const viewdVerticesZ = vertices.map(v => {
18894
- var _a;
18895
- return context.view(v[0], v[1], (_a = v[2] + g.attribute.z) !== null && _a !== void 0 ? _a : 0)[2];
18896
- });
18897
- const ave_z = viewdVerticesZ.reduce((a, b) => a + b, 0);
18898
- return {
18899
- ave_z,
18900
- g
18901
- };
18902
- });
18903
- zChildren.sort((a, b) => b.ave_z - a.ave_z);
18904
- graphic.removeAllChild();
18905
- zChildren.forEach(i => {
18906
- i.g._next = null;
18907
- i.g._prev = null;
18908
- });
18909
- graphic.update();
18910
- zChildren.forEach(i => {
18911
- graphic.add(i.g);
18912
- });
18913
- drawContribution.renderGroup(graphic, drawContext, graphic.parent.globalTransMatrix, true);
18914
- graphic.removeAllChild();
18915
- children.forEach(g => {
18916
- g._next = null;
18917
- g._prev = null;
18918
- });
18919
- graphic.update();
18920
- children.forEach(g => {
18921
- graphic.add(g);
18922
- });
18923
- }
18924
- else {
18925
- drawContribution.renderGroup(graphic, drawContext, graphic.parent.globalTransMatrix);
18926
- }
18942
+ draw3dItem(context, graphic, (isPie, is3d) => {
18943
+ return drawContribution.renderGroup(graphic, drawContext, graphic.parent.globalTransMatrix, !isPie && is3d);
18944
+ }, drawContext);
18927
18945
  }
18928
18946
  else {
18929
18947
  drawContribution.renderItem(graphic, drawContext);
@@ -19083,99 +19101,9 @@ let Canvas3DPickItemInterceptor = class Canvas3DPickItemInterceptor {
19083
19101
  this.initCanvasCtx(context);
19084
19102
  context.camera = stage.camera;
19085
19103
  if (graphic.isContainer) {
19086
- let isPie = false;
19087
- let is3d = false;
19088
- graphic.forEachChildren((c) => {
19089
- isPie = c.numberType === ARC3D_NUMBER_TYPE;
19090
- return !isPie;
19091
- });
19092
- graphic.forEachChildren((c) => {
19093
- is3d = !!c.findFace;
19094
- return !is3d;
19095
- });
19096
- let result;
19097
- if (isPie) {
19098
- const children = graphic.getChildren();
19099
- const sortedChildren = [...children];
19100
- sortedChildren.sort((a, b) => {
19101
- var _a, _b, _c, _d;
19102
- let angle1 = ((_b = (_a = a.attribute.startAngle) !== null && _a !== void 0 ? _a : 0 + a.attribute.endAngle) !== null && _b !== void 0 ? _b : 0) / 2;
19103
- let angle2 = ((_d = (_c = b.attribute.startAngle) !== null && _c !== void 0 ? _c : 0 + b.attribute.endAngle) !== null && _d !== void 0 ? _d : 0) / 2;
19104
- while (angle1 < 0) {
19105
- angle1 += pi2;
19106
- }
19107
- while (angle2 < 0) {
19108
- angle2 += pi2;
19109
- }
19110
- return angle2 - angle1;
19111
- });
19112
- sortedChildren.forEach(c => {
19113
- c._next = null;
19114
- c._prev = null;
19115
- });
19116
- graphic.removeAllChild();
19117
- graphic.update();
19118
- sortedChildren.forEach(c => {
19119
- graphic.appendChild(c);
19120
- });
19121
- pickParams.hack_pieFace = 'outside';
19122
- result = pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams);
19123
- if (!result.graphic) {
19124
- pickParams.hack_pieFace = 'inside';
19125
- result = pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams);
19126
- }
19127
- if (!result.graphic) {
19128
- pickParams.hack_pieFace = 'top';
19129
- result = pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams);
19130
- }
19131
- graphic.removeAllChild();
19132
- children.forEach(c => {
19133
- c._next = null;
19134
- c._prev = null;
19135
- });
19136
- children.forEach(c => {
19137
- graphic.appendChild(c);
19138
- });
19139
- }
19140
- else if (is3d) {
19141
- const children = graphic.getChildren();
19142
- const zChildren = children.map(g => {
19143
- const face3d = g.findFace();
19144
- const vertices = face3d.vertices;
19145
- const viewdVerticesZ = vertices.map(v => {
19146
- var _a;
19147
- return context.view(v[0], v[1], (_a = v[2] + g.attribute.z) !== null && _a !== void 0 ? _a : 0)[2];
19148
- });
19149
- const ave_z = viewdVerticesZ.reduce((a, b) => a + b, 0);
19150
- return {
19151
- ave_z,
19152
- g
19153
- };
19154
- });
19155
- zChildren.sort((a, b) => b.ave_z - a.ave_z);
19156
- graphic.removeAllChild();
19157
- zChildren.forEach(i => {
19158
- i.g._next = null;
19159
- i.g._prev = null;
19160
- });
19161
- graphic.update();
19162
- zChildren.forEach(i => {
19163
- graphic.add(i.g);
19164
- });
19165
- result = pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams);
19166
- graphic.removeAllChild();
19167
- children.forEach(g => {
19168
- g._next = null;
19169
- g._prev = null;
19170
- });
19171
- graphic.update();
19172
- children.forEach(g => {
19173
- graphic.add(g);
19174
- });
19175
- }
19176
- else {
19177
- result = pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams);
19178
- }
19104
+ const result = draw3dItem(context, graphic, () => {
19105
+ return pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams);
19106
+ }, pickParams);
19179
19107
  context.camera = null;
19180
19108
  pickParams.in3dInterceptor = false;
19181
19109
  context.restore();
@@ -19537,9 +19465,23 @@ function load$1(container) {
19537
19465
  container.load(layerHandlerModules);
19538
19466
  }
19539
19467
 
19540
- function foreach(graphic, defaultZIndex, cb, reverse = false, sort3d = false) {
19468
+ function parseChildMap(graphic, defaultZIndex, reverse) {
19541
19469
  const childMap = {};
19542
19470
  const zIdxArray = [];
19471
+ graphic.forEachChildren((item) => {
19472
+ const { zIndex = defaultZIndex } = item.attribute;
19473
+ if (childMap[zIndex]) {
19474
+ childMap[zIndex].push(item);
19475
+ }
19476
+ else {
19477
+ childMap[zIndex] = [item];
19478
+ zIdxArray.push(zIndex);
19479
+ }
19480
+ }, reverse);
19481
+ zIdxArray.sort((a, b) => (reverse ? b - a : a - b));
19482
+ return { childMap, zIdxArray };
19483
+ }
19484
+ function foreach(graphic, defaultZIndex, cb, reverse = false, sort3d = false) {
19543
19485
  let needSort = false;
19544
19486
  if (sort3d) {
19545
19487
  needSort = true;
@@ -19559,17 +19501,7 @@ function foreach(graphic, defaultZIndex, cb, reverse = false, sort3d = false) {
19559
19501
  }, reverse);
19560
19502
  }
19561
19503
  if (needSort) {
19562
- graphic.forEachChildren((item) => {
19563
- const { zIndex = defaultZIndex } = item.attribute;
19564
- if (childMap[zIndex]) {
19565
- childMap[zIndex].push(item);
19566
- }
19567
- else {
19568
- childMap[zIndex] = [item];
19569
- zIdxArray.push(zIndex);
19570
- }
19571
- }, reverse);
19572
- zIdxArray.sort((a, b) => (reverse ? b - a : a - b));
19504
+ const { childMap, zIdxArray } = parseChildMap(graphic, defaultZIndex, reverse);
19573
19505
  let skip = false;
19574
19506
  for (let i = 0; i < zIdxArray.length; i++) {
19575
19507
  if (skip) {
@@ -19601,8 +19533,6 @@ function foreachAsync(graphic, defaultZIndex, cb, reverse = false) {
19601
19533
  });
19602
19534
  }
19603
19535
  function findNextGraphic(graphic, id, defaultZIndex, reverse = false) {
19604
- const childMap = {};
19605
- const zIdxArray = [];
19606
19536
  let needSort = false;
19607
19537
  let lastZIndex;
19608
19538
  graphic.forEachChildren((item, i) => {
@@ -19617,17 +19547,7 @@ function findNextGraphic(graphic, id, defaultZIndex, reverse = false) {
19617
19547
  let result = null;
19618
19548
  let next = false;
19619
19549
  if (needSort) {
19620
- graphic.forEachChildren((item) => {
19621
- const { zIndex = defaultZIndex } = item.attribute;
19622
- if (childMap[zIndex]) {
19623
- childMap[zIndex].push(item);
19624
- }
19625
- else {
19626
- childMap[zIndex] = [item];
19627
- zIdxArray.push(zIndex);
19628
- }
19629
- }, reverse);
19630
- zIdxArray.sort((a, b) => (reverse ? b - a : a - b));
19550
+ const { childMap, zIdxArray } = parseChildMap(graphic, defaultZIndex, reverse);
19631
19551
  let skip = false;
19632
19552
  for (let i = 0; i < zIdxArray.length; i++) {
19633
19553
  if (skip) {
@@ -22055,19 +21975,7 @@ class CustomSymbolClass {
22055
21975
  return false;
22056
21976
  }
22057
21977
  draw(ctx, size, x, y, z, cb) {
22058
- if (this.isSvg) {
22059
- if (!this.svgCache) {
22060
- return false;
22061
- }
22062
- this.svgCache.forEach(item => {
22063
- ctx.beginPath();
22064
- renderCommandList(item.path.commandList, ctx, x, y, size, size);
22065
- cb && cb(item.path, item.attribute);
22066
- });
22067
- return false;
22068
- }
22069
- renderCommandList(this.path.commandList, ctx, x, y, size, size);
22070
- return false;
21978
+ return this.drawOffset(ctx, size, x, y, 0, z, cb);
22071
21979
  }
22072
21980
  bounds(size, bounds) {
22073
21981
  if (this.isSvg) {
@@ -23712,10 +23620,11 @@ class RichText extends Graphic {
23712
23620
  fillOpacity,
23713
23621
  strokeOpacity }, config);
23714
23622
  }
23715
- doUpdateFrameCache() {
23623
+ doUpdateFrameCache(tc) {
23716
23624
  var _a;
23717
- const { textConfig = [], maxWidth, maxHeight, width, height, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection, singleLine, disableAutoWrapLine } = this.attribute;
23625
+ const { textConfig: _tc = [], maxWidth, maxHeight, width, height, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection, singleLine, disableAutoWrapLine } = this.attribute;
23718
23626
  const paragraphs = [];
23627
+ const textConfig = tc !== null && tc !== void 0 ? tc : _tc;
23719
23628
  for (let i = 0; i < textConfig.length; i++) {
23720
23629
  if ('image' in textConfig[i]) {
23721
23630
  const config = this.combinedStyleToCharacter(textConfig[i]);
@@ -25640,6 +25549,9 @@ class Stage extends Group {
25640
25549
  throw new Error('暂不支持');
25641
25550
  }
25642
25551
  createLayer(canvasId, layerMode) {
25552
+ if (this.releaseStatus === 'released') {
25553
+ return;
25554
+ }
25643
25555
  const layer = this.layerService.createLayer(this, {
25644
25556
  main: false,
25645
25557
  layerMode,
@@ -25660,6 +25572,9 @@ class Stage extends Group {
25660
25572
  return this.removeChild(this.findChildByUid(ILayerId));
25661
25573
  }
25662
25574
  tryInitInteractiveLayer() {
25575
+ if (this.releaseStatus === 'released') {
25576
+ return;
25577
+ }
25663
25578
  if (this.supportInteractiveLayer && !this.interactiveLayer) {
25664
25579
  this.interactiveLayer = this.createLayer();
25665
25580
  this.interactiveLayer.name = '_builtin_interactive';
@@ -25671,6 +25586,9 @@ class Stage extends Group {
25671
25586
  this.window.clearViewBox(color);
25672
25587
  }
25673
25588
  render(layers, params) {
25589
+ if (this.releaseStatus === 'released') {
25590
+ return;
25591
+ }
25674
25592
  this.ticker.start();
25675
25593
  this.timeline.resume();
25676
25594
  const state = this.state;
@@ -25718,6 +25636,9 @@ class Stage extends Group {
25718
25636
  }
25719
25637
  }
25720
25638
  _doRenderInThisFrame() {
25639
+ if (this.releaseStatus === 'released') {
25640
+ return;
25641
+ }
25721
25642
  this.timeline.resume();
25722
25643
  this.ticker.start();
25723
25644
  const state = this.state;
@@ -25773,6 +25694,9 @@ class Stage extends Group {
25773
25694
  rerender && this.render();
25774
25695
  }
25775
25696
  resize(w, h, rerender = true) {
25697
+ if (this.releaseStatus === 'released') {
25698
+ return;
25699
+ }
25776
25700
  if (!this.window.hasSubView()) {
25777
25701
  this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h);
25778
25702
  }
@@ -25784,6 +25708,9 @@ class Stage extends Group {
25784
25708
  rerender && this.render();
25785
25709
  }
25786
25710
  resizeView(w, h, rerender = true) {
25711
+ if (this.releaseStatus === 'released') {
25712
+ return;
25713
+ }
25787
25714
  this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h);
25788
25715
  this.forEachChildren(c => {
25789
25716
  c.resizeView(w, h);
@@ -25823,6 +25750,9 @@ class Stage extends Group {
25823
25750
  throw new Error('暂不支持');
25824
25751
  }
25825
25752
  pick(x, y) {
25753
+ if (this.releaseStatus === 'released') {
25754
+ return;
25755
+ }
25826
25756
  if (!this.pickerService) {
25827
25757
  this.pickerService = container.get(PickerService);
25828
25758
  }
@@ -25859,6 +25789,9 @@ class Stage extends Group {
25859
25789
  return;
25860
25790
  }
25861
25791
  dirty(b, matrix) {
25792
+ if (this.releaseStatus === 'released') {
25793
+ return;
25794
+ }
25862
25795
  if (matrix) {
25863
25796
  b.transformWithMatrix(matrix);
25864
25797
  }
@@ -25872,6 +25805,9 @@ class Stage extends Group {
25872
25805
  return layer[0];
25873
25806
  }
25874
25807
  renderTo(window) {
25808
+ if (this.releaseStatus === 'released') {
25809
+ return;
25810
+ }
25875
25811
  this.forEachChildren((layer, i) => {
25876
25812
  layer.drawTo(window, {
25877
25813
  renderService: this.renderService,
@@ -25884,6 +25820,9 @@ class Stage extends Group {
25884
25820
  });
25885
25821
  }
25886
25822
  renderToNewWindow(fullImage = true, viewBox) {
25823
+ if (this.releaseStatus === 'released') {
25824
+ return;
25825
+ }
25887
25826
  const window = container.get(VWindow);
25888
25827
  const x1 = viewBox ? -viewBox.x1 : 0;
25889
25828
  const y1 = viewBox ? -viewBox.y1 : 0;
@@ -25917,6 +25856,9 @@ class Stage extends Group {
25917
25856
  return window;
25918
25857
  }
25919
25858
  toCanvas(fullImage = true, viewBox) {
25859
+ if (this.releaseStatus === 'released') {
25860
+ return;
25861
+ }
25920
25862
  const window = this.renderToNewWindow(fullImage, viewBox);
25921
25863
  const c = window.getNativeHandler();
25922
25864
  if (c.nativeCanvas) {
@@ -26515,177 +26457,14 @@ const registerDirectionalLight = () => {
26515
26457
  Factory.registerPlugin('DirectionalLight', DirectionalLight);
26516
26458
  };
26517
26459
 
26518
- function lookAt(out, eye, center, up) {
26519
- let x0;
26520
- let x1;
26521
- let x2;
26522
- let y0;
26523
- let y1;
26524
- let y2;
26525
- let z0;
26526
- let z1;
26527
- let z2;
26528
- let len;
26529
- const eyex = eye[0];
26530
- const eyey = eye[1];
26531
- const eyez = eye[2];
26532
- const upx = up[0];
26533
- const upy = up[1];
26534
- const upz = up[2];
26535
- const centerx = center[0];
26536
- const centery = center[1];
26537
- const centerz = center[2];
26538
- if (Math.abs(eyex - centerx) < epsilon && Math.abs(eyey - centery) < epsilon && Math.abs(eyez - centerz) < epsilon) {
26539
- return DefaultMat4Allocate.identity(out);
26460
+ class OrthoCamera {
26461
+ set params(params) {
26462
+ this._params = Object.assign({}, params);
26463
+ this._projectionMatrixCached = this.forceGetProjectionMatrix();
26464
+ this._viewMatrixCached = this.forceGetViewMatrix();
26540
26465
  }
26541
- z0 = eyex - centerx;
26542
- z1 = eyey - centery;
26543
- z2 = eyez - centerz;
26544
- len = 1 / Math.hypot(z0, z1, z2);
26545
- z0 *= len;
26546
- z1 *= len;
26547
- z2 *= len;
26548
- x0 = upy * z2 - upz * z1;
26549
- x1 = upz * z0 - upx * z2;
26550
- x2 = upx * z1 - upy * z0;
26551
- len = Math.hypot(x0, x1, x2);
26552
- if (!len) {
26553
- x0 = 0;
26554
- x1 = 0;
26555
- x2 = 0;
26556
- }
26557
- else {
26558
- len = 1 / len;
26559
- x0 *= len;
26560
- x1 *= len;
26561
- x2 *= len;
26562
- }
26563
- y0 = z1 * x2 - z2 * x1;
26564
- y1 = z2 * x0 - z0 * x2;
26565
- y2 = z0 * x1 - z1 * x0;
26566
- len = Math.hypot(y0, y1, y2);
26567
- if (!len) {
26568
- y0 = 0;
26569
- y1 = 0;
26570
- y2 = 0;
26571
- }
26572
- else {
26573
- len = 1 / len;
26574
- y0 *= len;
26575
- y1 *= len;
26576
- y2 *= len;
26577
- }
26578
- out[0] = x0;
26579
- out[1] = y0;
26580
- out[2] = z0;
26581
- out[3] = 0;
26582
- out[4] = x1;
26583
- out[5] = y1;
26584
- out[6] = z1;
26585
- out[7] = 0;
26586
- out[8] = x2;
26587
- out[9] = y2;
26588
- out[10] = z2;
26589
- out[11] = 0;
26590
- out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);
26591
- out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);
26592
- out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);
26593
- out[15] = 1;
26594
- return out;
26595
- }
26596
- function ortho(out, left, right, bottom, top, near, far) {
26597
- const lr = 1 / (left - right);
26598
- const bt = 1 / (bottom - top);
26599
- const nf = 1 / (near - far);
26600
- out[0] = -2 * lr;
26601
- out[1] = 0;
26602
- out[2] = 0;
26603
- out[3] = 0;
26604
- out[4] = 0;
26605
- out[5] = -2 * bt;
26606
- out[6] = 0;
26607
- out[7] = 0;
26608
- out[8] = 0;
26609
- out[9] = 0;
26610
- out[10] = 2 * nf;
26611
- out[11] = 0;
26612
- out[12] = (left + right) * lr;
26613
- out[13] = (top + bottom) * bt;
26614
- out[14] = (far + near) * nf;
26615
- out[15] = 1;
26616
- return out;
26617
- }
26618
- function multiply(out, a, b) {
26619
- const a00 = a[0];
26620
- const a01 = a[1];
26621
- const a02 = a[2];
26622
- const a03 = a[3];
26623
- const a10 = a[4];
26624
- const a11 = a[5];
26625
- const a12 = a[6];
26626
- const a13 = a[7];
26627
- const a20 = a[8];
26628
- const a21 = a[9];
26629
- const a22 = a[10];
26630
- const a23 = a[11];
26631
- const a30 = a[12];
26632
- const a31 = a[13];
26633
- const a32 = a[14];
26634
- const a33 = a[15];
26635
- let b0 = b[0];
26636
- let b1 = b[1];
26637
- let b2 = b[2];
26638
- let b3 = b[3];
26639
- out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
26640
- out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
26641
- out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
26642
- out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
26643
- b0 = b[4];
26644
- b1 = b[5];
26645
- b2 = b[6];
26646
- b3 = b[7];
26647
- out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
26648
- out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
26649
- out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
26650
- out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
26651
- b0 = b[8];
26652
- b1 = b[9];
26653
- b2 = b[10];
26654
- b3 = b[11];
26655
- out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
26656
- out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
26657
- out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
26658
- out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
26659
- b0 = b[12];
26660
- b1 = b[13];
26661
- b2 = b[14];
26662
- b3 = b[15];
26663
- out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
26664
- out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
26665
- out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
26666
- out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
26667
- return out;
26668
- }
26669
- function transformMat4(out, a, m) {
26670
- const x = a[0];
26671
- const y = a[1];
26672
- const z = a[2];
26673
- let w = m[3] * x + m[7] * y + m[11] * z + m[15];
26674
- w = w || 1.0;
26675
- out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
26676
- out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
26677
- out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
26678
- return out;
26679
- }
26680
-
26681
- class OrthoCamera {
26682
- set params(params) {
26683
- this._params = Object.assign({}, params);
26684
- this._projectionMatrixCached = this.forceGetProjectionMatrix();
26685
- this._viewMatrixCached = this.forceGetViewMatrix();
26686
- }
26687
- get params() {
26688
- return Object.assign({}, this._params);
26466
+ get params() {
26467
+ return Object.assign({}, this._params);
26689
26468
  }
26690
26469
  constructor(params) {
26691
26470
  this.params = params;
@@ -26705,7 +26484,7 @@ class OrthoCamera {
26705
26484
  if (!this._vp) {
26706
26485
  this._vp = mat4Allocate.allocate();
26707
26486
  }
26708
- this._vp = multiply(this._vp, this.getProjectionMatrix(), this.getViewMatrix());
26487
+ this._vp = multiplyMat4Mat4(this._vp, this.getProjectionMatrix(), this.getViewMatrix());
26709
26488
  return this._viewMatrixCached;
26710
26489
  }
26711
26490
  getProjectionMatrix() {
@@ -26723,7 +26502,7 @@ class OrthoCamera {
26723
26502
  if (!this._vp) {
26724
26503
  this._vp = mat4Allocate.allocate();
26725
26504
  }
26726
- this._vp = multiply(this._vp, this.getProjectionMatrix(), this.getViewMatrix());
26505
+ this._vp = multiplyMat4Mat4(this._vp, this.getProjectionMatrix(), this.getViewMatrix());
26727
26506
  return this._projectionMatrixCached;
26728
26507
  }
26729
26508
  getField() {
@@ -27117,6 +26896,594 @@ function flatten_simplify(points, tolerance, highestQuality) {
27117
26896
  return points;
27118
26897
  }
27119
26898
 
26899
+ function findCursorIndexIgnoreLinebreak(textConfig, cursorIndex) {
26900
+ let index = 0;
26901
+ for (index = 0; index < textConfig.length; index++) {
26902
+ const c = textConfig[index];
26903
+ if (!(c.text && c.text === '\n')) {
26904
+ cursorIndex--;
26905
+ }
26906
+ if (cursorIndex < 0) {
26907
+ break;
26908
+ }
26909
+ }
26910
+ return index;
26911
+ }
26912
+ class EditModule {
26913
+ constructor(container) {
26914
+ this.handleKeyDown = (e) => {
26915
+ if (e.key === 'Delete' || e.key === 'Backspace') {
26916
+ this.handleInput({ data: null, type: 'Backspace' });
26917
+ }
26918
+ };
26919
+ this.handleCompositionStart = () => {
26920
+ const { textConfig = [] } = this.currRt.attribute;
26921
+ const cursorIndex = findCursorIndexIgnoreLinebreak(textConfig, this.cursorIndex);
26922
+ const lastConfig = textConfig[cursorIndex];
26923
+ textConfig.splice(cursorIndex + 1, 0, Object.assign(Object.assign({}, lastConfig), { text: '' }));
26924
+ this.isComposing = true;
26925
+ };
26926
+ this.handleCompositionEnd = () => {
26927
+ this.isComposing = false;
26928
+ const { textConfig = [] } = this.currRt.attribute;
26929
+ const curIdx = findCursorIndexIgnoreLinebreak(textConfig, this.cursorIndex + 1);
26930
+ const lastConfig = textConfig[curIdx];
26931
+ textConfig.splice(curIdx, 1);
26932
+ const text = lastConfig.text;
26933
+ const textList = Array.from(text.toString());
26934
+ for (let i = 0; i < textList.length; i++) {
26935
+ textConfig.splice(i + curIdx, 0, Object.assign(Object.assign({}, lastConfig), { text: textList[i] }));
26936
+ }
26937
+ this.currRt.setAttributes({ textConfig });
26938
+ this.onChangeCbList.forEach(cb => {
26939
+ cb(text, this.isComposing, this.cursorIndex + textList.length, this.currRt, 'right');
26940
+ });
26941
+ };
26942
+ this.handleInput = (ev) => {
26943
+ if (!this.currRt) {
26944
+ return;
26945
+ }
26946
+ let str = ev.data;
26947
+ if (ev.type !== 'Backspace' && !str) {
26948
+ str = '\n';
26949
+ }
26950
+ const { textConfig = [] } = this.currRt.attribute;
26951
+ let startIdx = this.selectionStartCursorIdx;
26952
+ let endIdx = this.cursorIndex;
26953
+ if (startIdx > endIdx) {
26954
+ [startIdx, endIdx] = [endIdx, startIdx];
26955
+ }
26956
+ this.selectionStartCursorIdx = startIdx;
26957
+ this.cursorIndex = startIdx;
26958
+ startIdx = findCursorIndexIgnoreLinebreak(textConfig, startIdx);
26959
+ const delta = this.selectionStartCursorIdx - startIdx;
26960
+ endIdx = findCursorIndexIgnoreLinebreak(textConfig, endIdx);
26961
+ const lastConfig = textConfig[startIdx + (this.isComposing ? 1 : 0)];
26962
+ let currConfig = lastConfig;
26963
+ if (ev.type === 'Backspace' && !this.isComposing) {
26964
+ if (startIdx !== endIdx) {
26965
+ textConfig.splice(startIdx + 1, endIdx - startIdx);
26966
+ }
26967
+ else {
26968
+ textConfig.splice(startIdx, 1);
26969
+ startIdx -= 1;
26970
+ }
26971
+ }
26972
+ else {
26973
+ if (startIdx !== endIdx) {
26974
+ textConfig.splice(startIdx + 1, endIdx - startIdx);
26975
+ }
26976
+ if (!this.isComposing) {
26977
+ currConfig = Object.assign(Object.assign({}, lastConfig), { text: '' });
26978
+ startIdx += 1;
26979
+ textConfig.splice(startIdx, 0, currConfig);
26980
+ }
26981
+ currConfig.text = str;
26982
+ }
26983
+ this.currRt.setAttributes({ textConfig });
26984
+ if (!this.isComposing) {
26985
+ this.onChangeCbList.forEach(cb => {
26986
+ cb(str, this.isComposing, startIdx + delta, this.currRt, str === '\n' ? 'left' : 'right');
26987
+ });
26988
+ }
26989
+ else {
26990
+ this.onInputCbList.forEach(cb => {
26991
+ cb(str, this.isComposing, startIdx + delta, this.currRt, str === '\n' ? 'left' : 'right');
26992
+ });
26993
+ }
26994
+ };
26995
+ this.container = container !== null && container !== void 0 ? container : document.body;
26996
+ const textAreaDom = document.createElement('textarea');
26997
+ textAreaDom.autocomplete = 'off';
26998
+ textAreaDom.innerText = '';
26999
+ this.applyStyle(textAreaDom);
27000
+ this.container.append(textAreaDom);
27001
+ this.textAreaDom = textAreaDom;
27002
+ this.isComposing = false;
27003
+ this.onInputCbList = [];
27004
+ this.onChangeCbList = [];
27005
+ }
27006
+ onInput(cb) {
27007
+ this.onInputCbList.push(cb);
27008
+ }
27009
+ onChange(cb) {
27010
+ this.onChangeCbList.push(cb);
27011
+ }
27012
+ applyStyle(textAreaDom) {
27013
+ textAreaDom.setAttribute('style', `width: 100px; height: 30px; left: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;`);
27014
+ textAreaDom.addEventListener('input', this.handleInput);
27015
+ textAreaDom.addEventListener('compositionstart', this.handleCompositionStart);
27016
+ textAreaDom.addEventListener('compositionend', this.handleCompositionEnd);
27017
+ window.addEventListener('keydown', this.handleKeyDown);
27018
+ }
27019
+ moveTo(x, y, rt, cursorIndex, selectionStartCursorIdx) {
27020
+ this.textAreaDom.style.left = `${x}px`;
27021
+ this.textAreaDom.style.top = `${y}px`;
27022
+ setTimeout(() => {
27023
+ this.textAreaDom.focus();
27024
+ this.textAreaDom.setSelectionRange(0, 0);
27025
+ });
27026
+ this.currRt = rt;
27027
+ this.cursorIndex = cursorIndex;
27028
+ this.selectionStartCursorIdx = selectionStartCursorIdx;
27029
+ }
27030
+ release() {
27031
+ this.textAreaDom.removeEventListener('input', this.handleInput);
27032
+ this.textAreaDom.removeEventListener('compositionstart', this.handleCompositionStart);
27033
+ this.textAreaDom.removeEventListener('compositionend', this.handleCompositionEnd);
27034
+ window.removeEventListener('keydown', this.handleKeyDown);
27035
+ }
27036
+ }
27037
+
27038
+ class Selection {
27039
+ constructor(cacheSelectionStartCursorIdx, cacheCurCursorIdx, selectionStartCursorIdx, curCursorIdx, rt) {
27040
+ this.curCursorIdx = curCursorIdx;
27041
+ this.selectionStartCursorIdx = selectionStartCursorIdx;
27042
+ this.cacheCurCursorIdx = cacheCurCursorIdx;
27043
+ this.cacheSelectionStartCursorIdx = cacheSelectionStartCursorIdx;
27044
+ this.rt = rt;
27045
+ }
27046
+ hasFormat(key) {
27047
+ return this.getFormat(key) != null;
27048
+ }
27049
+ getFormat(key) {
27050
+ if (!this.rt) {
27051
+ return null;
27052
+ }
27053
+ const config = this.rt.attribute.textConfig;
27054
+ const val = config[this.selectionStartCursorIdx + 1][key];
27055
+ if (val == null) {
27056
+ return null;
27057
+ }
27058
+ for (let i = this.selectionStartCursorIdx + 2; i <= this.curCursorIdx; i++) {
27059
+ const item = config[i];
27060
+ if (val === item[key]) {
27061
+ continue;
27062
+ }
27063
+ return null;
27064
+ }
27065
+ return val;
27066
+ }
27067
+ getAllFormat(key) {
27068
+ if (!this.rt) {
27069
+ return [];
27070
+ }
27071
+ const config = this.rt.attribute.textConfig;
27072
+ const val = config[this.selectionStartCursorIdx + 1][key];
27073
+ const set = new Set();
27074
+ set.add(val);
27075
+ for (let i = this.selectionStartCursorIdx + 2; i <= this.curCursorIdx; i++) {
27076
+ const item = config[i];
27077
+ set.add(item[key]);
27078
+ }
27079
+ const list = Array.from(set.values());
27080
+ return list;
27081
+ }
27082
+ }
27083
+ const FORMAT_TEXT_COMMAND = 'FORMAT_TEXT_COMMAND';
27084
+ const FORMAT_ELEMENT_COMMAND = 'FORMAT_ELEMENT_COMMAND';
27085
+ class RichTextEditPlugin {
27086
+ constructor() {
27087
+ this.name = 'RichTextEditPlugin';
27088
+ this.activeEvent = 'onRegister';
27089
+ this._uid = Generator.GenAutoIncrementId();
27090
+ this.key = this.name + this._uid;
27091
+ this.editing = false;
27092
+ this.pointerDown = false;
27093
+ this.handleInput = (text, isComposing, cursorIdx, rt, orient) => {
27094
+ const p = this.getPointByColumnIdx(cursorIdx, rt, orient);
27095
+ this.hideSelection();
27096
+ this.setCursor(p.x, p.y1, p.y2);
27097
+ this.updateCbs.forEach(cb => cb('input', this));
27098
+ };
27099
+ this.handleChange = (text, isComposing, cursorIdx, rt, orient) => {
27100
+ const p = this.getPointByColumnIdx(cursorIdx, rt, orient);
27101
+ this.curCursorIdx = cursorIdx;
27102
+ this.selectionStartCursorIdx = cursorIdx;
27103
+ this.setCursorAndTextArea(p.x, p.y1, p.y2, rt);
27104
+ this.hideSelection();
27105
+ this.updateCbs.forEach(cb => cb('change', this));
27106
+ };
27107
+ this.handleMove = (e) => {
27108
+ if (!this.isRichtext(e)) {
27109
+ return;
27110
+ }
27111
+ this.currRt = e.target;
27112
+ this.handleEnter(e);
27113
+ e.target.once('pointerleave', this.handleLeave);
27114
+ this.showSelection(e);
27115
+ };
27116
+ this.handlePointerDown = (e) => {
27117
+ if (this.editing) {
27118
+ this.onFocus(e);
27119
+ }
27120
+ else {
27121
+ this.deFocus(e);
27122
+ }
27123
+ this.applyUpdate();
27124
+ this.pointerDown = true;
27125
+ this.updateCbs.forEach(cb => cb(this.editing ? 'onfocus' : 'defocus', this));
27126
+ };
27127
+ this.handlePointerUp = (e) => {
27128
+ this.pointerDown = false;
27129
+ };
27130
+ this.handleEnter = (e) => {
27131
+ this.editing = true;
27132
+ this.pluginService.stage.setCursor('text');
27133
+ };
27134
+ this.handleLeave = (e) => {
27135
+ this.editing = false;
27136
+ this.pluginService.stage.setCursor('default');
27137
+ };
27138
+ this.commandCbs = new Map();
27139
+ this.commandCbs.set(FORMAT_TEXT_COMMAND, [this.formatTextCommandCb]);
27140
+ this.updateCbs = [];
27141
+ }
27142
+ getSelection() {
27143
+ if (this.selectionStartCursorIdx &&
27144
+ this.curCursorIdx &&
27145
+ this.selectionStartCursorIdx !== this.curCursorIdx &&
27146
+ this.currRt) {
27147
+ return new Selection(this.selectionStartCursorIdx, this.curCursorIdx, findCursorIndexIgnoreLinebreak(this.currRt.attribute.textConfig, this.selectionStartCursorIdx), findCursorIndexIgnoreLinebreak(this.currRt.attribute.textConfig, this.curCursorIdx), this.currRt);
27148
+ }
27149
+ return null;
27150
+ }
27151
+ formatTextCommandCb(payload, p) {
27152
+ const rt = p.currRt;
27153
+ if (!rt) {
27154
+ return;
27155
+ }
27156
+ const selectionData = p.getSelection();
27157
+ if (!selectionData) {
27158
+ return;
27159
+ }
27160
+ const { selectionStartCursorIdx, curCursorIdx } = selectionData;
27161
+ const config = rt.attribute.textConfig.slice(selectionStartCursorIdx + 1, curCursorIdx + 1);
27162
+ if (payload === 'bold') {
27163
+ config.forEach((item) => (item.fontWeight = 'bold'));
27164
+ }
27165
+ else if (payload === 'italic') {
27166
+ config.forEach((item) => (item.fontStyle = 'italic'));
27167
+ }
27168
+ else if (payload === 'underline') {
27169
+ config.forEach((item) => (item.underline = true));
27170
+ }
27171
+ else if (payload === 'lineThrough') {
27172
+ config.forEach((item) => (item.lineThrough = true));
27173
+ }
27174
+ else if (isObject(payload)) {
27175
+ config.forEach((item) => merge(item, payload));
27176
+ }
27177
+ rt.setAttributes(rt.attribute);
27178
+ }
27179
+ dispatchCommand(command, payload) {
27180
+ const cbs = this.commandCbs.get(command);
27181
+ cbs && cbs.forEach(cb => cb(payload, this));
27182
+ this.updateCbs.forEach(cb => cb('dispatch', this));
27183
+ }
27184
+ registerCommand(command, cb) {
27185
+ const cbs = this.commandCbs.get(command) || [];
27186
+ cbs.push(cb);
27187
+ }
27188
+ registerUpdateListener(cb) {
27189
+ const cbs = this.updateCbs || [];
27190
+ cbs.push(cb);
27191
+ }
27192
+ activate(context) {
27193
+ this.pluginService = context;
27194
+ this.editModule = new EditModule();
27195
+ context.stage.on('pointermove', this.handleMove);
27196
+ context.stage.on('pointerdown', this.handlePointerDown);
27197
+ context.stage.on('pointerup', this.handlePointerUp);
27198
+ context.stage.on('pointerleave', this.handlePointerUp);
27199
+ this.editModule.onInput(this.handleInput);
27200
+ this.editModule.onChange(this.handleChange);
27201
+ }
27202
+ showSelection(e) {
27203
+ const cache = e.target.getFrameCache();
27204
+ if (!(cache && this.editBg)) {
27205
+ return;
27206
+ }
27207
+ if (this.pointerDown) {
27208
+ let p0 = this.lastPoint;
27209
+ let p1 = this.getEventPosition(e);
27210
+ let line1Info = this.getLineByPoint(cache, p1);
27211
+ const column1 = this.getColumnByLinePoint(line1Info, p1);
27212
+ const y1 = line1Info.top;
27213
+ const y2 = line1Info.top + line1Info.height;
27214
+ let x = column1.left + column1.width;
27215
+ let cursorIndex = this.getColumnIndex(cache, column1);
27216
+ if (p1.x < column1.left + column1.width / 2) {
27217
+ x = column1.left;
27218
+ cursorIndex -= 1;
27219
+ }
27220
+ p1.x = x;
27221
+ p1.y = (y1 + y2) / 2;
27222
+ let line0Info = this.getLineByPoint(cache, p0);
27223
+ if (p0.y > p1.y || (p0.y === p1.y && p0.x > p1.x)) {
27224
+ [p0, p1] = [p1, p0];
27225
+ [line1Info, line0Info] = [line0Info, line1Info];
27226
+ }
27227
+ this.editBg.removeAllChild();
27228
+ if (line0Info === line1Info) {
27229
+ const column0 = this.getColumnByLinePoint(line0Info, p0);
27230
+ this.editBg.setAttributes({
27231
+ x: p0.x,
27232
+ y: line0Info.top,
27233
+ width: p1.x - p0.x,
27234
+ height: column0.height,
27235
+ fill: '#336df4',
27236
+ fillOpacity: 0.2
27237
+ });
27238
+ }
27239
+ else {
27240
+ this.editBg.setAttributes({ x: 0, y: line0Info.top, width: 0, height: 0 });
27241
+ const startIdx = cache.lines.findIndex(item => item === line0Info);
27242
+ const endIdx = cache.lines.findIndex(item => item === line1Info);
27243
+ let y = 0;
27244
+ for (let i = startIdx; i <= endIdx; i++) {
27245
+ const line = cache.lines[i];
27246
+ if (i === startIdx) {
27247
+ const p = line.paragraphs[line.paragraphs.length - 1];
27248
+ this.editBg.add(createRect({
27249
+ x: p0.x,
27250
+ y,
27251
+ width: p.left + p.width - p0.x,
27252
+ height: line.height,
27253
+ fill: '#336df4',
27254
+ fillOpacity: 0.2
27255
+ }));
27256
+ }
27257
+ else if (i === endIdx) {
27258
+ const p = line.paragraphs[0];
27259
+ this.editBg.add(createRect({
27260
+ x: p.left,
27261
+ y,
27262
+ width: p1.x - p.left,
27263
+ height: line.height,
27264
+ fill: '#336df4',
27265
+ fillOpacity: 0.2
27266
+ }));
27267
+ }
27268
+ else {
27269
+ const p0 = line.paragraphs[0];
27270
+ const p1 = line.paragraphs[line.paragraphs.length - 1];
27271
+ this.editBg.add(createRect({
27272
+ x: p0.left,
27273
+ y,
27274
+ width: p1.left + p1.width - p0.left,
27275
+ height: line.height,
27276
+ fill: '#336df4',
27277
+ fillOpacity: 0.2
27278
+ }));
27279
+ }
27280
+ y += line.height;
27281
+ }
27282
+ }
27283
+ this.curCursorIdx = cursorIndex;
27284
+ this.setCursorAndTextArea(x, y1 + 2, y2 - 2, e.target);
27285
+ this.applyUpdate();
27286
+ this.updateCbs.forEach(cb => cb('selection', this));
27287
+ }
27288
+ }
27289
+ hideSelection() {
27290
+ if (this.editBg) {
27291
+ this.editBg.removeAllChild();
27292
+ this.editBg.setAttributes({ fill: 'transparent' });
27293
+ }
27294
+ }
27295
+ isRichtext(e) {
27296
+ return !!(e.target && e.target.type === 'richtext' && e.target.attribute.editable);
27297
+ }
27298
+ getEventPosition(e) {
27299
+ const p = this.pluginService.stage.eventPointTransform(e);
27300
+ const p1 = { x: 0, y: 0 };
27301
+ e.target.globalTransMatrix.transformPoint(p, p1);
27302
+ return p1;
27303
+ }
27304
+ getLineByPoint(cache, p1) {
27305
+ let lineInfo = cache.lines[0];
27306
+ for (let i = 0; i < cache.lines.length; i++) {
27307
+ if (lineInfo.top <= p1.y && lineInfo.top + lineInfo.height >= p1.y) {
27308
+ break;
27309
+ }
27310
+ lineInfo = cache.lines[i + 1];
27311
+ }
27312
+ return lineInfo;
27313
+ }
27314
+ getColumnByLinePoint(lineInfo, p1) {
27315
+ let columnInfo = lineInfo.paragraphs[0];
27316
+ for (let i = 0; i < lineInfo.paragraphs.length; i++) {
27317
+ if (columnInfo.left <= p1.x && columnInfo.left + columnInfo.width >= p1.x) {
27318
+ break;
27319
+ }
27320
+ columnInfo = lineInfo.paragraphs[i];
27321
+ }
27322
+ return columnInfo;
27323
+ }
27324
+ onFocus(e) {
27325
+ this.deFocus(e);
27326
+ const target = e.target;
27327
+ this.tryUpdateRichtext(target);
27328
+ const shadowRoot = target.attachShadow();
27329
+ shadowRoot.setAttributes({ shadowRootIdx: -1 });
27330
+ const cache = target.getFrameCache();
27331
+ if (!cache) {
27332
+ return;
27333
+ }
27334
+ if (!this.editLine) {
27335
+ const line = createLine({ x: 0, y: 0, lineWidth: 1, stroke: 'black' });
27336
+ line
27337
+ .animate()
27338
+ .to({ opacity: 1 }, 10, 'linear')
27339
+ .wait(700)
27340
+ .to({ opacity: 0 }, 10, 'linear')
27341
+ .wait(700)
27342
+ .loop(Infinity);
27343
+ this.editLine = line;
27344
+ const g = createGroup({ x: 0, y: 0, width: 0, height: 0 });
27345
+ this.editBg = g;
27346
+ shadowRoot.add(this.editLine);
27347
+ shadowRoot.add(this.editBg);
27348
+ }
27349
+ const p1 = this.getEventPosition(e);
27350
+ const lineInfo = this.getLineByPoint(cache, p1);
27351
+ if (lineInfo) {
27352
+ const columnInfo = this.getColumnByLinePoint(lineInfo, p1);
27353
+ if (!columnInfo) {
27354
+ return;
27355
+ }
27356
+ let y1 = lineInfo.top;
27357
+ let y2 = lineInfo.top + lineInfo.height;
27358
+ let x = columnInfo.left + columnInfo.width;
27359
+ y1 += 2;
27360
+ y2 -= 2;
27361
+ let cursorIndex = this.getColumnIndex(cache, columnInfo);
27362
+ if (p1.x < columnInfo.left + columnInfo.width / 2) {
27363
+ x = columnInfo.left;
27364
+ cursorIndex -= 1;
27365
+ }
27366
+ this.lastPoint = { x, y: (y1 + y2) / 2 };
27367
+ this.curCursorIdx = cursorIndex;
27368
+ this.selectionStartCursorIdx = cursorIndex;
27369
+ this.setCursorAndTextArea(x, y1, y2, target);
27370
+ }
27371
+ }
27372
+ getPointByColumnIdx(idx, rt, orient) {
27373
+ const cache = rt.getFrameCache();
27374
+ const { lineInfo, columnInfo } = this.getColumnByIndex(cache, idx);
27375
+ let y1 = lineInfo.top;
27376
+ let y2 = lineInfo.top + lineInfo.height;
27377
+ const x = columnInfo.left + (orient === 'left' ? 0 : columnInfo.width);
27378
+ y1 += 2;
27379
+ y2 -= 2;
27380
+ return { x, y1, y2 };
27381
+ }
27382
+ getColumnIndex(cache, cInfo) {
27383
+ let inputIndex = -1;
27384
+ for (let i = 0; i < cache.lines.length; i++) {
27385
+ const line = cache.lines[i];
27386
+ for (let j = 0; j < line.paragraphs.length; j++) {
27387
+ inputIndex++;
27388
+ if (cInfo === line.paragraphs[j]) {
27389
+ return inputIndex;
27390
+ }
27391
+ }
27392
+ }
27393
+ return -1;
27394
+ }
27395
+ getColumnByIndex(cache, index) {
27396
+ let inputIndex = -1;
27397
+ for (let i = 0; i < cache.lines.length; i++) {
27398
+ const lineInfo = cache.lines[i];
27399
+ for (let j = 0; j < lineInfo.paragraphs.length; j++) {
27400
+ const columnInfo = lineInfo.paragraphs[j];
27401
+ inputIndex++;
27402
+ if (inputIndex === index) {
27403
+ return {
27404
+ lineInfo,
27405
+ columnInfo
27406
+ };
27407
+ }
27408
+ }
27409
+ }
27410
+ return null;
27411
+ }
27412
+ setCursorAndTextArea(x, y1, y2, rt) {
27413
+ this.editLine.setAttributes({
27414
+ points: [
27415
+ { x, y: y1 },
27416
+ { x, y: y2 }
27417
+ ]
27418
+ });
27419
+ const out = { x: 0, y: 0 };
27420
+ rt.globalTransMatrix.getInverse().transformPoint({ x, y: y1 }, out);
27421
+ const { left, top } = this.pluginService.stage.window.getBoundingClientRect();
27422
+ out.x += left;
27423
+ out.y += top;
27424
+ this.editModule.moveTo(out.x, out.y, rt, this.curCursorIdx, this.selectionStartCursorIdx);
27425
+ }
27426
+ setCursor(x, y1, y2) {
27427
+ this.editLine.setAttributes({
27428
+ points: [
27429
+ { x, y: y1 },
27430
+ { x, y: y2 }
27431
+ ]
27432
+ });
27433
+ }
27434
+ applyUpdate() {
27435
+ this.pluginService.stage.renderNextFrame();
27436
+ }
27437
+ deFocus(e) {
27438
+ const target = e.target;
27439
+ target.detachShadow();
27440
+ this.currRt = null;
27441
+ if (this.editLine) {
27442
+ this.editLine.parent.removeChild(this.editLine);
27443
+ this.editLine.release();
27444
+ this.editLine = null;
27445
+ this.editBg.parent.removeChild(this.editBg);
27446
+ this.editBg.release();
27447
+ this.editBg = null;
27448
+ }
27449
+ }
27450
+ splitText(text) {
27451
+ return Array.from(text);
27452
+ }
27453
+ tryUpdateRichtext(richtext) {
27454
+ const cache = richtext.getFrameCache();
27455
+ if (!cache.lines.every(line => line.paragraphs.every(item => !(item.text && isString(item.text) && this.splitText(item.text).length > 1)))) {
27456
+ const tc = [];
27457
+ richtext.attribute.textConfig.forEach((item) => {
27458
+ const textList = this.splitText(item.text.toString());
27459
+ if (isString(item.text) && textList.length > 1) {
27460
+ for (let i = 0; i < textList.length; i++) {
27461
+ const t = textList[i];
27462
+ tc.push(Object.assign(Object.assign({}, item), { text: t }));
27463
+ }
27464
+ }
27465
+ else {
27466
+ tc.push(item);
27467
+ }
27468
+ });
27469
+ richtext.setAttributes({ textConfig: tc });
27470
+ richtext.doUpdateFrameCache(tc);
27471
+ }
27472
+ }
27473
+ onSelect() {
27474
+ return;
27475
+ }
27476
+ deactivate(context) {
27477
+ context.stage.off('pointermove', this.handleMove);
27478
+ context.stage.off('pointerdown', this.handlePointerDown);
27479
+ context.stage.off('pointerup', this.handlePointerUp);
27480
+ context.stage.off('pointerleave', this.handlePointerUp);
27481
+ }
27482
+ release() {
27483
+ this.editModule.release();
27484
+ }
27485
+ }
27486
+
27120
27487
  class DefaultGraphicAllocate {
27121
27488
  constructor() {
27122
27489
  this.pools = [];
@@ -27567,48 +27934,7 @@ const imageModule = new ContainerModule(bind => {
27567
27934
  bindContributionProvider(bind, ImageRenderContribution);
27568
27935
  });
27569
27936
 
27570
- let DefaultCanvasRect3dRender = class DefaultCanvasRect3dRender extends BaseRender {
27571
- constructor() {
27572
- super(...arguments);
27573
- this.type = 'rect3d';
27574
- this.numberType = RECT3D_NUMBER_TYPE;
27575
- }
27576
- drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
27577
- var _a;
27578
- const rectAttribute = getTheme(rect, params === null || params === void 0 ? void 0 : params.theme).rect;
27579
- const { fill = rectAttribute.fill, stroke = rectAttribute.stroke, x1, y1, x: originX, y: originY, opacity = rectAttribute.opacity, fillOpacity = rectAttribute.fillOpacity, lineWidth = rectAttribute.lineWidth, strokeOpacity = rectAttribute.strokeOpacity, visible = rectAttribute.visible } = rect.attribute;
27580
- let { width, height } = rect.attribute;
27581
- width = (width !== null && width !== void 0 ? width : x1 - originX) || 0;
27582
- height = (height !== null && height !== void 0 ? height : y1 - originY) || 0;
27583
- const z = (_a = this.z) !== null && _a !== void 0 ? _a : 0;
27584
- const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill);
27585
- const sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height);
27586
- const doFill = runFill(fill);
27587
- const doStroke = runStroke(stroke, lineWidth);
27588
- if (!(rect.valid && visible)) {
27589
- return;
27590
- }
27591
- if (!(doFill || doStroke)) {
27592
- return;
27593
- }
27594
- if (!(fVisible || sVisible || fillCb || strokeCb)) {
27595
- return;
27596
- }
27597
- const { light, camera } = drawContext.stage || {};
27598
- const face3d = rect.findFace();
27599
- if (fill !== false) {
27600
- context.setCommonStyle(rect, rect.attribute, x, y, rectAttribute);
27601
- let fc = fill;
27602
- if (typeof fc !== 'string') {
27603
- fc = 'black';
27604
- }
27605
- this.fill(x, y, z, face3d, fc, context, light, fillCb);
27606
- }
27607
- if (stroke !== false) {
27608
- context.setStrokeStyle(rect, rect.attribute, x, y, rectAttribute);
27609
- this.stroke(x, y, z, face3d, context);
27610
- }
27611
- }
27937
+ class Base3dRender extends BaseRender {
27612
27938
  stroke(x, y, z, face3d, context) {
27613
27939
  const vertices = face3d.vertices;
27614
27940
  face3d.edges.forEach(edge => {
@@ -27630,7 +27956,7 @@ let DefaultCanvasRect3dRender = class DefaultCanvasRect3dRender extends BaseRend
27630
27956
  context.stroke();
27631
27957
  });
27632
27958
  }
27633
- fill(x, y, z, face3d, fillColor, context, light, fillCb) {
27959
+ fill(x, y, z, face3d, faces, fillColor, context, light, graphic3d, graphic3dAttribute, fillCb) {
27634
27960
  const rgbArray = ColorStore.Get(fillColor, ColorType.Color255);
27635
27961
  const vertices = face3d.vertices;
27636
27962
  const viewdVerticesZ = vertices.map(v => {
@@ -27638,11 +27964,14 @@ let DefaultCanvasRect3dRender = class DefaultCanvasRect3dRender extends BaseRend
27638
27964
  });
27639
27965
  const sortFace = [];
27640
27966
  face3d.polygons.forEach((p, i) => {
27967
+ if (faces && !faces[i]) {
27968
+ return;
27969
+ }
27641
27970
  sortFace.push({
27642
27971
  faceIdx: i,
27643
27972
  polygon: p
27644
27973
  });
27645
- const { polygon, normal } = p;
27974
+ const { polygon } = p;
27646
27975
  const z1 = viewdVerticesZ[polygon[0]];
27647
27976
  const z2 = viewdVerticesZ[polygon[1]];
27648
27977
  const z3 = viewdVerticesZ[polygon[2]];
@@ -27683,7 +28012,7 @@ let DefaultCanvasRect3dRender = class DefaultCanvasRect3dRender extends BaseRend
27683
28012
  context.lineTo(v4.x, v4.y, v4.z);
27684
28013
  context.closePath();
27685
28014
  if (fillCb) {
27686
- fillCb(context, null, null);
28015
+ fillCb(context, graphic3d && graphic3d.attribute, graphic3dAttribute);
27687
28016
  }
27688
28017
  else {
27689
28018
  context.fillStyle = light ? light.computeColor(normal, rgbArray) : fillColor;
@@ -27691,6 +28020,50 @@ let DefaultCanvasRect3dRender = class DefaultCanvasRect3dRender extends BaseRend
27691
28020
  }
27692
28021
  });
27693
28022
  }
28023
+ }
28024
+
28025
+ let DefaultCanvasRect3dRender = class DefaultCanvasRect3dRender extends Base3dRender {
28026
+ constructor() {
28027
+ super(...arguments);
28028
+ this.type = 'rect3d';
28029
+ this.numberType = RECT3D_NUMBER_TYPE;
28030
+ }
28031
+ drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
28032
+ var _a;
28033
+ const rectAttribute = getTheme(rect, params === null || params === void 0 ? void 0 : params.theme).rect;
28034
+ const { fill = rectAttribute.fill, stroke = rectAttribute.stroke, x1, y1, x: originX, y: originY, opacity = rectAttribute.opacity, fillOpacity = rectAttribute.fillOpacity, lineWidth = rectAttribute.lineWidth, strokeOpacity = rectAttribute.strokeOpacity, visible = rectAttribute.visible } = rect.attribute;
28035
+ let { width, height } = rect.attribute;
28036
+ width = (width !== null && width !== void 0 ? width : x1 - originX) || 0;
28037
+ height = (height !== null && height !== void 0 ? height : y1 - originY) || 0;
28038
+ const z = (_a = this.z) !== null && _a !== void 0 ? _a : 0;
28039
+ const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill);
28040
+ const sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height);
28041
+ const doFill = runFill(fill);
28042
+ const doStroke = runStroke(stroke, lineWidth);
28043
+ if (!(rect.valid && visible)) {
28044
+ return;
28045
+ }
28046
+ if (!(doFill || doStroke)) {
28047
+ return;
28048
+ }
28049
+ if (!(fVisible || sVisible || fillCb || strokeCb)) {
28050
+ return;
28051
+ }
28052
+ const { light } = drawContext.stage || {};
28053
+ const face3d = rect.findFace();
28054
+ if (fill !== false) {
28055
+ context.setCommonStyle(rect, rect.attribute, x, y, rectAttribute);
28056
+ let fc = fill;
28057
+ if (typeof fc !== 'string') {
28058
+ fc = 'black';
28059
+ }
28060
+ this.fill(x, y, z, face3d, null, fc, context, light, null, null, fillCb);
28061
+ }
28062
+ if (stroke !== false) {
28063
+ context.setStrokeStyle(rect, rect.attribute, x, y, rectAttribute);
28064
+ this.stroke(x, y, z, face3d, context);
28065
+ }
28066
+ }
27694
28067
  draw(rect, renderService, drawContext) {
27695
28068
  const rectAttribute = getTheme(rect).rect;
27696
28069
  this._draw(rect, rectAttribute, false, drawContext);
@@ -27912,7 +28285,7 @@ const arc3dModule = new ContainerModule(bind => {
27912
28285
  bind(GraphicRender).toService(Arc3dRender);
27913
28286
  });
27914
28287
 
27915
- let DefaultCanvasPyramid3dRender = class DefaultCanvasPyramid3dRender extends BaseRender {
28288
+ let DefaultCanvasPyramid3dRender = class DefaultCanvasPyramid3dRender extends Base3dRender {
27916
28289
  constructor() {
27917
28290
  super(...arguments);
27918
28291
  this.type = 'pyramid3d';
@@ -27927,7 +28300,7 @@ let DefaultCanvasPyramid3dRender = class DefaultCanvasPyramid3dRender extends Ba
27927
28300
  if (!data) {
27928
28301
  return;
27929
28302
  }
27930
- const { light, camera } = drawContext.stage || {};
28303
+ const { light } = drawContext.stage || {};
27931
28304
  const face3d = pyramid3d.findFace();
27932
28305
  if (fill !== false) {
27933
28306
  context.setCommonStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute);
@@ -27935,98 +28308,13 @@ let DefaultCanvasPyramid3dRender = class DefaultCanvasPyramid3dRender extends Ba
27935
28308
  if (typeof fc !== 'string') {
27936
28309
  fc = 'black';
27937
28310
  }
27938
- this.fill(x, y, z, face3d, face, fc, context, light, camera, pyramid3d, pyramidAttribute, fillCb);
28311
+ this.fill(x, y, z, face3d, face, fc, context, light, pyramid3d, pyramidAttribute, fillCb);
27939
28312
  }
27940
28313
  if (stroke !== false) {
27941
28314
  context.setStrokeStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute);
27942
28315
  this.stroke(x, y, z, face3d, context);
27943
28316
  }
27944
28317
  }
27945
- stroke(x, y, z, face3d, context) {
27946
- const vertices = face3d.vertices;
27947
- face3d.edges.forEach(p => {
27948
- const p1 = vertices[p[0]];
27949
- const p2 = vertices[p[1]];
27950
- const v1 = {
27951
- x: x + p1[0],
27952
- y: y + p1[1],
27953
- z: z + p1[2]
27954
- };
27955
- const v2 = {
27956
- x: x + p2[0],
27957
- y: y + p2[1],
27958
- z: z + p2[2]
27959
- };
27960
- context.beginPath();
27961
- context.moveTo(v1.x, v1.y, v1.z);
27962
- context.lineTo(v2.x, v2.y, v2.z);
27963
- context.stroke();
27964
- });
27965
- }
27966
- fill(x, y, z, face3d, faces, fillColor, context, light, camera, pyramid3d, pyramid3dAttribute, fillCb) {
27967
- const rgbArray = ColorStore.Get(fillColor, ColorType.Color255);
27968
- const vertices = face3d.vertices;
27969
- const viewdVerticesZ = vertices.map(v => {
27970
- return context.view(v[0], v[1], v[2])[2];
27971
- });
27972
- const sortFace = [];
27973
- face3d.polygons.forEach((p, i) => {
27974
- if (!faces[i]) {
27975
- return;
27976
- }
27977
- sortFace.push({
27978
- faceIdx: i,
27979
- polygon: p
27980
- });
27981
- const { polygon, normal } = p;
27982
- const z1 = viewdVerticesZ[polygon[0]];
27983
- const z2 = viewdVerticesZ[polygon[1]];
27984
- const z3 = viewdVerticesZ[polygon[2]];
27985
- const z4 = viewdVerticesZ[polygon[3]];
27986
- p.ave_z = z1 + z2 + z3 + z4;
27987
- });
27988
- sortFace.sort((a, b) => b.polygon.ave_z - a.polygon.ave_z);
27989
- sortFace.forEach(item => {
27990
- const { polygon, normal } = item.polygon;
27991
- const p1 = vertices[polygon[0]];
27992
- const p2 = vertices[polygon[1]];
27993
- const p3 = vertices[polygon[2]];
27994
- const p4 = vertices[polygon[3]];
27995
- const v1 = {
27996
- x: x + p1[0],
27997
- y: y + p1[1],
27998
- z: z + p1[2]
27999
- };
28000
- const v2 = {
28001
- x: x + p2[0],
28002
- y: y + p2[1],
28003
- z: z + p2[2]
28004
- };
28005
- const v3 = {
28006
- x: x + p3[0],
28007
- y: y + p3[1],
28008
- z: z + p3[2]
28009
- };
28010
- const v4 = {
28011
- x: x + p4[0],
28012
- y: y + p4[1],
28013
- z: z + p4[2]
28014
- };
28015
- context.beginPath();
28016
- context.moveTo(v1.x, v1.y, v1.z);
28017
- context.lineTo(v2.x, v2.y, v2.z);
28018
- context.lineTo(v3.x, v3.y, v3.z);
28019
- context.lineTo(v4.x, v4.y, v4.z);
28020
- context.closePath();
28021
- if (fillCb) {
28022
- fillCb(context, pyramid3d.attribute, pyramid3dAttribute);
28023
- }
28024
- else {
28025
- context.fillStyle = light ? light.computeColor(normal, rgbArray) : fillColor;
28026
- context.fill();
28027
- }
28028
- });
28029
- }
28030
28318
  draw(pyramid3d, renderService, drawContext) {
28031
28319
  const pyramid3dAttribute = getTheme(pyramid3d).polygon;
28032
28320
  this._draw(pyramid3d, pyramid3dAttribute, false, drawContext);
@@ -28364,7 +28652,7 @@ class HtmlAttributePlugin {
28364
28652
  }
28365
28653
  }
28366
28654
  const registerHtmlAttributePlugin = () => {
28367
- Factory.registerPlugin('ReactAttributePlugin', HtmlAttributePlugin);
28655
+ Factory.registerPlugin('HtmlAttributePlugin', HtmlAttributePlugin);
28368
28656
  };
28369
28657
 
28370
28658
  class ReactAttributePlugin extends HtmlAttributePlugin {
@@ -28380,13 +28668,16 @@ class ReactAttributePlugin extends HtmlAttributePlugin {
28380
28668
  if (!this.htmlMap || !this.htmlMap[id]) {
28381
28669
  return;
28382
28670
  }
28383
- const { root, wrapContainer } = this.htmlMap[id];
28671
+ const { root, wrapContainer, unmount } = this.htmlMap[id];
28384
28672
  if (root) {
28385
28673
  const raf = application.global.getRequestAnimationFrame();
28386
28674
  raf(() => {
28387
28675
  root.unmount();
28388
28676
  });
28389
28677
  }
28678
+ else if (unmount) {
28679
+ unmount();
28680
+ }
28390
28681
  wrapContainer && application.global.removeDom(wrapContainer);
28391
28682
  this.htmlMap[id] = null;
28392
28683
  }
@@ -28402,7 +28693,7 @@ class ReactAttributePlugin extends HtmlAttributePlugin {
28402
28693
  }
28403
28694
  const ReactDOM = stage.params.ReactDOM;
28404
28695
  const { element, container } = react;
28405
- if (!(element && ReactDOM && ReactDOM.createRoot)) {
28696
+ if (!(element && ReactDOM && (ReactDOM.createRoot || ReactDOM.render))) {
28406
28697
  return;
28407
28698
  }
28408
28699
  const id = isNil(react.id) ? `${(_a = graphic.id) !== null && _a !== void 0 ? _a : graphic._uid}_react` : react.id;
@@ -28412,16 +28703,35 @@ class ReactAttributePlugin extends HtmlAttributePlugin {
28412
28703
  if (!this.htmlMap || !this.htmlMap[id]) {
28413
28704
  const { wrapContainer, nativeContainer } = this.getWrapContainer(stage, container);
28414
28705
  if (wrapContainer) {
28415
- const root = ReactDOM.createRoot(wrapContainer);
28416
- root.render(element);
28417
28706
  if (!this.htmlMap) {
28418
28707
  this.htmlMap = {};
28419
28708
  }
28420
- this.htmlMap[id] = { root, wrapContainer, nativeContainer, container, renderId: this.renderId };
28709
+ if (ReactDOM.createRoot) {
28710
+ const root = ReactDOM.createRoot(wrapContainer);
28711
+ root.render(element);
28712
+ this.htmlMap[id] = { root, wrapContainer, nativeContainer, container, renderId: this.renderId };
28713
+ }
28714
+ else {
28715
+ ReactDOM.render(element, wrapContainer);
28716
+ this.htmlMap[id] = {
28717
+ wrapContainer,
28718
+ nativeContainer,
28719
+ container,
28720
+ renderId: this.renderId,
28721
+ unmount: () => {
28722
+ ReactDOM.unmountComponentAtNode(wrapContainer);
28723
+ }
28724
+ };
28725
+ }
28421
28726
  }
28422
28727
  }
28423
28728
  else {
28424
- this.htmlMap[id].root.render(element);
28729
+ if (ReactDOM.createRoot) {
28730
+ this.htmlMap[id].root.render(element);
28731
+ }
28732
+ else {
28733
+ ReactDOM.render(element, this.htmlMap[id].wrapContainer);
28734
+ }
28425
28735
  }
28426
28736
  if (!this.htmlMap || !this.htmlMap[id]) {
28427
28737
  return;
@@ -28435,4 +28745,4 @@ const registerReactAttributePlugin = () => {
28435
28745
  Factory.registerPlugin('ReactAttributePlugin', ReactAttributePlugin);
28436
28746
  };
28437
28747
 
28438
- export { ACustomAnimate, ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, Animate, AnimateGroup, AnimateGroup1, AnimateMode, AnimateStatus, AnimateStepType, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeAnimate, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasFactory, CanvasTextLayout, CbAnimate, Circle, CircleRender, CircleRenderContribution, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Container, ContainerModule, Context2dFactory, ContributionProvider, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageBackgroundRenderContribution, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultMorphingAnimateConfig, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStateAnimateConfig, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTicker, DefaultTimeline, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction$1 as Direction, DirectionalLight, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, Factory, FadeInPlus, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, GlobalPickerService, Glyph, GlyphRender, Graphic, GraphicAnimate, GraphicCreator$1 as GraphicCreator, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupFadeIn, GroupFadeOut, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, HtmlAttributePlugin, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncreaseCount, IncrementalDrawContribution, InputText, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, ManualTickHandler, ManualTicker, Mat4Allocate, MatrixAllocate, Meteor, MonotoneX, MonotoneY, MorphingPath, MotionPath, MultiToOneMorphingPath, NOWORK_ANIMATE_ATTR, Node, OrthoCamera, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PickItemInterceptor, PickerService, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RAFTickHandler, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, ReactAttributePlugin, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, ResourceLoader, RichText, RichTextRender, RotateBySphereAnimate, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StaticLayerHandlerContribution, Step$1 as Step, StreamLight, SubAnimate, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, TagPointsUpdate, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TimeOutTickHandler, TransformUtil, UpdateTag, VGlobal, VWindow, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, _interpolateColor, addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dModule, arcModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindContributionProvider, bindContributionProviderNoSingletonScope, boundStroke, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleModule, clock, cloneGraphic, colorEqual, colorStringInterpolationToStr, container, cornerTangents, createArc, createArc3d, createArea, createCircle, createColor, createConicalGradient, createGlyph, createGroup, createImage, createLine, createMat4, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, defaultTicker, defaultTimeline, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawIncrementalAreaSegments, drawIncrementalSegments, drawPathProxy, drawSegments, enumCommandMap, fillVisible, findBestMorphingRotation, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getConicGradientAt, getContextFont, getCurrentEnv, getExtraModelMatrix, getModelMatrix, getRichTextBounds, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphModule, graphicCreator, graphicService, graphicUtil, imageModule, incrementalAddTo, inject, injectable, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, intersect, isBrowserEnv, isNodeEnv, isSvg, isTransformKey, isXML, layerService, lineModule, lookAt, mat3Tomat4, mat4Allocate, matrixAllocate, morphPath, multiInject, multiToOneMorph, multiply, multiplyMat4Mat3, multiplyMat4Mat4, named, newThemeObj, oneToMultiMorph, ortho, parsePadding, parseStroke, parseSvgPath, pathModule, pathToBezierCurves, point$2 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polygonModule, preLoadAllModule, pyramid3dModule, rafBasedSto, rect3dModule, rectFillVisible, rectModule, rectStrokeVisible, recursiveCallBinarySplit, registerArc3dGraphic, registerArcGraphic, registerAreaGraphic, registerCircleGraphic, registerDirectionalLight, registerGlyphGraphic, registerGroupGraphic, registerHtmlAttributePlugin, registerImageGraphic, registerLineGraphic, registerOrthoCamera, registerPathGraphic, registerPolygonGraphic, registerPyramid3dGraphic, registerReactAttributePlugin, registerRect3dGraphic, registerRectGraphic, registerRichtextGraphic, registerShadowRootGraphic, registerSymbolGraphic, registerTextGraphic, registerWrapTextGraphic, renderCommandList, rewriteProto, richtextModule, rotateX, rotateY, runFill, runStroke, segments, shouldUseMat4, snapLength, splitArc, splitArea, splitCircle, splitGraphic, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, strCommandMap, strokeVisible, symbolModule, textAttributesToStyle, textDrawOffsetX, textDrawOffsetY, textLayoutOffsetY, textModule, transformKeys, transformMat4, transformUtil, translate, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, xul };
28748
+ export { ACustomAnimate, ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, Animate, AnimateGroup, AnimateGroup1, AnimateMode, AnimateStatus, AnimateStepType, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeAnimate, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasFactory, CanvasTextLayout, CbAnimate, Circle, CircleRender, CircleRenderContribution, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Container, ContainerModule, Context2dFactory, ContributionProvider, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageBackgroundRenderContribution, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultMorphingAnimateConfig, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStateAnimateConfig, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTicker, DefaultTimeline, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction$1 as Direction, DirectionalLight, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, Factory, FadeInPlus, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, GlobalPickerService, Glyph, GlyphRender, Graphic, GraphicAnimate, GraphicCreator$1 as GraphicCreator, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupFadeIn, GroupFadeOut, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, HtmlAttributePlugin, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncreaseCount, IncrementalDrawContribution, InputText, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, ManualTickHandler, ManualTicker, Mat4Allocate, MatrixAllocate, Meteor, MonotoneX, MonotoneY, MorphingPath, MotionPath, MultiToOneMorphingPath, NOWORK_ANIMATE_ATTR, Node, OrthoCamera, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PickItemInterceptor, PickerService, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RAFTickHandler, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, ReactAttributePlugin, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, ResourceLoader, RichText, RichTextEditPlugin, RichTextRender, RotateBySphereAnimate, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StaticLayerHandlerContribution, Step$1 as Step, StreamLight, SubAnimate, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, TagPointsUpdate, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TimeOutTickHandler, TransformUtil, UpdateTag, VGlobal, VWindow, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, _interpolateColor, addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dModule, arcModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindContributionProvider, bindContributionProviderNoSingletonScope, boundStroke, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleModule, clock, cloneGraphic, colorEqual, colorStringInterpolationToStr, container, cornerTangents, createArc, createArc3d, createArea, createCircle, createColor, createConicalGradient, createGlyph, createGroup, createImage, createLine, createMat4, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, defaultTicker, defaultTimeline, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawIncrementalAreaSegments, drawIncrementalSegments, drawPathProxy, drawSegments, enumCommandMap, fillVisible, findBestMorphingRotation, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getConicGradientAt, getCurrentEnv, getExtraModelMatrix, getModelMatrix, getRichTextBounds, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphModule, graphicCreator, graphicService, graphicUtil, identityMat4, imageModule, incrementalAddTo, inject, injectable, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, intersect, isBrowserEnv, isNodeEnv, isSvg, isTransformKey, isXML, layerService, lineModule, lookAt, mat3Tomat4, mat4Allocate, matrixAllocate, morphPath, multiInject, multiToOneMorph, multiplyMat4Mat3, multiplyMat4Mat4, named, newThemeObj, oneToMultiMorph, ortho, parsePadding, parseStroke, parseSvgPath, pathModule, pathToBezierCurves, point$2 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polygonModule, preLoadAllModule, pyramid3dModule, rafBasedSto, rect3dModule, rectFillVisible, rectModule, rectStrokeVisible, recursiveCallBinarySplit, registerArc3dGraphic, registerArcGraphic, registerAreaGraphic, registerCircleGraphic, registerDirectionalLight, registerGlyphGraphic, registerGroupGraphic, registerHtmlAttributePlugin, registerImageGraphic, registerLineGraphic, registerOrthoCamera, registerPathGraphic, registerPolygonGraphic, registerPyramid3dGraphic, registerReactAttributePlugin, registerRect3dGraphic, registerRectGraphic, registerRichtextGraphic, registerShadowRootGraphic, registerSymbolGraphic, registerTextGraphic, registerWrapTextGraphic, renderCommandList, rewriteProto, richtextModule, rotateX, rotateY, rotateZ, runFill, runStroke, scaleMat4, segments, shouldUseMat4, snapLength, splitArc, splitArea, splitCircle, splitGraphic, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, strCommandMap, strokeVisible, symbolModule, textAttributesToStyle, textDrawOffsetX, textDrawOffsetY, textLayoutOffsetY, textModule, transformKeys, transformMat4, transformUtil, translate, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, xul };