@visactor/vrender-core 0.17.0-alpha.8 → 0.17.1-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 (814) hide show
  1. package/cjs/allocator/bounds-allocate.d.ts +13 -0
  2. package/cjs/allocator/bounds-allocate.js +38 -0
  3. package/cjs/allocator/bounds-allocate.js.map +1 -0
  4. package/cjs/allocator/canvas-allocate.d.ts +4 -0
  5. package/cjs/allocator/canvas-allocate.js +19 -6
  6. package/cjs/allocator/canvas-allocate.js.map +1 -1
  7. package/cjs/allocator/graphic-allocate.d.ts +56 -1
  8. package/cjs/allocator/graphic-allocate.js +163 -1
  9. package/cjs/allocator/graphic-allocate.js.map +1 -1
  10. package/cjs/animate/Ticker/default-ticker.js +3 -3
  11. package/cjs/animate/Ticker/default-ticker.js.map +1 -1
  12. package/cjs/animate/animate.js +2 -2
  13. package/cjs/animate/animate.js.map +1 -1
  14. package/cjs/animate/config.js +1 -2
  15. package/cjs/animate/custom-animate.d.ts +14 -3
  16. package/cjs/animate/custom-animate.js +100 -5
  17. package/cjs/animate/custom-animate.js.map +1 -1
  18. package/cjs/animate/default-ticker.js +2 -1
  19. package/cjs/canvas/contributions/base-canvas.js +4 -2
  20. package/cjs/canvas/contributions/base-canvas.js.map +1 -1
  21. package/cjs/common/Reflect-metadata.js +349 -359
  22. package/cjs/common/Reflect-metadata.js.map +1 -1
  23. package/cjs/common/bounds-context.js +2 -1
  24. package/cjs/common/inversify/annotation/inject.d.ts +1 -0
  25. package/cjs/common/inversify/annotation/inject.js +10 -0
  26. package/cjs/common/inversify/annotation/inject.js.map +1 -0
  27. package/cjs/common/inversify/annotation/inject_base.d.ts +14 -0
  28. package/cjs/common/inversify/annotation/inject_base.js +39 -0
  29. package/cjs/common/inversify/annotation/inject_base.js.map +1 -0
  30. package/cjs/common/inversify/annotation/injectable.d.ts +1 -0
  31. package/cjs/common/{inversify-lite/annotation/post_construct.js → inversify/annotation/injectable.js} +15 -5
  32. package/cjs/common/inversify/annotation/injectable.js.map +1 -0
  33. package/cjs/common/inversify/annotation/multi_inject.d.ts +1 -0
  34. package/cjs/common/inversify/annotation/multi_inject.js +10 -0
  35. package/cjs/common/inversify/annotation/multi_inject.js.map +1 -0
  36. package/cjs/common/inversify/annotation/named.d.ts +1 -0
  37. package/cjs/common/inversify/annotation/named.js +14 -0
  38. package/cjs/common/inversify/annotation/named.js.map +1 -0
  39. package/cjs/common/inversify/binding.d.ts +18 -0
  40. package/cjs/common/inversify/binding.js +26 -0
  41. package/cjs/common/inversify/binding.js.map +1 -0
  42. package/cjs/common/inversify/container.d.ts +28 -0
  43. package/cjs/common/inversify/container.js +155 -0
  44. package/cjs/common/inversify/container.js.map +1 -0
  45. package/cjs/common/inversify/cotainer-module.d.ts +6 -0
  46. package/cjs/common/inversify/cotainer-module.js +16 -0
  47. package/cjs/common/inversify/cotainer-module.js.map +1 -0
  48. package/cjs/common/inversify/index.d.ts +7 -0
  49. package/cjs/common/inversify/index.js +75 -0
  50. package/cjs/common/inversify/index.js.map +1 -0
  51. package/cjs/common/inversify/interfaces.d.ts +218 -0
  52. package/cjs/common/inversify/interfaces.js +6 -0
  53. package/cjs/common/inversify/interfaces.js.map +1 -0
  54. package/cjs/common/inversify/literal_types.d.ts +5 -0
  55. package/cjs/common/inversify/literal_types.js +34 -0
  56. package/cjs/common/inversify/literal_types.js.map +1 -0
  57. package/cjs/common/inversify/meta-data.d.ts +6 -0
  58. package/cjs/common/inversify/meta-data.js +19 -0
  59. package/cjs/common/inversify/meta-data.js.map +1 -0
  60. package/cjs/common/inversify/metadata_keys.d.ts +12 -0
  61. package/cjs/common/inversify/metadata_keys.js +15 -0
  62. package/cjs/common/inversify/metadata_keys.js.map +1 -0
  63. package/cjs/common/inversify/metadata_reader.d.ts +6 -0
  64. package/cjs/common/inversify/metadata_reader.js +28 -0
  65. package/cjs/common/inversify/metadata_reader.js.map +1 -0
  66. package/cjs/common/inversify/syntax/binding_in_syntax.d.ts +10 -0
  67. package/cjs/common/inversify/syntax/binding_in_syntax.js +29 -0
  68. package/cjs/common/inversify/syntax/binding_in_syntax.js.map +1 -0
  69. package/cjs/common/inversify/syntax/binding_to_syntax.d.ts +12 -0
  70. package/cjs/common/inversify/syntax/binding_to_syntax.js +40 -0
  71. package/cjs/common/inversify/syntax/binding_to_syntax.js.map +1 -0
  72. package/cjs/common/inversify/syntax/constraint_helpers.d.ts +2 -0
  73. package/cjs/common/inversify/syntax/constraint_helpers.js +20 -0
  74. package/cjs/common/inversify/syntax/constraint_helpers.js.map +1 -0
  75. package/cjs/common/inversify-lite/container/container.js +1 -3
  76. package/cjs/common/inversify-lite/container/container.js.map +1 -1
  77. package/cjs/common/inversify-lite/index.d.ts +1 -8
  78. package/cjs/common/inversify-lite/index.js +1 -64
  79. package/cjs/common/inversify-lite/index.js.map +1 -1
  80. package/cjs/common/inversify-lite/interfaces/interfaces.d.ts +0 -2
  81. package/cjs/common/inversify-lite/interfaces/interfaces.js.map +1 -1
  82. package/cjs/common/inversify-lite/planning/queryable_string.d.ts +0 -2
  83. package/cjs/common/inversify-lite/planning/queryable_string.js +0 -10
  84. package/cjs/common/inversify-lite/planning/queryable_string.js.map +1 -1
  85. package/cjs/common/inversify-lite/resolution/resolver.js.map +1 -1
  86. package/cjs/common/segment/monotone.js +2 -2
  87. package/cjs/common/segment/monotone.js.map +1 -1
  88. package/cjs/common/shape/rect.js +2 -1
  89. package/cjs/common/shape/rect.js.map +1 -1
  90. package/cjs/common/sort.js +1 -2
  91. package/cjs/common/store.js +2 -1
  92. package/cjs/common/utils.d.ts +1 -0
  93. package/cjs/common/utils.js +10 -1
  94. package/cjs/common/utils.js.map +1 -1
  95. package/cjs/common/xml/OrderedObjParser.js +2 -2
  96. package/cjs/common/xml/OrderedObjParser.js.map +1 -1
  97. package/cjs/core/contributions/layerHandler/canvas2d-contribution.d.ts +2 -2
  98. package/cjs/core/contributions/layerHandler/canvas2d-contribution.js +4 -9
  99. package/cjs/core/contributions/layerHandler/canvas2d-contribution.js.map +1 -1
  100. package/cjs/core/contributions/layerHandler/empty-contribution.d.ts +2 -2
  101. package/cjs/core/contributions/layerHandler/empty-contribution.js +4 -9
  102. package/cjs/core/contributions/layerHandler/empty-contribution.js.map +1 -1
  103. package/cjs/core/contributions/layerHandler/offscreen2d-contribution.d.ts +2 -2
  104. package/cjs/core/contributions/layerHandler/offscreen2d-contribution.js +4 -9
  105. package/cjs/core/contributions/layerHandler/offscreen2d-contribution.js.map +1 -1
  106. package/cjs/core/contributions/textMeasure/AtextMeasure.d.ts +14 -2
  107. package/cjs/core/contributions/textMeasure/AtextMeasure.js +99 -13
  108. package/cjs/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
  109. package/cjs/core/contributions/textMeasure/layout.d.ts +2 -2
  110. package/cjs/core/contributions/textMeasure/layout.js +4 -4
  111. package/cjs/core/contributions/textMeasure/layout.js.map +1 -1
  112. package/cjs/core/contributions/textMeasure/modules.js +1 -2
  113. package/cjs/core/contributions/textMeasure/modules.js.map +1 -1
  114. package/cjs/core/core-modules.js +5 -6
  115. package/cjs/core/core-modules.js.map +1 -1
  116. package/cjs/core/global-module.js +2 -0
  117. package/cjs/core/global.d.ts +9 -0
  118. package/cjs/core/global.js +23 -5
  119. package/cjs/core/global.js.map +1 -1
  120. package/cjs/core/graphic-utils.d.ts +7 -4
  121. package/cjs/core/graphic-utils.js +18 -14
  122. package/cjs/core/graphic-utils.js.map +1 -1
  123. package/cjs/core/layer-service.d.ts +5 -2
  124. package/cjs/core/layer-service.js +17 -15
  125. package/cjs/core/layer-service.js.map +1 -1
  126. package/cjs/core/stage.d.ts +8 -4
  127. package/cjs/core/stage.js +42 -27
  128. package/cjs/core/stage.js.map +1 -1
  129. package/cjs/core/window.d.ts +2 -2
  130. package/cjs/core/window.js +7 -12
  131. package/cjs/core/window.js.map +1 -1
  132. package/cjs/env-check.d.ts +3 -0
  133. package/cjs/env-check.js +19 -0
  134. package/cjs/env-check.js.map +1 -0
  135. package/cjs/event/event-manager.d.ts +5 -1
  136. package/cjs/event/event-manager.js +31 -25
  137. package/cjs/event/event-manager.js.map +1 -1
  138. package/cjs/event/event-system.js +12 -11
  139. package/cjs/event/event-system.js.map +1 -1
  140. package/cjs/event/federated-event/base-event.d.ts +5 -6
  141. package/cjs/event/federated-event/base-event.js +15 -5
  142. package/cjs/event/federated-event/base-event.js.map +1 -1
  143. package/cjs/event/federated-event/mouse-event.d.ts +6 -6
  144. package/cjs/event/federated-event/mouse-event.js +17 -3
  145. package/cjs/event/federated-event/mouse-event.js.map +1 -1
  146. package/cjs/graphic/area.js +1 -0
  147. package/cjs/graphic/area.js.map +1 -1
  148. package/cjs/graphic/bounds.d.ts +2 -2
  149. package/cjs/graphic/bounds.js +8 -10
  150. package/cjs/graphic/bounds.js.map +1 -1
  151. package/cjs/graphic/builtin-symbol/index.d.ts +1 -0
  152. package/cjs/graphic/builtin-symbol/index.js +7 -2
  153. package/cjs/graphic/builtin-symbol/index.js.map +1 -1
  154. package/cjs/graphic/builtin-symbol/rect.d.ts +2 -1
  155. package/cjs/graphic/builtin-symbol/rect.js +11 -6
  156. package/cjs/graphic/builtin-symbol/rect.js.map +1 -1
  157. package/cjs/graphic/config.js +11 -3
  158. package/cjs/graphic/config.js.map +1 -1
  159. package/cjs/graphic/graphic-creator.d.ts +24 -36
  160. package/cjs/graphic/graphic-creator.js +16 -99
  161. package/cjs/graphic/graphic-creator.js.map +1 -1
  162. package/cjs/graphic/graphic-service/arc-contribution.d.ts +1 -5
  163. package/cjs/graphic/graphic-service/arc-contribution.js +0 -18
  164. package/cjs/graphic/graphic-service/arc-contribution.js.map +1 -1
  165. package/cjs/graphic/graphic-service/area-contribution.d.ts +1 -1
  166. package/cjs/graphic/graphic-service/area-contribution.js +1 -4
  167. package/cjs/graphic/graphic-service/area-contribution.js.map +1 -1
  168. package/cjs/graphic/graphic-service/circle-contribution.d.ts +1 -5
  169. package/cjs/graphic/graphic-service/circle-contribution.js +0 -18
  170. package/cjs/graphic/graphic-service/circle-contribution.js.map +1 -1
  171. package/cjs/graphic/graphic-service/common-contribution.js +2 -11
  172. package/cjs/graphic/graphic-service/common-contribution.js.map +1 -1
  173. package/cjs/graphic/graphic-service/graphic-module.js +2 -17
  174. package/cjs/graphic/graphic-service/graphic-module.js.map +1 -1
  175. package/cjs/graphic/graphic-service/graphic-service.d.ts +5 -9
  176. package/cjs/graphic/graphic-service/graphic-service.js +43 -32
  177. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  178. package/cjs/graphic/graphic-service/path-contribution.d.ts +1 -5
  179. package/cjs/graphic/graphic-service/path-contribution.js +0 -18
  180. package/cjs/graphic/graphic-service/path-contribution.js.map +1 -1
  181. package/cjs/graphic/graphic-service/rect-contribution.d.ts +1 -5
  182. package/cjs/graphic/graphic-service/rect-contribution.js +0 -18
  183. package/cjs/graphic/graphic-service/rect-contribution.js.map +1 -1
  184. package/cjs/graphic/graphic-service/symbol-contribution.d.ts +0 -1
  185. package/cjs/graphic/graphic-service/symbol-contribution.js +4 -13
  186. package/cjs/graphic/graphic-service/symbol-contribution.js.map +1 -1
  187. package/cjs/graphic/graphic.js +9 -7
  188. package/cjs/graphic/graphic.js.map +1 -1
  189. package/cjs/graphic/group.d.ts +1 -0
  190. package/cjs/graphic/group.js +7 -3
  191. package/cjs/graphic/group.js.map +1 -1
  192. package/cjs/graphic/index.d.ts +1 -0
  193. package/cjs/graphic/index.js +6 -5
  194. package/cjs/graphic/index.js.map +1 -1
  195. package/cjs/graphic/line.js +1 -0
  196. package/cjs/graphic/line.js.map +1 -1
  197. package/cjs/graphic/node-tree.js +1 -1
  198. package/cjs/graphic/node-tree.js.map +1 -1
  199. package/cjs/graphic/rect.d.ts +2 -3
  200. package/cjs/graphic/rect.js +3 -5
  201. package/cjs/graphic/rect.js.map +1 -1
  202. package/cjs/graphic/richtext/line.d.ts +1 -0
  203. package/cjs/graphic/richtext/line.js +6 -3
  204. package/cjs/graphic/richtext/line.js.map +1 -1
  205. package/cjs/graphic/richtext/paragraph.js +12 -11
  206. package/cjs/graphic/richtext/paragraph.js.map +1 -1
  207. package/cjs/graphic/richtext/utils.js +2 -1
  208. package/cjs/graphic/richtext/utils.js.map +1 -1
  209. package/cjs/graphic/richtext.d.ts +3 -3
  210. package/cjs/graphic/richtext.js +12 -3
  211. package/cjs/graphic/richtext.js.map +1 -1
  212. package/cjs/graphic/symbol.js +11 -9
  213. package/cjs/graphic/symbol.js.map +1 -1
  214. package/cjs/graphic/text.d.ts +1 -0
  215. package/cjs/graphic/text.js +97 -11
  216. package/cjs/graphic/text.js.map +1 -1
  217. package/cjs/graphic/theme.d.ts +4 -4
  218. package/cjs/graphic/theme.js +26 -27
  219. package/cjs/graphic/theme.js.map +1 -1
  220. package/cjs/graphic/tools.js +1 -1
  221. package/cjs/graphic/tools.js.map +1 -1
  222. package/cjs/graphic/wrap-text.js +6 -5
  223. package/cjs/graphic/wrap-text.js.map +1 -1
  224. package/cjs/index.d.ts +18 -0
  225. package/cjs/index.js +10 -1
  226. package/cjs/index.js.map +1 -1
  227. package/cjs/interface/allocator.d.ts +1 -0
  228. package/cjs/interface/allocator.js.map +1 -1
  229. package/cjs/interface/event.d.ts +15 -44
  230. package/cjs/interface/event.js.map +1 -1
  231. package/cjs/interface/global.d.ts +1 -0
  232. package/cjs/interface/global.js.map +1 -1
  233. package/cjs/interface/graphic/rect.d.ts +2 -0
  234. package/cjs/interface/graphic/rect.js.map +1 -1
  235. package/cjs/interface/graphic/richText.d.ts +1 -1
  236. package/cjs/interface/graphic/richText.js.map +1 -1
  237. package/cjs/interface/graphic/text.d.ts +5 -1
  238. package/cjs/interface/graphic/text.js.map +1 -1
  239. package/cjs/interface/graphic.d.ts +3 -2
  240. package/cjs/interface/graphic.js.map +1 -1
  241. package/cjs/interface/render.d.ts +2 -2
  242. package/cjs/interface/render.js.map +1 -1
  243. package/cjs/interface/stage.d.ts +8 -1
  244. package/cjs/interface/stage.js.map +1 -1
  245. package/cjs/interface/text.d.ts +2 -2
  246. package/cjs/interface/text.js.map +1 -1
  247. package/cjs/modules.d.ts +1 -2
  248. package/cjs/modules.js +8 -8
  249. package/cjs/modules.js.map +1 -1
  250. package/cjs/picker/global-picker-service.d.ts +2 -2
  251. package/cjs/picker/global-picker-service.js +4 -9
  252. package/cjs/picker/global-picker-service.js.map +1 -1
  253. package/cjs/picker/pick-interceptor.js +2 -1
  254. package/cjs/picker/pick-interceptor.js.map +1 -1
  255. package/cjs/picker/pick-modules.js +2 -4
  256. package/cjs/picker/pick-modules.js.map +1 -1
  257. package/cjs/picker/picker-service.d.ts +2 -2
  258. package/cjs/picker/picker-service.js +11 -7
  259. package/cjs/picker/picker-service.js.map +1 -1
  260. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +9 -5
  261. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  262. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +1 -1
  263. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  264. package/cjs/plugins/plugin-modules.js +1 -2
  265. package/cjs/plugins/plugin-modules.js.map +1 -1
  266. package/cjs/render/contributions/render/arc-module.d.ts +2 -0
  267. package/cjs/render/contributions/render/arc-module.js +17 -0
  268. package/cjs/render/contributions/render/arc-module.js.map +1 -0
  269. package/cjs/render/contributions/render/arc-render.js +2 -1
  270. package/cjs/render/contributions/render/arc-render.js.map +1 -1
  271. package/cjs/render/contributions/render/arc3d-module.d.ts +2 -0
  272. package/cjs/render/contributions/render/arc3d-module.js +15 -0
  273. package/cjs/render/contributions/render/arc3d-module.js.map +1 -0
  274. package/cjs/render/contributions/render/area-module.d.ts +2 -0
  275. package/cjs/render/contributions/render/area-module.js +18 -0
  276. package/cjs/render/contributions/render/area-module.js.map +1 -0
  277. package/cjs/render/contributions/render/area-render.d.ts +1 -0
  278. package/cjs/render/contributions/render/area-render.js +44 -6
  279. package/cjs/render/contributions/render/area-render.js.map +1 -1
  280. package/cjs/render/contributions/render/base-render.d.ts +1 -1
  281. package/cjs/render/contributions/render/base-render.js +15 -18
  282. package/cjs/render/contributions/render/base-render.js.map +1 -1
  283. package/cjs/render/contributions/render/circle-module.d.ts +2 -0
  284. package/cjs/render/contributions/render/circle-module.js +17 -0
  285. package/cjs/render/contributions/render/circle-module.js.map +1 -0
  286. package/cjs/render/contributions/render/circle-render.js +2 -1
  287. package/cjs/render/contributions/render/circle-render.js.map +1 -1
  288. package/cjs/render/contributions/render/contributions/arc-contribution-render.d.ts +3 -7
  289. package/cjs/render/contributions/render/contributions/arc-contribution-render.js +7 -30
  290. package/cjs/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
  291. package/cjs/render/contributions/render/contributions/area-contribution-render.d.ts +3 -4
  292. package/cjs/render/contributions/render/contributions/area-contribution-render.js +7 -21
  293. package/cjs/render/contributions/render/contributions/area-contribution-render.js.map +1 -1
  294. package/cjs/render/contributions/render/contributions/base-contribution-render.d.ts +4 -0
  295. package/cjs/render/contributions/render/contributions/base-contribution-render.js +24 -15
  296. package/cjs/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  297. package/cjs/render/contributions/render/contributions/circle-contribution-render.d.ts +3 -7
  298. package/cjs/render/contributions/render/contributions/circle-contribution-render.js +7 -30
  299. package/cjs/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
  300. package/cjs/render/contributions/render/contributions/constants.d.ts +1 -0
  301. package/cjs/render/contributions/render/contributions/constants.js +2 -2
  302. package/cjs/render/contributions/render/contributions/constants.js.map +1 -1
  303. package/cjs/render/contributions/render/contributions/group-contribution-render.d.ts +1 -0
  304. package/cjs/render/contributions/render/contributions/group-contribution-render.js +8 -14
  305. package/cjs/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
  306. package/cjs/render/contributions/render/contributions/image-contribution-render.d.ts +1 -0
  307. package/cjs/render/contributions/render/contributions/image-contribution-render.js +8 -15
  308. package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
  309. package/cjs/render/contributions/render/contributions/path-contribution-render.d.ts +2 -9
  310. package/cjs/render/contributions/render/contributions/path-contribution-render.js +4 -25
  311. package/cjs/render/contributions/render/contributions/path-contribution-render.js.map +1 -1
  312. package/cjs/render/contributions/render/contributions/polygon-contribution-render.d.ts +2 -9
  313. package/cjs/render/contributions/render/contributions/polygon-contribution-render.js +4 -25
  314. package/cjs/render/contributions/render/contributions/polygon-contribution-render.js.map +1 -1
  315. package/cjs/render/contributions/render/contributions/rect-contribution-render.d.ts +5 -7
  316. package/cjs/render/contributions/render/contributions/rect-contribution-render.js +17 -37
  317. package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  318. package/cjs/render/contributions/render/contributions/symbol-contribution-render.d.ts +3 -7
  319. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js +6 -27
  320. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  321. package/cjs/render/contributions/render/contributions/text-contribution-render.d.ts +8 -1
  322. package/cjs/render/contributions/render/contributions/text-contribution-render.js +25 -1
  323. package/cjs/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
  324. package/cjs/render/contributions/render/draw-contribution.d.ts +7 -6
  325. package/cjs/render/contributions/render/draw-contribution.js +44 -26
  326. package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
  327. package/cjs/render/contributions/render/draw-interceptor.d.ts +7 -1
  328. package/cjs/render/contributions/render/draw-interceptor.js +43 -28
  329. package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
  330. package/cjs/render/contributions/render/glyph-module.d.ts +2 -0
  331. package/cjs/render/contributions/render/glyph-module.js +15 -0
  332. package/cjs/render/contributions/render/glyph-module.js.map +1 -0
  333. package/cjs/render/contributions/render/glyph-render.d.ts +1 -2
  334. package/cjs/render/contributions/render/glyph-render.js +13 -8
  335. package/cjs/render/contributions/render/glyph-render.js.map +1 -1
  336. package/cjs/render/contributions/render/group-render.js +3 -2
  337. package/cjs/render/contributions/render/group-render.js.map +1 -1
  338. package/cjs/render/contributions/render/image-module.d.ts +2 -0
  339. package/cjs/render/contributions/render/image-module.js +16 -0
  340. package/cjs/render/contributions/render/image-module.js.map +1 -0
  341. package/cjs/render/contributions/render/image-render.js +4 -2
  342. package/cjs/render/contributions/render/image-render.js.map +1 -1
  343. package/cjs/render/contributions/render/incremental-draw-contribution.d.ts +2 -6
  344. package/cjs/render/contributions/render/incremental-draw-contribution.js +8 -11
  345. package/cjs/render/contributions/render/incremental-draw-contribution.js.map +1 -1
  346. package/cjs/render/contributions/render/line-module.d.ts +2 -0
  347. package/cjs/render/contributions/render/line-module.js +17 -0
  348. package/cjs/render/contributions/render/line-module.js.map +1 -0
  349. package/cjs/render/contributions/render/line-render.d.ts +1 -0
  350. package/cjs/render/contributions/render/line-render.js +21 -6
  351. package/cjs/render/contributions/render/line-render.js.map +1 -1
  352. package/cjs/render/contributions/render/module.js +8 -98
  353. package/cjs/render/contributions/render/module.js.map +1 -1
  354. package/cjs/render/contributions/render/path-module.d.ts +2 -0
  355. package/cjs/render/contributions/render/path-module.js +17 -0
  356. package/cjs/render/contributions/render/path-module.js.map +1 -0
  357. package/cjs/render/contributions/render/path-render.d.ts +2 -1
  358. package/cjs/render/contributions/render/path-render.js +8 -5
  359. package/cjs/render/contributions/render/path-render.js.map +1 -1
  360. package/cjs/render/contributions/render/polygon-module.d.ts +2 -0
  361. package/cjs/render/contributions/render/polygon-module.js +16 -0
  362. package/cjs/render/contributions/render/polygon-module.js.map +1 -0
  363. package/cjs/render/contributions/render/polygon-render.js +2 -1
  364. package/cjs/render/contributions/render/polygon-render.js.map +1 -1
  365. package/cjs/render/contributions/render/pyramid3d-module.d.ts +2 -0
  366. package/cjs/render/contributions/render/pyramid3d-module.js +15 -0
  367. package/cjs/render/contributions/render/pyramid3d-module.js.map +1 -0
  368. package/cjs/render/contributions/render/rect-module.d.ts +2 -0
  369. package/cjs/render/contributions/render/rect-module.js +17 -0
  370. package/cjs/render/contributions/render/rect-module.js.map +1 -0
  371. package/cjs/render/contributions/render/rect-render.d.ts +2 -1
  372. package/cjs/render/contributions/render/rect-render.js +11 -5
  373. package/cjs/render/contributions/render/rect-render.js.map +1 -1
  374. package/cjs/render/contributions/render/rect3d-module.d.ts +2 -0
  375. package/cjs/render/contributions/render/rect3d-module.js +15 -0
  376. package/cjs/render/contributions/render/rect3d-module.js.map +1 -0
  377. package/cjs/render/contributions/render/render-slector.d.ts +1 -4
  378. package/cjs/render/contributions/render/render-slector.js +0 -20
  379. package/cjs/render/contributions/render/render-slector.js.map +1 -1
  380. package/cjs/render/contributions/render/richtext-module.d.ts +2 -0
  381. package/cjs/render/contributions/render/richtext-module.js +15 -0
  382. package/cjs/render/contributions/render/richtext-module.js.map +1 -0
  383. package/cjs/render/contributions/render/richtext-render.d.ts +1 -0
  384. package/cjs/render/contributions/render/richtext-render.js +12 -7
  385. package/cjs/render/contributions/render/richtext-render.js.map +1 -1
  386. package/cjs/render/contributions/render/symbol-module.d.ts +2 -0
  387. package/cjs/render/contributions/render/symbol-module.js +17 -0
  388. package/cjs/render/contributions/render/symbol-module.js.map +1 -0
  389. package/cjs/render/contributions/render/symbol-render.js +22 -5
  390. package/cjs/render/contributions/render/symbol-render.js.map +1 -1
  391. package/cjs/render/contributions/render/text-module.d.ts +2 -0
  392. package/cjs/render/contributions/render/text-module.js +16 -0
  393. package/cjs/render/contributions/render/text-module.js.map +1 -0
  394. package/cjs/render/contributions/render/text-render.js +13 -10
  395. package/cjs/render/contributions/render/text-render.js.map +1 -1
  396. package/cjs/render/contributions/render/utils.js +2 -2
  397. package/cjs/render/contributions/render/utils.js.map +1 -1
  398. package/cjs/render/render-modules.js +1 -1
  399. package/cjs/render/render-modules.js.map +1 -1
  400. package/cjs/render/render-service.js +1 -1
  401. package/cjs/render/render-service.js.map +1 -1
  402. package/cjs/resource-loader/loader.js +1 -3
  403. package/cjs/resource-loader/loader.js.map +1 -1
  404. package/dist/index.js +8931 -9097
  405. package/dist/index.min.js +1 -1
  406. package/es/allocator/bounds-allocate.d.ts +13 -0
  407. package/es/allocator/bounds-allocate.js +32 -0
  408. package/es/allocator/bounds-allocate.js.map +1 -0
  409. package/es/allocator/canvas-allocate.d.ts +4 -0
  410. package/es/allocator/canvas-allocate.js +19 -6
  411. package/es/allocator/canvas-allocate.js.map +1 -1
  412. package/es/allocator/graphic-allocate.d.ts +56 -1
  413. package/es/allocator/graphic-allocate.js +155 -1
  414. package/es/allocator/graphic-allocate.js.map +1 -1
  415. package/es/animate/Ticker/default-ticker.js +4 -2
  416. package/es/animate/Ticker/default-ticker.js.map +1 -1
  417. package/es/animate/animate.js +3 -3
  418. package/es/animate/animate.js.map +1 -1
  419. package/es/animate/config.js +1 -2
  420. package/es/animate/custom-animate.d.ts +14 -3
  421. package/es/animate/custom-animate.js +103 -5
  422. package/es/animate/custom-animate.js.map +1 -1
  423. package/es/animate/default-ticker.js +2 -1
  424. package/es/canvas/contributions/base-canvas.js +4 -2
  425. package/es/canvas/contributions/base-canvas.js.map +1 -1
  426. package/es/common/Reflect-metadata.js +349 -359
  427. package/es/common/Reflect-metadata.js.map +1 -1
  428. package/es/common/bounds-context.js +2 -1
  429. package/es/common/inversify/annotation/inject.d.ts +1 -0
  430. package/es/common/inversify/annotation/inject.js +6 -0
  431. package/es/common/inversify/annotation/inject.js.map +1 -0
  432. package/es/common/inversify/annotation/inject_base.d.ts +14 -0
  433. package/es/common/inversify/annotation/inject_base.js +29 -0
  434. package/es/common/inversify/annotation/inject_base.js.map +1 -0
  435. package/es/common/inversify/annotation/injectable.d.ts +1 -0
  436. package/es/common/inversify/annotation/injectable.js +10 -0
  437. package/es/common/inversify/annotation/injectable.js.map +1 -0
  438. package/es/common/inversify/annotation/multi_inject.d.ts +1 -0
  439. package/es/common/inversify/annotation/multi_inject.js +6 -0
  440. package/es/common/inversify/annotation/multi_inject.js.map +1 -0
  441. package/es/common/inversify/annotation/named.d.ts +1 -0
  442. package/es/common/inversify/annotation/named.js +10 -0
  443. package/es/common/inversify/annotation/named.js.map +1 -0
  444. package/es/common/inversify/binding.d.ts +18 -0
  445. package/es/common/inversify/binding.js +22 -0
  446. package/es/common/inversify/binding.js.map +1 -0
  447. package/es/common/inversify/container.d.ts +28 -0
  448. package/es/common/inversify/container.js +155 -0
  449. package/es/common/inversify/container.js.map +1 -0
  450. package/es/common/inversify/cotainer-module.d.ts +6 -0
  451. package/es/common/inversify/cotainer-module.js +8 -0
  452. package/es/common/inversify/cotainer-module.js.map +1 -0
  453. package/es/common/inversify/index.d.ts +7 -0
  454. package/es/common/inversify/index.js +14 -0
  455. package/es/common/inversify/index.js.map +1 -0
  456. package/es/common/inversify/interfaces.d.ts +218 -0
  457. package/es/common/inversify/interfaces.js +2 -0
  458. package/es/common/inversify/interfaces.js.map +1 -0
  459. package/es/common/inversify/literal_types.d.ts +5 -0
  460. package/es/common/inversify/literal_types.js +20 -0
  461. package/es/common/inversify/literal_types.js.map +1 -0
  462. package/es/common/inversify/meta-data.d.ts +6 -0
  463. package/es/common/inversify/meta-data.js +11 -0
  464. package/es/common/inversify/meta-data.js.map +1 -0
  465. package/es/common/inversify/metadata_keys.d.ts +12 -0
  466. package/es/common/inversify/metadata_keys.js +28 -0
  467. package/es/common/inversify/metadata_keys.js.map +1 -0
  468. package/es/common/inversify/metadata_reader.d.ts +6 -0
  469. package/es/common/inversify/metadata_reader.js +18 -0
  470. package/es/common/inversify/metadata_reader.js.map +1 -0
  471. package/es/common/inversify/syntax/binding_in_syntax.d.ts +10 -0
  472. package/es/common/inversify/syntax/binding_in_syntax.js +24 -0
  473. package/es/common/inversify/syntax/binding_in_syntax.js.map +1 -0
  474. package/es/common/inversify/syntax/binding_to_syntax.d.ts +12 -0
  475. package/es/common/inversify/syntax/binding_to_syntax.js +36 -0
  476. package/es/common/inversify/syntax/binding_to_syntax.js.map +1 -0
  477. package/es/common/inversify/syntax/constraint_helpers.d.ts +2 -0
  478. package/es/common/inversify/syntax/constraint_helpers.js +18 -0
  479. package/es/common/inversify/syntax/constraint_helpers.js.map +1 -0
  480. package/es/common/inversify-lite/container/container.js +2 -4
  481. package/es/common/inversify-lite/container/container.js.map +1 -1
  482. package/es/common/inversify-lite/index.d.ts +1 -8
  483. package/es/common/inversify-lite/index.js +1 -15
  484. package/es/common/inversify-lite/index.js.map +1 -1
  485. package/es/common/inversify-lite/interfaces/interfaces.d.ts +0 -2
  486. package/es/common/inversify-lite/interfaces/interfaces.js.map +1 -1
  487. package/es/common/inversify-lite/planning/queryable_string.d.ts +0 -2
  488. package/es/common/inversify-lite/planning/queryable_string.js +0 -10
  489. package/es/common/inversify-lite/planning/queryable_string.js.map +1 -1
  490. package/es/common/inversify-lite/resolution/resolver.js.map +1 -1
  491. package/es/common/segment/monotone.js +2 -2
  492. package/es/common/segment/monotone.js.map +1 -1
  493. package/es/common/shape/rect.js +2 -1
  494. package/es/common/shape/rect.js.map +1 -1
  495. package/es/common/sort.js +1 -2
  496. package/es/common/store.js +2 -1
  497. package/es/common/utils.d.ts +1 -0
  498. package/es/common/utils.js +8 -1
  499. package/es/common/utils.js.map +1 -1
  500. package/es/common/xml/OrderedObjParser.js +2 -2
  501. package/es/common/xml/OrderedObjParser.js.map +1 -1
  502. package/es/core/contributions/layerHandler/canvas2d-contribution.d.ts +2 -2
  503. package/es/core/contributions/layerHandler/canvas2d-contribution.js +5 -9
  504. package/es/core/contributions/layerHandler/canvas2d-contribution.js.map +1 -1
  505. package/es/core/contributions/layerHandler/empty-contribution.d.ts +2 -2
  506. package/es/core/contributions/layerHandler/empty-contribution.js +5 -9
  507. package/es/core/contributions/layerHandler/empty-contribution.js.map +1 -1
  508. package/es/core/contributions/layerHandler/offscreen2d-contribution.d.ts +2 -2
  509. package/es/core/contributions/layerHandler/offscreen2d-contribution.js +5 -9
  510. package/es/core/contributions/layerHandler/offscreen2d-contribution.js.map +1 -1
  511. package/es/core/contributions/textMeasure/AtextMeasure.d.ts +14 -2
  512. package/es/core/contributions/textMeasure/AtextMeasure.js +99 -13
  513. package/es/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
  514. package/es/core/contributions/textMeasure/layout.d.ts +2 -2
  515. package/es/core/contributions/textMeasure/layout.js +4 -4
  516. package/es/core/contributions/textMeasure/layout.js.map +1 -1
  517. package/es/core/contributions/textMeasure/modules.js +1 -1
  518. package/es/core/contributions/textMeasure/modules.js.map +1 -1
  519. package/es/core/core-modules.js +4 -6
  520. package/es/core/core-modules.js.map +1 -1
  521. package/es/core/global-module.js +2 -0
  522. package/es/core/global.d.ts +9 -0
  523. package/es/core/global.js +23 -4
  524. package/es/core/global.js.map +1 -1
  525. package/es/core/graphic-utils.d.ts +7 -4
  526. package/es/core/graphic-utils.js +20 -15
  527. package/es/core/graphic-utils.js.map +1 -1
  528. package/es/core/layer-service.d.ts +5 -2
  529. package/es/core/layer-service.js +18 -15
  530. package/es/core/layer-service.js.map +1 -1
  531. package/es/core/stage.d.ts +8 -4
  532. package/es/core/stage.js +47 -30
  533. package/es/core/stage.js.map +1 -1
  534. package/es/core/window.d.ts +2 -2
  535. package/es/core/window.js +8 -12
  536. package/es/core/window.js.map +1 -1
  537. package/es/env-check.d.ts +3 -0
  538. package/es/env-check.js +12 -0
  539. package/es/env-check.js.map +1 -0
  540. package/es/event/event-manager.d.ts +5 -1
  541. package/es/event/event-manager.js +32 -26
  542. package/es/event/event-manager.js.map +1 -1
  543. package/es/event/event-system.js +8 -6
  544. package/es/event/event-system.js.map +1 -1
  545. package/es/event/federated-event/base-event.d.ts +5 -6
  546. package/es/event/federated-event/base-event.js +15 -5
  547. package/es/event/federated-event/base-event.js.map +1 -1
  548. package/es/event/federated-event/mouse-event.d.ts +6 -6
  549. package/es/event/federated-event/mouse-event.js +16 -4
  550. package/es/event/federated-event/mouse-event.js.map +1 -1
  551. package/es/graphic/area.js +1 -0
  552. package/es/graphic/area.js.map +1 -1
  553. package/es/graphic/bounds.d.ts +2 -2
  554. package/es/graphic/bounds.js +6 -8
  555. package/es/graphic/bounds.js.map +1 -1
  556. package/es/graphic/builtin-symbol/index.d.ts +1 -0
  557. package/es/graphic/builtin-symbol/index.js +7 -0
  558. package/es/graphic/builtin-symbol/index.js.map +1 -1
  559. package/es/graphic/builtin-symbol/rect.d.ts +2 -1
  560. package/es/graphic/builtin-symbol/rect.js +9 -4
  561. package/es/graphic/builtin-symbol/rect.js.map +1 -1
  562. package/es/graphic/config.js +12 -4
  563. package/es/graphic/config.js.map +1 -1
  564. package/es/graphic/graphic-creator.d.ts +24 -36
  565. package/es/graphic/graphic-creator.js +14 -125
  566. package/es/graphic/graphic-creator.js.map +1 -1
  567. package/es/graphic/graphic-service/arc-contribution.d.ts +1 -5
  568. package/es/graphic/graphic-service/arc-contribution.js +0 -15
  569. package/es/graphic/graphic-service/arc-contribution.js.map +1 -1
  570. package/es/graphic/graphic-service/area-contribution.d.ts +1 -1
  571. package/es/graphic/graphic-service/area-contribution.js +2 -1
  572. package/es/graphic/graphic-service/area-contribution.js.map +1 -1
  573. package/es/graphic/graphic-service/circle-contribution.d.ts +1 -5
  574. package/es/graphic/graphic-service/circle-contribution.js +0 -15
  575. package/es/graphic/graphic-service/circle-contribution.js.map +1 -1
  576. package/es/graphic/graphic-service/common-contribution.js +2 -14
  577. package/es/graphic/graphic-service/common-contribution.js.map +1 -1
  578. package/es/graphic/graphic-service/graphic-module.js +1 -23
  579. package/es/graphic/graphic-service/graphic-module.js.map +1 -1
  580. package/es/graphic/graphic-service/graphic-service.d.ts +5 -9
  581. package/es/graphic/graphic-service/graphic-service.js +44 -34
  582. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  583. package/es/graphic/graphic-service/path-contribution.d.ts +1 -5
  584. package/es/graphic/graphic-service/path-contribution.js +0 -15
  585. package/es/graphic/graphic-service/path-contribution.js.map +1 -1
  586. package/es/graphic/graphic-service/rect-contribution.d.ts +1 -5
  587. package/es/graphic/graphic-service/rect-contribution.js +0 -15
  588. package/es/graphic/graphic-service/rect-contribution.js.map +1 -1
  589. package/es/graphic/graphic-service/symbol-contribution.d.ts +0 -1
  590. package/es/graphic/graphic-service/symbol-contribution.js +2 -16
  591. package/es/graphic/graphic-service/symbol-contribution.js.map +1 -1
  592. package/es/graphic/graphic.js +8 -6
  593. package/es/graphic/graphic.js.map +1 -1
  594. package/es/graphic/group.d.ts +1 -0
  595. package/es/graphic/group.js +8 -1
  596. package/es/graphic/group.js.map +1 -1
  597. package/es/graphic/index.d.ts +1 -0
  598. package/es/graphic/index.js +2 -0
  599. package/es/graphic/index.js.map +1 -1
  600. package/es/graphic/line.js +1 -0
  601. package/es/graphic/line.js.map +1 -1
  602. package/es/graphic/node-tree.js +2 -2
  603. package/es/graphic/node-tree.js.map +1 -1
  604. package/es/graphic/rect.d.ts +2 -3
  605. package/es/graphic/rect.js +3 -7
  606. package/es/graphic/rect.js.map +1 -1
  607. package/es/graphic/richtext/line.d.ts +1 -0
  608. package/es/graphic/richtext/line.js +6 -4
  609. package/es/graphic/richtext/line.js.map +1 -1
  610. package/es/graphic/richtext/paragraph.js +5 -2
  611. package/es/graphic/richtext/paragraph.js.map +1 -1
  612. package/es/graphic/richtext/utils.js +2 -1
  613. package/es/graphic/richtext/utils.js.map +1 -1
  614. package/es/graphic/richtext.d.ts +3 -3
  615. package/es/graphic/richtext.js +12 -3
  616. package/es/graphic/richtext.js.map +1 -1
  617. package/es/graphic/symbol.js +11 -10
  618. package/es/graphic/symbol.js.map +1 -1
  619. package/es/graphic/text.d.ts +1 -0
  620. package/es/graphic/text.js +94 -13
  621. package/es/graphic/text.js.map +1 -1
  622. package/es/graphic/theme.d.ts +4 -4
  623. package/es/graphic/theme.js +27 -28
  624. package/es/graphic/theme.js.map +1 -1
  625. package/es/graphic/tools.js +1 -1
  626. package/es/graphic/tools.js.map +1 -1
  627. package/es/graphic/wrap-text.js +6 -4
  628. package/es/graphic/wrap-text.js.map +1 -1
  629. package/es/index.d.ts +18 -0
  630. package/es/index.js +36 -0
  631. package/es/index.js.map +1 -1
  632. package/es/interface/allocator.d.ts +1 -0
  633. package/es/interface/allocator.js.map +1 -1
  634. package/es/interface/event.d.ts +15 -44
  635. package/es/interface/event.js.map +1 -1
  636. package/es/interface/global.d.ts +1 -0
  637. package/es/interface/global.js.map +1 -1
  638. package/es/interface/graphic/rect.d.ts +2 -0
  639. package/es/interface/graphic/rect.js.map +1 -1
  640. package/es/interface/graphic/richText.d.ts +1 -1
  641. package/es/interface/graphic/richText.js.map +1 -1
  642. package/es/interface/graphic/text.d.ts +5 -1
  643. package/es/interface/graphic/text.js.map +1 -1
  644. package/es/interface/graphic.d.ts +3 -2
  645. package/es/interface/graphic.js.map +1 -1
  646. package/es/interface/render.d.ts +2 -2
  647. package/es/interface/render.js.map +1 -1
  648. package/es/interface/stage.d.ts +8 -1
  649. package/es/interface/stage.js.map +1 -1
  650. package/es/interface/text.d.ts +2 -2
  651. package/es/interface/text.js.map +1 -1
  652. package/es/modules.d.ts +1 -2
  653. package/es/modules.js +0 -4
  654. package/es/modules.js.map +1 -1
  655. package/es/picker/global-picker-service.d.ts +2 -2
  656. package/es/picker/global-picker-service.js +5 -9
  657. package/es/picker/global-picker-service.js.map +1 -1
  658. package/es/picker/pick-interceptor.js +2 -1
  659. package/es/picker/pick-interceptor.js.map +1 -1
  660. package/es/picker/pick-modules.js +1 -4
  661. package/es/picker/pick-modules.js.map +1 -1
  662. package/es/picker/picker-service.d.ts +2 -2
  663. package/es/picker/picker-service.js +10 -6
  664. package/es/picker/picker-service.js.map +1 -1
  665. package/es/plugins/builtin-plugin/flex-layout-plugin.js +12 -6
  666. package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  667. package/es/plugins/builtin-plugin/html-attribute-plugin.js +1 -1
  668. package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  669. package/es/plugins/plugin-modules.js +1 -2
  670. package/es/plugins/plugin-modules.js.map +1 -1
  671. package/es/render/contributions/render/arc-module.d.ts +2 -0
  672. package/es/render/contributions/render/arc-module.js +21 -0
  673. package/es/render/contributions/render/arc-module.js.map +1 -0
  674. package/es/render/contributions/render/arc-render.js +3 -0
  675. package/es/render/contributions/render/arc-render.js.map +1 -1
  676. package/es/render/contributions/render/arc3d-module.d.ts +2 -0
  677. package/es/render/contributions/render/arc3d-module.js +13 -0
  678. package/es/render/contributions/render/arc3d-module.js.map +1 -0
  679. package/es/render/contributions/render/area-module.d.ts +2 -0
  680. package/es/render/contributions/render/area-module.js +23 -0
  681. package/es/render/contributions/render/area-module.js.map +1 -0
  682. package/es/render/contributions/render/area-render.d.ts +1 -0
  683. package/es/render/contributions/render/area-render.js +45 -5
  684. package/es/render/contributions/render/area-render.js.map +1 -1
  685. package/es/render/contributions/render/base-render.d.ts +1 -1
  686. package/es/render/contributions/render/base-render.js +15 -22
  687. package/es/render/contributions/render/base-render.js.map +1 -1
  688. package/es/render/contributions/render/circle-module.d.ts +2 -0
  689. package/es/render/contributions/render/circle-module.js +21 -0
  690. package/es/render/contributions/render/circle-module.js.map +1 -0
  691. package/es/render/contributions/render/circle-render.js +3 -0
  692. package/es/render/contributions/render/circle-render.js.map +1 -1
  693. package/es/render/contributions/render/contributions/arc-contribution-render.d.ts +3 -7
  694. package/es/render/contributions/render/contributions/arc-contribution-render.js +6 -32
  695. package/es/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
  696. package/es/render/contributions/render/contributions/area-contribution-render.d.ts +3 -4
  697. package/es/render/contributions/render/contributions/area-contribution-render.js +5 -23
  698. package/es/render/contributions/render/contributions/area-contribution-render.js.map +1 -1
  699. package/es/render/contributions/render/contributions/base-contribution-render.d.ts +4 -0
  700. package/es/render/contributions/render/contributions/base-contribution-render.js +21 -16
  701. package/es/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  702. package/es/render/contributions/render/contributions/circle-contribution-render.d.ts +3 -7
  703. package/es/render/contributions/render/contributions/circle-contribution-render.js +6 -32
  704. package/es/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
  705. package/es/render/contributions/render/contributions/constants.d.ts +1 -0
  706. package/es/render/contributions/render/contributions/constants.js +2 -0
  707. package/es/render/contributions/render/contributions/constants.js.map +1 -1
  708. package/es/render/contributions/render/contributions/group-contribution-render.d.ts +1 -0
  709. package/es/render/contributions/render/contributions/group-contribution-render.js +5 -15
  710. package/es/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
  711. package/es/render/contributions/render/contributions/image-contribution-render.d.ts +1 -0
  712. package/es/render/contributions/render/contributions/image-contribution-render.js +6 -17
  713. package/es/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
  714. package/es/render/contributions/render/contributions/path-contribution-render.d.ts +2 -9
  715. package/es/render/contributions/render/contributions/path-contribution-render.js +3 -29
  716. package/es/render/contributions/render/contributions/path-contribution-render.js.map +1 -1
  717. package/es/render/contributions/render/contributions/polygon-contribution-render.d.ts +2 -9
  718. package/es/render/contributions/render/contributions/polygon-contribution-render.js +3 -29
  719. package/es/render/contributions/render/contributions/polygon-contribution-render.js.map +1 -1
  720. package/es/render/contributions/render/contributions/rect-contribution-render.d.ts +5 -7
  721. package/es/render/contributions/render/contributions/rect-contribution-render.js +19 -46
  722. package/es/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  723. package/es/render/contributions/render/contributions/symbol-contribution-render.d.ts +3 -7
  724. package/es/render/contributions/render/contributions/symbol-contribution-render.js +6 -24
  725. package/es/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  726. package/es/render/contributions/render/contributions/text-contribution-render.d.ts +8 -1
  727. package/es/render/contributions/render/contributions/text-contribution-render.js +24 -1
  728. package/es/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
  729. package/es/render/contributions/render/draw-contribution.d.ts +7 -6
  730. package/es/render/contributions/render/draw-contribution.js +49 -29
  731. package/es/render/contributions/render/draw-contribution.js.map +1 -1
  732. package/es/render/contributions/render/draw-interceptor.d.ts +7 -1
  733. package/es/render/contributions/render/draw-interceptor.js +42 -38
  734. package/es/render/contributions/render/draw-interceptor.js.map +1 -1
  735. package/es/render/contributions/render/glyph-module.d.ts +2 -0
  736. package/es/render/contributions/render/glyph-module.js +13 -0
  737. package/es/render/contributions/render/glyph-module.js.map +1 -0
  738. package/es/render/contributions/render/glyph-render.d.ts +1 -2
  739. package/es/render/contributions/render/glyph-render.js +12 -9
  740. package/es/render/contributions/render/glyph-render.js.map +1 -1
  741. package/es/render/contributions/render/group-render.js +4 -1
  742. package/es/render/contributions/render/group-render.js.map +1 -1
  743. package/es/render/contributions/render/image-module.d.ts +2 -0
  744. package/es/render/contributions/render/image-module.js +20 -0
  745. package/es/render/contributions/render/image-module.js.map +1 -0
  746. package/es/render/contributions/render/image-render.js +5 -2
  747. package/es/render/contributions/render/image-render.js.map +1 -1
  748. package/es/render/contributions/render/incremental-draw-contribution.d.ts +2 -6
  749. package/es/render/contributions/render/incremental-draw-contribution.js +5 -11
  750. package/es/render/contributions/render/incremental-draw-contribution.js.map +1 -1
  751. package/es/render/contributions/render/line-module.d.ts +2 -0
  752. package/es/render/contributions/render/line-module.js +16 -0
  753. package/es/render/contributions/render/line-module.js.map +1 -0
  754. package/es/render/contributions/render/line-render.d.ts +1 -0
  755. package/es/render/contributions/render/line-render.js +21 -6
  756. package/es/render/contributions/render/line-render.js.map +1 -1
  757. package/es/render/contributions/render/module.js +8 -129
  758. package/es/render/contributions/render/module.js.map +1 -1
  759. package/es/render/contributions/render/path-module.d.ts +2 -0
  760. package/es/render/contributions/render/path-module.js +21 -0
  761. package/es/render/contributions/render/path-module.js.map +1 -0
  762. package/es/render/contributions/render/path-render.d.ts +2 -1
  763. package/es/render/contributions/render/path-render.js +8 -4
  764. package/es/render/contributions/render/path-render.js.map +1 -1
  765. package/es/render/contributions/render/polygon-module.d.ts +2 -0
  766. package/es/render/contributions/render/polygon-module.js +20 -0
  767. package/es/render/contributions/render/polygon-module.js.map +1 -0
  768. package/es/render/contributions/render/polygon-render.js +3 -0
  769. package/es/render/contributions/render/polygon-render.js.map +1 -1
  770. package/es/render/contributions/render/pyramid3d-module.d.ts +2 -0
  771. package/es/render/contributions/render/pyramid3d-module.js +13 -0
  772. package/es/render/contributions/render/pyramid3d-module.js.map +1 -0
  773. package/es/render/contributions/render/rect-module.d.ts +2 -0
  774. package/es/render/contributions/render/rect-module.js +21 -0
  775. package/es/render/contributions/render/rect-module.js.map +1 -0
  776. package/es/render/contributions/render/rect-render.d.ts +2 -1
  777. package/es/render/contributions/render/rect-render.js +11 -3
  778. package/es/render/contributions/render/rect-render.js.map +1 -1
  779. package/es/render/contributions/render/rect3d-module.d.ts +2 -0
  780. package/es/render/contributions/render/rect3d-module.js +13 -0
  781. package/es/render/contributions/render/rect3d-module.js.map +1 -0
  782. package/es/render/contributions/render/render-slector.d.ts +1 -4
  783. package/es/render/contributions/render/render-slector.js +0 -15
  784. package/es/render/contributions/render/render-slector.js.map +1 -1
  785. package/es/render/contributions/render/richtext-module.d.ts +2 -0
  786. package/es/render/contributions/render/richtext-module.js +13 -0
  787. package/es/render/contributions/render/richtext-module.js.map +1 -0
  788. package/es/render/contributions/render/richtext-render.d.ts +1 -0
  789. package/es/render/contributions/render/richtext-render.js +12 -6
  790. package/es/render/contributions/render/richtext-render.js.map +1 -1
  791. package/es/render/contributions/render/symbol-module.d.ts +2 -0
  792. package/es/render/contributions/render/symbol-module.js +21 -0
  793. package/es/render/contributions/render/symbol-module.js.map +1 -0
  794. package/es/render/contributions/render/symbol-render.js +23 -4
  795. package/es/render/contributions/render/symbol-render.js.map +1 -1
  796. package/es/render/contributions/render/text-module.d.ts +2 -0
  797. package/es/render/contributions/render/text-module.js +20 -0
  798. package/es/render/contributions/render/text-module.js.map +1 -0
  799. package/es/render/contributions/render/text-render.js +16 -10
  800. package/es/render/contributions/render/text-render.js.map +1 -1
  801. package/es/render/contributions/render/utils.js +2 -2
  802. package/es/render/contributions/render/utils.js.map +1 -1
  803. package/es/render/render-modules.js +1 -1
  804. package/es/render/render-modules.js.map +1 -1
  805. package/es/render/render-service.js +1 -1
  806. package/es/render/render-service.js.map +1 -1
  807. package/es/resource-loader/loader.js +1 -3
  808. package/es/resource-loader/loader.js.map +1 -1
  809. package/package.json +7 -3
  810. package/cjs/common/inversify-lite/annotation/post_construct.d.ts +0 -4
  811. package/cjs/common/inversify-lite/annotation/post_construct.js.map +0 -1
  812. package/es/common/inversify-lite/annotation/post_construct.d.ts +0 -4
  813. package/es/common/inversify-lite/annotation/post_construct.js +0 -10
  814. package/es/common/inversify-lite/annotation/post_construct.js.map +0 -1
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.Text = void 0;
6
6
 
7
- const vutils_1 = require("@visactor/vutils"), text_1 = require("../common/text"), layout_1 = require("../core/contributions/textMeasure/layout"), application_1 = require("../application"), graphic_1 = require("./graphic"), theme_1 = require("./theme"), utils_1 = require("../common/utils"), constants_1 = require("./constants"), tools_1 = require("./tools"), TEXT_UPDATE_TAG_KEY = [ "text", "maxLineWidth", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", ...graphic_1.GRAPHIC_UPDATE_TAG_KEY ];
7
+ const vutils_1 = require("@visactor/vutils"), text_1 = require("../common/text"), layout_1 = require("../core/contributions/textMeasure/layout"), application_1 = require("../application"), graphic_1 = require("./graphic"), theme_1 = require("./theme"), utils_1 = require("../common/utils"), constants_1 = require("./constants"), tools_1 = require("./tools"), TEXT_UPDATE_TAG_KEY = [ "text", "maxLineWidth", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", ...graphic_1.GRAPHIC_UPDATE_TAG_KEY ];
8
8
 
9
9
  class Text extends graphic_1.Graphic {
10
10
  get font() {
@@ -53,6 +53,85 @@ class Text extends graphic_1.Graphic {
53
53
  return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(),
54
54
  bounds;
55
55
  }
56
+ updateWrapAABBBounds(text) {
57
+ var _a, _b, _c, _d;
58
+ const textTheme = (0, theme_1.getTheme)(this).text, {fontFamily: fontFamily = textTheme.fontFamily, textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline, fontSize: fontSize = textTheme.fontSize, ellipsis: ellipsis = textTheme.ellipsis, maxLineWidth: maxLineWidth, stroke: stroke = textTheme.stroke, lineWidth: lineWidth = textTheme.lineWidth, wordBreak: wordBreak = textTheme.wordBreak, fontWeight: fontWeight = textTheme.fontWeight, ignoreBuf: ignoreBuf = textTheme.ignoreBuf, heightLimit: heightLimit = 0, lineClamp: lineClamp} = this.attribute, lineHeight = null !== (_a = (0,
59
+ utils_1.calculateLineHeight)(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize, buf = ignoreBuf ? 0 : 2;
60
+ if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
61
+ const bbox = this.cache.layoutData.bbox;
62
+ return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height),
63
+ stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
64
+ }
65
+ const textMeasure = application_1.application.graphicUtil.textMeasure, layoutObj = new layout_1.CanvasTextLayout(fontFamily, {
66
+ fontSize: fontSize,
67
+ fontWeight: fontWeight,
68
+ fontFamily: fontFamily
69
+ }, textMeasure), lines = (0, vutils_1.isArray)(text) ? text.map((l => l.toString())) : [ text.toString() ], linesLayout = [], bboxWH = [ 0, 0 ];
70
+ let lineCountLimit = 1 / 0;
71
+ if (heightLimit > 0 && (lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1)),
72
+ lineClamp && (lineCountLimit = Math.min(lineCountLimit, lineClamp)), "number" == typeof maxLineWidth && maxLineWidth !== 1 / 0) {
73
+ if (maxLineWidth > 0) for (let i = 0; i < lines.length; i++) {
74
+ const str = lines[i];
75
+ let needCut = !0;
76
+ if (i === lineCountLimit - 1) {
77
+ const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
78
+ linesLayout.push({
79
+ str: clip.str,
80
+ width: clip.width
81
+ });
82
+ break;
83
+ }
84
+ const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, "break-word" === wordBreak);
85
+ if ("" !== str && "" === clip.str) {
86
+ if (ellipsis) {
87
+ const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
88
+ clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
89
+ } else clip.str = "", clip.width = 0;
90
+ needCut = !1;
91
+ }
92
+ if (linesLayout.push({
93
+ str: clip.str,
94
+ width: clip.width
95
+ }), clip.str.length === str.length) ; else if (needCut) {
96
+ const newStr = str.substring(clip.str.length);
97
+ lines.splice(i + 1, 0, newStr);
98
+ }
99
+ }
100
+ let maxWidth = 0;
101
+ linesLayout.forEach((layout => {
102
+ maxWidth = Math.max(maxWidth, layout.width);
103
+ })), bboxWH[0] = maxWidth;
104
+ } else {
105
+ let width, text, lineWidth = 0;
106
+ for (let i = 0, len = lines.length; i < len; i++) {
107
+ if (i === lineCountLimit - 1) {
108
+ const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, !1);
109
+ linesLayout.push({
110
+ str: clip.str,
111
+ width: clip.width
112
+ }), lineWidth = Math.max(lineWidth, clip.width);
113
+ break;
114
+ }
115
+ text = lines[i], width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, "break-word" === wordBreak),
116
+ lineWidth = Math.max(lineWidth, width), linesLayout.push({
117
+ str: text,
118
+ width: width
119
+ });
120
+ }
121
+ bboxWH[0] = lineWidth;
122
+ }
123
+ bboxWH[1] = linesLayout.length * (lineHeight + buf);
124
+ const bbox = {
125
+ xOffset: 0,
126
+ yOffset: 0,
127
+ width: bboxWH[0],
128
+ height: bboxWH[1]
129
+ };
130
+ layoutObj.LayoutBBox(bbox, textAlign, textBaseline);
131
+ const layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
132
+ return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height),
133
+ stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
134
+ }
56
135
  updateSingallineAABBBounds(text) {
57
136
  const textTheme = (0, theme_1.getTheme)(this).text, {direction: direction = textTheme.direction} = this.attribute;
58
137
  return "horizontal" === direction ? this.updateHorizontalSinglelineAABBBounds(text) : this.updateVerticalSinglelineAABBBounds(text);
@@ -65,7 +144,10 @@ class Text extends graphic_1.Graphic {
65
144
  var _a, _b;
66
145
  const textTheme = (0, theme_1.getTheme)(this).text, textMeasure = application_1.application.graphicUtil.textMeasure;
67
146
  let width, str;
68
- const attribute = this.attribute, {maxLineWidth: maxLineWidth = textTheme.maxLineWidth, ellipsis: ellipsis = textTheme.ellipsis, textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline, fontFamily: fontFamily = textTheme.fontFamily, fontSize: fontSize = textTheme.fontSize, fontWeight: fontWeight = textTheme.fontWeight, stroke: stroke = textTheme.stroke, lineWidth: lineWidth = textTheme.lineWidth, wordBreak: wordBreak = textTheme.wordBreak, ignoreBuf: ignoreBuf = textTheme.ignoreBuf} = attribute, buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize), {lineHeight: lineHeight = (null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf)} = attribute;
147
+ const attribute = this.attribute, {maxLineWidth: maxLineWidth = textTheme.maxLineWidth, ellipsis: ellipsis = textTheme.ellipsis, textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline, fontFamily: fontFamily = textTheme.fontFamily, fontSize: fontSize = textTheme.fontSize, fontWeight: fontWeight = textTheme.fontWeight, stroke: stroke = textTheme.stroke, lineWidth: lineWidth = textTheme.lineWidth, ignoreBuf: ignoreBuf = textTheme.ignoreBuf, whiteSpace: whiteSpace = textTheme.whiteSpace, suffixPosition: suffixPosition = textTheme.suffixPosition} = attribute;
148
+ if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
149
+ const buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize), textFontSize = attribute.fontSize || textTheme.fontSize, lineHeight = null !== (_a = (0,
150
+ utils_1.calculateLineHeight)(attribute.lineHeight, textFontSize)) && void 0 !== _a ? _a : textFontSize + buf;
69
151
  if (!this.shouldUpdateShape() && this.cache) {
70
152
  width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
71
153
  const dx = (0, text_1.textDrawOffsetX)(textAlign, width), dy = (0, text_1.textLayoutOffsetY)(textBaseline, lineHeight, fontSize);
@@ -78,7 +160,7 @@ class Text extends graphic_1.Graphic {
78
160
  fontSize: fontSize,
79
161
  fontWeight: fontWeight,
80
162
  fontFamily: fontFamily
81
- }, maxLineWidth, strEllipsis, !1);
163
+ }, maxLineWidth, strEllipsis, !1, suffixPosition);
82
164
  str = data.str, width = data.width;
83
165
  } else {
84
166
  const data = textMeasure.clipText(text.toString(), {
@@ -112,7 +194,8 @@ class Text extends graphic_1.Graphic {
112
194
  var _a, _b, _c;
113
195
  const textTheme = (0, theme_1.getTheme)(this).text, textMeasure = application_1.application.graphicUtil.textMeasure;
114
196
  let width;
115
- const attribute = this.attribute, {ignoreBuf: ignoreBuf = textTheme.ignoreBuf} = attribute, buf = ignoreBuf ? 0 : 2, {maxLineWidth: maxLineWidth = textTheme.maxLineWidth, ellipsis: ellipsis = textTheme.ellipsis, fontSize: fontSize = textTheme.fontSize, fontWeight: fontWeight = textTheme.fontWeight, fontFamily: fontFamily = textTheme.fontFamily, stroke: stroke = textTheme.stroke, lineHeight: lineHeight = (null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf), lineWidth: lineWidth = textTheme.lineWidth, verticalMode: verticalMode = textTheme.verticalMode} = attribute;
197
+ const attribute = this.attribute, {ignoreBuf: ignoreBuf = textTheme.ignoreBuf} = attribute, buf = ignoreBuf ? 0 : 2, {maxLineWidth: maxLineWidth = textTheme.maxLineWidth, ellipsis: ellipsis = textTheme.ellipsis, fontSize: fontSize = textTheme.fontSize, fontWeight: fontWeight = textTheme.fontWeight, fontFamily: fontFamily = textTheme.fontFamily, stroke: stroke = textTheme.stroke, lineWidth: lineWidth = textTheme.lineWidth, verticalMode: verticalMode = textTheme.verticalMode, suffixPosition: suffixPosition = textTheme.suffixPosition} = attribute, lineHeight = null !== (_a = (0,
198
+ utils_1.calculateLineHeight)(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
116
199
  let {textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline} = attribute;
117
200
  if (!verticalMode) {
118
201
  const t = textAlign;
@@ -132,7 +215,7 @@ class Text extends graphic_1.Graphic {
132
215
  fontSize: fontSize,
133
216
  fontWeight: fontWeight,
134
217
  fontFamily: fontFamily
135
- }, maxLineWidth, strEllipsis, !1);
218
+ }, maxLineWidth, strEllipsis, !1, suffixPosition);
136
219
  verticalList = [ data.verticalList ], width = data.width;
137
220
  } else {
138
221
  const data = textMeasure.clipTextVertical(verticalList[0], {
@@ -157,9 +240,11 @@ class Text extends graphic_1.Graphic {
157
240
  this._AABBBounds;
158
241
  }
159
242
  updateHorizontalMultilineAABBBounds(text) {
160
- var _a;
161
- const textTheme = (0, theme_1.getTheme)(this).text, attribute = this.attribute, {fontFamily: fontFamily = textTheme.fontFamily, textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline, fontSize: fontSize = textTheme.fontSize, fontWeight: fontWeight = textTheme.fontWeight, lineHeight: lineHeight = attribute.lineHeight || attribute.fontSize || textTheme.fontSize, ellipsis: ellipsis = textTheme.ellipsis, maxLineWidth: maxLineWidth, stroke: stroke = textTheme.stroke, lineWidth: lineWidth = textTheme.lineWidth, wordBreak: wordBreak = textTheme.wordBreak} = attribute;
162
- if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
243
+ var _a, _b;
244
+ const textTheme = (0, theme_1.getTheme)(this).text, attribute = this.attribute, {fontFamily: fontFamily = textTheme.fontFamily, textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline, fontSize: fontSize = textTheme.fontSize, fontWeight: fontWeight = textTheme.fontWeight, ellipsis: ellipsis = textTheme.ellipsis, maxLineWidth: maxLineWidth, stroke: stroke = textTheme.stroke, lineWidth: lineWidth = textTheme.lineWidth, whiteSpace: whiteSpace = textTheme.whiteSpace, suffixPosition: suffixPosition = textTheme.suffixPosition} = attribute, lineHeight = null !== (_a = (0,
245
+ utils_1.calculateLineHeight)(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
246
+ if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
247
+ if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
163
248
  const bbox = this.cache.layoutData.bbox;
164
249
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height),
165
250
  stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
@@ -168,7 +253,7 @@ class Text extends graphic_1.Graphic {
168
253
  fontSize: fontSize,
169
254
  fontWeight: fontWeight,
170
255
  fontFamily: fontFamily
171
- }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, maxLineWidth), {bbox: bbox} = layoutData;
256
+ }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, maxLineWidth, suffixPosition), {bbox: bbox} = layoutData;
172
257
  return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height),
173
258
  stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
174
259
  }
@@ -176,7 +261,8 @@ class Text extends graphic_1.Graphic {
176
261
  var _a, _b, _c;
177
262
  const textTheme = (0, theme_1.getTheme)(this).text, textMeasure = application_1.application.graphicUtil.textMeasure;
178
263
  let width;
179
- const attribute = this.attribute, {ignoreBuf: ignoreBuf = textTheme.ignoreBuf} = attribute, buf = ignoreBuf ? 0 : 2, {maxLineWidth: maxLineWidth = textTheme.maxLineWidth, ellipsis: ellipsis = textTheme.ellipsis, fontFamily: fontFamily = textTheme.fontFamily, fontSize: fontSize = textTheme.fontSize, fontWeight: fontWeight = textTheme.fontWeight, stroke: stroke = textTheme.stroke, lineHeight: lineHeight = (null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf), lineWidth: lineWidth = textTheme.lineWidth, verticalMode: verticalMode = textTheme.verticalMode} = attribute;
264
+ const attribute = this.attribute, {ignoreBuf: ignoreBuf = textTheme.ignoreBuf} = attribute, buf = ignoreBuf ? 0 : 2, {maxLineWidth: maxLineWidth = textTheme.maxLineWidth, ellipsis: ellipsis = textTheme.ellipsis, fontFamily: fontFamily = textTheme.fontFamily, fontSize: fontSize = textTheme.fontSize, fontWeight: fontWeight = textTheme.fontWeight, stroke: stroke = textTheme.stroke, lineWidth: lineWidth = textTheme.lineWidth, verticalMode: verticalMode = textTheme.verticalMode, suffixPosition: suffixPosition = textTheme.suffixPosition} = attribute, lineHeight = null !== (_a = (0,
265
+ utils_1.calculateLineHeight)(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
180
266
  let {textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline} = attribute;
181
267
  if (!verticalMode) {
182
268
  const t = textAlign;
@@ -200,7 +286,7 @@ class Text extends graphic_1.Graphic {
200
286
  fontSize: fontSize,
201
287
  fontWeight: fontWeight,
202
288
  fontFamily: fontFamily
203
- }, maxLineWidth, strEllipsis, !1);
289
+ }, maxLineWidth, strEllipsis, !1, suffixPosition);
204
290
  verticalLists[i] = data.verticalList, width = data.width;
205
291
  } else {
206
292
  const data = textMeasure.clipTextVertical(verticalData, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graphic/text.ts"],"names":[],"mappings":";;;AAAA,6CAAwE;AACxE,yCAAoF;AACpF,qEAA4E;AAC5E,gDAA6C;AAE7C,uCAAiF;AACjF,mCAAmC;AACnC,2CAA+C;AAC/C,2CAA+C;AAC/C,mCAAwD;AAExD,MAAM,mBAAmB,GAAG;IAC1B,MAAM;IACN,cAAc;IAGd,UAAU;IACV,YAAY;IACZ,YAAY;IACZ,UAAU;IACV,YAAY;IACZ,WAAW;IACX,WAAW;IACX,GAAG,gCAAsB;CAC1B,CAAC;AAEF,MAAa,IAAK,SAAQ,iBAA8B;IAiBtD,IAAI,IAAI;QACN,MAAM,SAAS,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC,IAAI,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACf,IAAI,CAAC,KAAK,GAAG,IAAA,qBAAc,EAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;SACxD;QACD,OAAO,IAAI,CAAC,KAAe,CAAC;IAC9B,CAAC;IAED,IAAI,UAAU;;QACZ,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QACjC,MAAM,SAAS,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC,IAAI,CAAC;QACtC,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;YACjC,OAAO,SAAS,CAAC;SAClB;QACD,MAAM,EA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AC,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,KAAK;QACH,OAAO,IAAI,IAAI,mBAAM,IAAI,CAAC,SAAS,EAAG,CAAC;IACzC,CAAC;IAED,oBAAoB;QAClB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;;AAvfH,oBAwfC;AArfQ,wBAAmB,mBACxB,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,CAAC,EACZ,SAAS,EAAE,CAAC,EACZ,SAAS,EAAE,CAAC,EACZ,YAAY,EAAE,CAAC,EACf,UAAU,EAAE,CAAC,EACb,UAAU,EAAE,CAAC,IACV,6BAAmB,EACtB;AA0MK,qBAAgB,GAAG;IACxB,GAAG,EAAE,MAAM;IACX,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEK,qBAAgB,GAAG;IACxB,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;CACjB,CAAC","file":"text.js","sourcesContent":["import { max, type AABBBounds, type OBBBounds } from '@visactor/vutils';\nimport { getContextFont, textDrawOffsetX, textLayoutOffsetY } from '../common/text';\nimport { CanvasTextLayout } from '../core/contributions/textMeasure/layout';\nimport { application } from '../application';\nimport type { IText, ITextCache, ITextGraphicAttribute, LayoutType } from '../interface';\nimport { Graphic, GRAPHIC_UPDATE_TAG_KEY, NOWORK_ANIMATE_ATTR } from './graphic';\nimport { getTheme } from './theme';\nimport { parsePadding } from '../common/utils';\nimport { TEXT_NUMBER_TYPE } from './constants';\nimport { TextDirection, verticalLayout } from './tools';\n\nconst TEXT_UPDATE_TAG_KEY = [\n 'text',\n 'maxLineWidth',\n // 'textAlign',\n // 'textBaseline',\n 'fontSize',\n 'fontFamily',\n 'fontWeight',\n 'ellipsis',\n 'lineHeight',\n 'direction',\n 'wordBreak',\n ...GRAPHIC_UPDATE_TAG_KEY\n];\n\nexport class Text extends Graphic<ITextGraphicAttribute> implements IText {\n type: 'text' = 'text';\n\n static NOWORK_ANIMATE_ATTR = {\n ellipsis: 1,\n wordBreak: 1,\n direction: 1,\n textAlign: 1,\n textBaseline: 1,\n fontFamily: 1,\n fontWeight: 1,\n ...NOWORK_ANIMATE_ATTR\n };\n\n cache: ITextCache;\n _font: string;\n\n get font(): string {\n const textTheme = getTheme(this).text;\n if (!this._font) {\n this._font = getContextFont(this.attribute, textTheme);\n }\n return this._font as string;\n }\n\n get clipedText(): string | undefined {\n const attribute = this.attribute;\n const textTheme = getTheme(this).text;\n if (Array.isArray(attribute.text)) {\n return undefined;\n }\n const { maxLineWidth = textTheme.maxLineWidth } = attribute;\n if (!Number.isFinite(maxLineWidth)) {\n return (attribute.text ?? textTheme.text).toString();\n }\n this.tryUpdateAABBBounds();\n return this.cache.clipedText;\n }\n get clipedWidth(): number | undefined {\n if (Array.isArray(this.attribute.text)) {\n return undefined;\n }\n this.tryUpdateAABBBounds();\n return this.cache.clipedWidth;\n }\n get cliped(): boolean | undefined {\n const textTheme = getTheme(this).text;\n const attribute = this.attribute;\n if (Array.isArray(attribute.text)) {\n return undefined;\n }\n const { maxLineWidth = textTheme.maxLineWidth } = attribute;\n if (!Number.isFinite(maxLineWidth)) {\n return false;\n }\n this.tryUpdateAABBBounds();\n return this.clipedText !== attribute.text.toString();\n }\n get multilineLayout(): LayoutType | undefined {\n if (!Array.isArray(this.attribute.text)) {\n return undefined;\n }\n this.tryUpdateAABBBounds();\n return this.cache.layoutData;\n }\n\n constructor(params: ITextGraphicAttribute = { text: '', fontSize: 16 }) {\n super(params);\n this.numberType = TEXT_NUMBER_TYPE;\n this.cache = {};\n }\n\n isValid(): boolean {\n return super.isValid() && this._isValid();\n }\n protected _isValid(): boolean {\n const { text } = this.attribute;\n return text != null && text !== '';\n }\n\n protected doUpdateAABBBounds(): AABBBounds {\n const textTheme = getTheme(this).text;\n this._AABBBounds.setValue(Infinity, Infinity, -Infinity, -Infinity);\n const attribute = this.attribute;\n const bounds = application.graphicService.updateTextAABBBounds(\n attribute,\n textTheme,\n this._AABBBounds,\n this\n ) as AABBBounds;\n\n const { boundsPadding = textTheme.boundsPadding } = this.attribute;\n const paddingArray = parsePadding(boundsPadding);\n if (paddingArray) {\n bounds.expand(paddingArray);\n }\n\n this.clearUpdateBoundTag();\n return bounds;\n }\n\n /**\n * 计算单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateSingallineAABBBounds(text: number | string): AABBBounds {\n const textTheme = getTheme(this).text;\n const { direction = textTheme.direction } = this.attribute;\n\n return direction === 'horizontal'\n ? this.updateHorizontalSinglelineAABBBounds(text)\n : this.updateVerticalSinglelineAABBBounds(text);\n }\n\n /**\n * 计算单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateMultilineAABBBounds(text: (number | string)[]): AABBBounds {\n const textTheme = getTheme(this).text;\n const { direction = textTheme.direction } = this.attribute;\n\n return direction === 'horizontal'\n ? this.updateHorizontalMultilineAABBBounds(text)\n : this.updateVerticalMultilineAABBBounds(text);\n }\n\n /**\n * 计算单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateHorizontalSinglelineAABBBounds(text: number | string): AABBBounds {\n const textTheme = getTheme(this).text;\n const textMeasure = application.graphicUtil.textMeasure;\n let width: number;\n let str: string;\n const attribute = this.attribute;\n const {\n maxLineWidth = textTheme.maxLineWidth,\n ellipsis = textTheme.ellipsis,\n textAlign = textTheme.textAlign,\n textBaseline = textTheme.textBaseline,\n fontFamily = textTheme.fontFamily,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n stroke = textTheme.stroke,\n lineWidth = textTheme.lineWidth,\n wordBreak = textTheme.wordBreak,\n ignoreBuf = textTheme.ignoreBuf\n } = attribute;\n const buf = ignoreBuf ? 0 : Math.max(2, fontSize * 0.075);\n const { lineHeight = attribute.lineHeight ?? (attribute.fontSize || textTheme.fontSize) + buf } = attribute;\n if (!this.shouldUpdateShape() && this.cache) {\n width = this.cache.clipedWidth ?? 0;\n const dx = textDrawOffsetX(textAlign, width);\n const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n if (Number.isFinite(maxLineWidth)) {\n if (ellipsis) {\n const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n const data = textMeasure.clipTextWithSuffix(\n text.toString(),\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n strEllipsis,\n false\n );\n str = data.str;\n width = data.width;\n } else {\n const data = textMeasure.clipText(text.toString(), { fontSize, fontWeight, fontFamily }, maxLineWidth, false);\n str = data.str;\n width = data.width;\n }\n this.cache.clipedText = str;\n this.cache.clipedWidth = width;\n // todo 计算原本的宽度\n } else {\n width = textMeasure.measureTextWidth(text.toString(), { fontSize, fontWeight, fontFamily });\n this.cache.clipedText = text.toString();\n this.cache.clipedWidth = width;\n }\n this.clearUpdateShapeTag();\n\n const dx = textDrawOffsetX(textAlign, width);\n let lh = lineHeight;\n if (application.global && application.global.isSafari()) {\n // 如果是safari,那么需要额外增加高度\n lh += fontSize * 0.2;\n }\n const dy = textLayoutOffsetY(textBaseline, lh, fontSize, buf);\n this._AABBBounds.set(dx, dy, dx + width, dy + lh);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n getBaselineMapAlign(): Record<string, string> {\n return Text.baselineMapAlign;\n }\n\n getAlignMapBaseline(): Record<string, string> {\n return Text.alignMapBaseline;\n }\n\n static baselineMapAlign = {\n top: 'left',\n bottom: 'right',\n middle: 'center'\n };\n\n static alignMapBaseline = {\n left: 'top',\n right: 'bottom',\n center: 'middle'\n };\n\n /**\n * 计算垂直布局的单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateVerticalSinglelineAABBBounds(text: number | string): AABBBounds {\n const textTheme = getTheme(this).text;\n const textMeasure = application.graphicUtil.textMeasure;\n let width: number;\n let str: string;\n const attribute = this.attribute;\n const { ignoreBuf = textTheme.ignoreBuf } = attribute;\n const buf = ignoreBuf ? 0 : 2;\n const {\n maxLineWidth = textTheme.maxLineWidth,\n ellipsis = textTheme.ellipsis,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n fontFamily = textTheme.fontFamily,\n stroke = textTheme.stroke,\n lineHeight = attribute.lineHeight ?? (attribute.fontSize || textTheme.fontSize) + buf,\n lineWidth = textTheme.lineWidth,\n verticalMode = textTheme.verticalMode\n } = attribute;\n\n let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;\n if (!verticalMode) {\n const t = textAlign;\n textAlign = Text.baselineMapAlign[textBaseline] ?? 'left';\n textBaseline = Text.alignMapBaseline[t] ?? 'top';\n }\n if (!this.shouldUpdateShape() && this.cache) {\n width = this.cache.clipedWidth;\n const dx = textDrawOffsetX(textAlign, width);\n const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n let verticalList: { text: string; width?: number; direction: TextDirection }[][] = [\n verticalLayout(text.toString())\n ];\n if (Number.isFinite(maxLineWidth)) {\n if (ellipsis) {\n const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n const data = textMeasure.clipTextWithSuffixVertical(\n verticalList[0],\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n strEllipsis,\n false\n );\n verticalList = [data.verticalList];\n width = data.width;\n } else {\n const data = textMeasure.clipTextVertical(\n verticalList[0],\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n false\n );\n verticalList = [data.verticalList];\n width = data.width;\n }\n this.cache.verticalList = verticalList;\n this.cache.clipedWidth = width;\n // todo 计算原本的宽度\n } else {\n width = 0;\n verticalList[0].forEach(t => {\n const w =\n t.direction === TextDirection.HORIZONTAL\n ? fontSize\n : textMeasure.measureTextWidth(t.text, { fontSize, fontWeight, fontFamily });\n\n width += w;\n t.width = w;\n });\n this.cache.verticalList = verticalList;\n this.cache.clipedWidth = width;\n }\n this.clearUpdateShapeTag();\n\n const dx = textDrawOffsetX(textAlign, width);\n const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n /**\n * 计算多行文字的bounds,缓存每行文字的布局位置\n * @param text\n */\n updateHorizontalMultilineAABBBounds(text: (number | string)[]): AABBBounds {\n const textTheme = getTheme(this).text;\n const attribute = this.attribute;\n const {\n fontFamily = textTheme.fontFamily,\n textAlign = textTheme.textAlign,\n textBaseline = textTheme.textBaseline,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n lineHeight = attribute.lineHeight || attribute.fontSize || textTheme.fontSize,\n ellipsis = textTheme.ellipsis,\n maxLineWidth,\n stroke = textTheme.stroke,\n lineWidth = textTheme.lineWidth,\n wordBreak = textTheme.wordBreak\n } = attribute;\n\n if (!this.shouldUpdateShape() && this.cache?.layoutData) {\n const bbox = this.cache.layoutData.bbox;\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n const textMeasure = application.graphicUtil.textMeasure;\n const layoutObj = new CanvasTextLayout(fontFamily, { fontSize, fontWeight, fontFamily }, textMeasure);\n const layoutData = layoutObj.GetLayoutByLines(\n text,\n textAlign,\n textBaseline as any,\n lineHeight,\n ellipsis === true ? (textTheme.ellipsis as string) : ellipsis || undefined,\n false,\n maxLineWidth\n );\n const { bbox } = layoutData;\n this.cache.layoutData = layoutData;\n this.clearUpdateShapeTag();\n\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n /**\n * 计算垂直布局的多行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateVerticalMultilineAABBBounds(text: (number | string)[]): AABBBounds {\n const textTheme = getTheme(this).text;\n const textMeasure = application.graphicUtil.textMeasure;\n let width: number;\n const attribute = this.attribute;\n const { ignoreBuf = textTheme.ignoreBuf } = attribute;\n const buf = ignoreBuf ? 0 : 2;\n const {\n maxLineWidth = textTheme.maxLineWidth,\n ellipsis = textTheme.ellipsis,\n fontFamily = textTheme.fontFamily,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n stroke = textTheme.stroke,\n lineHeight = attribute.lineHeight ?? (attribute.fontSize || textTheme.fontSize) + buf,\n lineWidth = textTheme.lineWidth,\n // wordBreak = textTheme.wordBreak,\n verticalMode = textTheme.verticalMode\n } = attribute;\n let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;\n if (!verticalMode) {\n const t = textAlign;\n textAlign = Text.baselineMapAlign[textBaseline] ?? 'left';\n textBaseline = Text.alignMapBaseline[t] ?? 'top';\n }\n width = 0;\n if (!this.shouldUpdateShape() && this.cache) {\n this.cache.verticalList.forEach(item => {\n const w = item.reduce((a, b) => a + b.width, 0);\n width = max(w, width);\n });\n const dx = textDrawOffsetX(textAlign, width);\n const height = this.cache.verticalList.length * lineHeight;\n const dy = textLayoutOffsetY(textBaseline, height, fontSize);\n this._AABBBounds.set(dy, dx, dy + height, dx + width);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n const verticalLists: { text: string; width?: number; direction: TextDirection }[][] = text.map(str => {\n return verticalLayout(str.toString());\n });\n verticalLists.forEach((verticalData, i) => {\n if (Number.isFinite(maxLineWidth)) {\n if (ellipsis) {\n const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n const data = textMeasure.clipTextWithSuffixVertical(\n verticalData,\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n strEllipsis,\n false\n );\n verticalLists[i] = data.verticalList;\n width = data.width;\n } else {\n const data = textMeasure.clipTextVertical(\n verticalData,\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n false\n );\n verticalLists[i] = data.verticalList;\n width = data.width;\n }\n // this.cache.clipedWidth = width;\n // todo 计算原本的宽度\n } else {\n width = 0;\n verticalData.forEach(t => {\n const w =\n t.direction === TextDirection.HORIZONTAL\n ? fontSize\n : textMeasure.measureTextWidth(t.text, { fontSize, fontWeight, fontFamily });\n\n width += w;\n t.width = w;\n });\n }\n });\n this.cache.verticalList = verticalLists;\n this.clearUpdateShapeTag();\n\n this.cache.verticalList.forEach(item => {\n const w = item.reduce((a, b) => a + b.width, 0);\n width = max(w, width);\n });\n\n const dx = textDrawOffsetX(textAlign, width);\n const height = this.cache.verticalList.length * lineHeight;\n const dy = textLayoutOffsetY(textBaseline, height, fontSize);\n this._AABBBounds.set(dy, dx, dy + height, dx + width);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n protected tryUpdateOBBBounds(): OBBBounds {\n throw new Error('暂不支持');\n }\n\n getDefaultAttribute(name: string) {\n const textTheme = getTheme(this).text;\n return textTheme[name];\n }\n\n protected needUpdateTags(keys: string[], k = TEXT_UPDATE_TAG_KEY): boolean {\n return super.needUpdateTags(keys, k);\n }\n protected needUpdateTag(key: string, k = TEXT_UPDATE_TAG_KEY): boolean {\n return super.needUpdateTag(key, k);\n }\n\n clone(): Text {\n return new Text({ ...this.attribute });\n }\n\n getNoWorkAnimateAttr(): Record<string, number> {\n return Text.NOWORK_ANIMATE_ATTR;\n }\n}\n\n// addAttributeToPrototype(DefaultLineStyle, Text, PURE_STYLE_KEY);\n"]}
1
+ {"version":3,"sources":["../src/graphic/text.ts"],"names":[],"mappings":";;;AAAA,6CAAiF;AACjF,yC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AAC,CAAC,IAAI,CAAC;QACtC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAES,cAAc,CAAC,IAAc,EAAE,CAAC,GAAG,mBAAmB;QAC9D,OAAO,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACvC,CAAC;IACS,aAAa,CAAC,GAAW,EAAE,CAAC,GAAG,mBAAmB;QAC1D,OAAO,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,KAAK;QACH,OAAO,IAAI,IAAI,mBAAM,IAAI,CAAC,SAAS,EAAG,CAAC;IACzC,CAAC;IAED,oBAAoB;QAClB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;;AA3sBH,oBA4sBC;AAzsBQ,wBAAmB,mBACxB,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,CAAC,EACZ,SAAS,EAAE,CAAC,EACZ,SAAS,EAAE,CAAC,EACZ,YAAY,EAAE,CAAC,EACf,UAAU,EAAE,CAAC,EACb,UAAU,EAAE,CAAC,IACV,6BAAmB,EACtB;AA+YK,qBAAgB,GAAG;IACxB,GAAG,EAAE,MAAM;IACX,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEK,qBAAgB,GAAG;IACxB,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;CACjB,CAAC","file":"text.js","sourcesContent":["import { max, type AABBBounds, type OBBBounds, isArray } from '@visactor/vutils';\nimport { getContextFont, textDrawOffsetX, textLayoutOffsetY } from '../common/text';\nimport { CanvasTextLayout } from '../core/contributions/textMeasure/layout';\nimport { application } from '../application';\nimport type { IText, ITextCache, ITextGraphicAttribute, LayoutItemType, LayoutType } from '../interface';\nimport { Graphic, GRAPHIC_UPDATE_TAG_KEY, NOWORK_ANIMATE_ATTR } from './graphic';\nimport { getTheme } from './theme';\nimport { calculateLineHeight, parsePadding } from '../common/utils';\nimport { TEXT_NUMBER_TYPE } from './constants';\nimport { TextDirection, verticalLayout } from './tools';\n\nconst TEXT_UPDATE_TAG_KEY = [\n 'text',\n 'maxLineWidth',\n // 'textAlign',\n // 'textBaseline',\n 'heightLimit',\n 'lineClamp',\n 'fontSize',\n 'fontFamily',\n 'fontWeight',\n 'ellipsis',\n 'lineHeight',\n 'direction',\n 'wordBreak',\n ...GRAPHIC_UPDATE_TAG_KEY\n];\n\nexport class Text extends Graphic<ITextGraphicAttribute> implements IText {\n type: 'text' = 'text';\n\n static NOWORK_ANIMATE_ATTR = {\n ellipsis: 1,\n wordBreak: 1,\n direction: 1,\n textAlign: 1,\n textBaseline: 1,\n fontFamily: 1,\n fontWeight: 1,\n ...NOWORK_ANIMATE_ATTR\n };\n\n cache: ITextCache;\n _font: string;\n\n get font(): string {\n const textTheme = getTheme(this).text;\n if (!this._font) {\n this._font = getContextFont(this.attribute, textTheme);\n }\n return this._font as string;\n }\n\n get clipedText(): string | undefined {\n const attribute = this.attribute;\n const textTheme = getTheme(this).text;\n if (Array.isArray(attribute.text)) {\n return undefined;\n }\n const { maxLineWidth = textTheme.maxLineWidth } = attribute;\n if (!Number.isFinite(maxLineWidth)) {\n return (attribute.text ?? textTheme.text).toString();\n }\n this.tryUpdateAABBBounds();\n return this.cache.clipedText;\n }\n get clipedWidth(): number | undefined {\n if (Array.isArray(this.attribute.text)) {\n return undefined;\n }\n this.tryUpdateAABBBounds();\n return this.cache.clipedWidth;\n }\n get cliped(): boolean | undefined {\n const textTheme = getTheme(this).text;\n const attribute = this.attribute;\n if (Array.isArray(attribute.text)) {\n return undefined;\n }\n const { maxLineWidth = textTheme.maxLineWidth } = attribute;\n if (!Number.isFinite(maxLineWidth)) {\n return false;\n }\n this.tryUpdateAABBBounds();\n return this.clipedText !== attribute.text.toString();\n }\n get multilineLayout(): LayoutType | undefined {\n if (!Array.isArray(this.attribute.text)) {\n return undefined;\n }\n this.tryUpdateAABBBounds();\n return this.cache.layoutData;\n }\n\n constructor(params: ITextGraphicAttribute = { text: '', fontSize: 16 }) {\n super(params);\n this.numberType = TEXT_NUMBER_TYPE;\n this.cache = {};\n }\n\n isValid(): boolean {\n return super.isValid() && this._isValid();\n }\n protected _isValid(): boolean {\n const { text } = this.attribute;\n return text != null && text !== '';\n }\n\n protected doUpdateAABBBounds(): AABBBounds {\n const textTheme = getTheme(this).text;\n this._AABBBounds.setValue(Infinity, Infinity, -Infinity, -Infinity);\n const attribute = this.attribute;\n const bounds = application.graphicService.updateTextAABBBounds(\n attribute,\n textTheme,\n this._AABBBounds,\n this\n ) as AABBBounds;\n\n const { boundsPadding = textTheme.boundsPadding } = this.attribute;\n const paddingArray = parsePadding(boundsPadding);\n if (paddingArray) {\n bounds.expand(paddingArray);\n }\n\n this.clearUpdateBoundTag();\n return bounds;\n }\n\n /**\n * 计算多行文字的bounds,缓存每行文字的布局位置\n * 自动折行params.text是数组,因此只重新updateMultilineAABBBounds\n * @param text\n */\n updateWrapAABBBounds(text: (number | string) | (number | string)[]) {\n const textTheme = getTheme(this).text;\n const {\n fontFamily = textTheme.fontFamily,\n textAlign = textTheme.textAlign,\n textBaseline = textTheme.textBaseline,\n fontSize = textTheme.fontSize,\n ellipsis = textTheme.ellipsis,\n maxLineWidth,\n stroke = textTheme.stroke,\n lineWidth = textTheme.lineWidth,\n wordBreak = textTheme.wordBreak,\n fontWeight = textTheme.fontWeight,\n // widthLimit,\n ignoreBuf = textTheme.ignoreBuf,\n heightLimit = 0,\n lineClamp\n } = this.attribute;\n const lineHeight =\n calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize) ??\n (this.attribute.fontSize || textTheme.fontSize);\n const buf = ignoreBuf ? 0 : 2;\n if (!this.shouldUpdateShape() && this.cache?.layoutData) {\n const bbox = this.cache.layoutData.bbox;\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n const textMeasure = application.graphicUtil.textMeasure;\n const layoutObj = new CanvasTextLayout(fontFamily, { fontSize, fontWeight, fontFamily }, textMeasure as any) as any;\n\n // layoutObj内逻辑\n const lines = isArray(text) ? (text.map(l => l.toString()) as string[]) : [text.toString()];\n const linesLayout: LayoutItemType[] = [];\n const bboxWH: [number, number] = [0, 0];\n\n let lineCountLimit = Infinity;\n if (heightLimit > 0) {\n lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1);\n }\n if (lineClamp) {\n // 处理行数限制\n lineCountLimit = Math.min(lineCountLimit, lineClamp);\n }\n\n if (typeof maxLineWidth === 'number' && maxLineWidth !== Infinity) {\n // widthLimit > 0\n if (maxLineWidth > 0) {\n for (let i = 0; i < lines.length; i++) {\n const str = lines[i] as string;\n let needCut = true;\n // // 测量当前行宽度\n // width = Math.min(\n // layoutObj.textMeasure.measureTextWidth(str, layoutObj.textOptions),\n // maxLineWidth\n // );\n\n // 判断是否超过高度限制\n if (i === lineCountLimit - 1) {\n // 当前行为最后一行\n const clip = layoutObj.textMeasure.clipTextWithSuffix(\n str,\n layoutObj.textOptions,\n maxLineWidth,\n ellipsis,\n false\n );\n linesLayout.push({\n str: clip.str,\n width: clip.width\n });\n break; // 不处理后续行\n }\n\n // 测量截断位置\n const clip = layoutObj.textMeasure.clipText(\n str,\n layoutObj.textOptions,\n maxLineWidth,\n wordBreak === 'break-word'\n );\n if (str !== '' && clip.str === '') {\n if (ellipsis) {\n const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(\n str,\n layoutObj.textOptions,\n maxLineWidth,\n ellipsis,\n false\n );\n clip.str = clipEllipsis.str ?? '';\n clip.width = clipEllipsis.width ?? 0;\n } else {\n // 宽度限制不足一个字符,不显示\n clip.str = '';\n clip.width = 0;\n }\n needCut = false;\n }\n\n linesLayout.push({\n str: clip.str,\n width: clip.width\n });\n if (clip.str.length === str.length) {\n // 不需要截断\n } else if (needCut) {\n const newStr = str.substring(clip.str.length);\n lines.splice(i + 1, 0, newStr);\n }\n }\n }\n // bboxWH[0] = maxLineWidth;\n let maxWidth = 0;\n linesLayout.forEach(layout => {\n maxWidth = Math.max(maxWidth, layout.width);\n });\n bboxWH[0] = maxWidth;\n } else {\n // 使用所有行中最长的作为lineWidth\n let lineWidth = 0;\n let width: number;\n let text: string;\n for (let i = 0, len = lines.length; i < len; i++) {\n // 判断是否超过高度限制\n if (i === lineCountLimit - 1) {\n // 当前行为最后一行\n const clip = layoutObj.textMeasure.clipTextWithSuffix(\n lines[i],\n layoutObj.textOptions,\n maxLineWidth,\n ellipsis,\n false\n );\n linesLayout.push({\n str: clip.str,\n width: clip.width\n });\n lineWidth = Math.max(lineWidth, clip.width);\n break; // 不处理后续行\n }\n\n text = lines[i] as string;\n width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, wordBreak === 'break-word');\n lineWidth = Math.max(lineWidth, width);\n linesLayout.push({ str: text, width });\n }\n bboxWH[0] = lineWidth;\n }\n bboxWH[1] = linesLayout.length * (lineHeight + buf);\n\n const bbox = {\n xOffset: 0,\n yOffset: 0,\n width: bboxWH[0],\n height: bboxWH[1]\n };\n\n layoutObj.LayoutBBox(bbox, textAlign, textBaseline as any);\n\n const layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline as any, lineHeight);\n\n // const layoutData = layoutObj.GetLayoutByLines(\n // text,\n // textAlign,\n // textBaseline as any,\n // lineHeight,\n // ellipsis === true ? (DefaultTextAttribute.ellipsis as string) : ellipsis || undefined,\n // maxLineWidth\n // );\n // const { bbox } = layoutData;\n this.cache.layoutData = layoutData;\n this.clearUpdateShapeTag();\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n /**\n * 计算单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateSingallineAABBBounds(text: number | string): AABBBounds {\n const textTheme = getTheme(this).text;\n const { direction = textTheme.direction } = this.attribute;\n\n return direction === 'horizontal'\n ? this.updateHorizontalSinglelineAABBBounds(text)\n : this.updateVerticalSinglelineAABBBounds(text);\n }\n\n /**\n * 计算单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateMultilineAABBBounds(text: (number | string)[]): AABBBounds {\n const textTheme = getTheme(this).text;\n const { direction = textTheme.direction } = this.attribute;\n\n return direction === 'horizontal'\n ? this.updateHorizontalMultilineAABBBounds(text)\n : this.updateVerticalMultilineAABBBounds(text);\n }\n\n /**\n * 计算单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateHorizontalSinglelineAABBBounds(text: number | string): AABBBounds {\n const textTheme = getTheme(this).text;\n const textMeasure = application.graphicUtil.textMeasure;\n let width: number;\n let str: string;\n const attribute = this.attribute;\n const {\n maxLineWidth = textTheme.maxLineWidth,\n ellipsis = textTheme.ellipsis,\n textAlign = textTheme.textAlign,\n textBaseline = textTheme.textBaseline,\n fontFamily = textTheme.fontFamily,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n stroke = textTheme.stroke,\n lineWidth = textTheme.lineWidth,\n // wordBreak = textTheme.wordBreak,\n ignoreBuf = textTheme.ignoreBuf,\n whiteSpace = textTheme.whiteSpace,\n suffixPosition = textTheme.suffixPosition\n } = attribute;\n if (whiteSpace === 'normal') {\n return this.updateWrapAABBBounds(text);\n }\n const buf = ignoreBuf ? 0 : Math.max(2, fontSize * 0.075);\n const textFontSize = attribute.fontSize || textTheme.fontSize;\n const lineHeight = calculateLineHeight(attribute.lineHeight, textFontSize) ?? textFontSize + buf;\n if (!this.shouldUpdateShape() && this.cache) {\n width = this.cache.clipedWidth ?? 0;\n const dx = textDrawOffsetX(textAlign, width);\n const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n if (Number.isFinite(maxLineWidth)) {\n if (ellipsis) {\n const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n const data = textMeasure.clipTextWithSuffix(\n text.toString(),\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n strEllipsis,\n false,\n suffixPosition\n );\n str = data.str;\n width = data.width;\n } else {\n const data = textMeasure.clipText(text.toString(), { fontSize, fontWeight, fontFamily }, maxLineWidth, false);\n str = data.str;\n width = data.width;\n }\n this.cache.clipedText = str;\n this.cache.clipedWidth = width;\n // todo 计算原本的宽度\n } else {\n width = textMeasure.measureTextWidth(text.toString(), { fontSize, fontWeight, fontFamily });\n this.cache.clipedText = text.toString();\n this.cache.clipedWidth = width;\n }\n this.clearUpdateShapeTag();\n\n const dx = textDrawOffsetX(textAlign, width);\n let lh = lineHeight;\n if (application.global && application.global.isSafari()) {\n // 如果是safari,那么需要额外增加高度\n lh += fontSize * 0.2;\n }\n const dy = textLayoutOffsetY(textBaseline, lh, fontSize, buf);\n this._AABBBounds.set(dx, dy, dx + width, dy + lh);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n getBaselineMapAlign(): Record<string, string> {\n return Text.baselineMapAlign;\n }\n\n getAlignMapBaseline(): Record<string, string> {\n return Text.alignMapBaseline;\n }\n\n static baselineMapAlign = {\n top: 'left',\n bottom: 'right',\n middle: 'center'\n };\n\n static alignMapBaseline = {\n left: 'top',\n right: 'bottom',\n center: 'middle'\n };\n\n /**\n * 计算垂直布局的单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateVerticalSinglelineAABBBounds(text: number | string): AABBBounds {\n const textTheme = getTheme(this).text;\n const textMeasure = application.graphicUtil.textMeasure;\n let width: number;\n let str: string;\n const attribute = this.attribute;\n const { ignoreBuf = textTheme.ignoreBuf } = attribute;\n const buf = ignoreBuf ? 0 : 2;\n const {\n maxLineWidth = textTheme.maxLineWidth,\n ellipsis = textTheme.ellipsis,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n fontFamily = textTheme.fontFamily,\n stroke = textTheme.stroke,\n lineWidth = textTheme.lineWidth,\n verticalMode = textTheme.verticalMode,\n suffixPosition = textTheme.suffixPosition\n } = attribute;\n\n const lineHeight =\n calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize) ??\n (attribute.fontSize || textTheme.fontSize) + buf;\n\n let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;\n if (!verticalMode) {\n const t = textAlign;\n textAlign = Text.baselineMapAlign[textBaseline] ?? 'left';\n textBaseline = Text.alignMapBaseline[t] ?? 'top';\n }\n if (!this.shouldUpdateShape() && this.cache) {\n width = this.cache.clipedWidth;\n const dx = textDrawOffsetX(textAlign, width);\n const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n let verticalList: { text: string; width?: number; direction: TextDirection }[][] = [\n verticalLayout(text.toString())\n ];\n if (Number.isFinite(maxLineWidth)) {\n if (ellipsis) {\n const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n const data = textMeasure.clipTextWithSuffixVertical(\n verticalList[0],\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n strEllipsis,\n false,\n suffixPosition\n );\n verticalList = [data.verticalList];\n width = data.width;\n } else {\n const data = textMeasure.clipTextVertical(\n verticalList[0],\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n false\n );\n verticalList = [data.verticalList];\n width = data.width;\n }\n this.cache.verticalList = verticalList;\n this.cache.clipedWidth = width;\n // todo 计算原本的宽度\n } else {\n width = 0;\n verticalList[0].forEach(t => {\n const w =\n t.direction === TextDirection.HORIZONTAL\n ? fontSize\n : textMeasure.measureTextWidth(t.text, { fontSize, fontWeight, fontFamily });\n\n width += w;\n t.width = w;\n });\n this.cache.verticalList = verticalList;\n this.cache.clipedWidth = width;\n }\n this.clearUpdateShapeTag();\n\n const dx = textDrawOffsetX(textAlign, width);\n const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n /**\n * 计算多行文字的bounds,缓存每行文字的布局位置\n * @param text\n */\n updateHorizontalMultilineAABBBounds(text: (number | string)[]): AABBBounds {\n const textTheme = getTheme(this).text;\n const attribute = this.attribute;\n const {\n fontFamily = textTheme.fontFamily,\n textAlign = textTheme.textAlign,\n textBaseline = textTheme.textBaseline,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n ellipsis = textTheme.ellipsis,\n maxLineWidth,\n stroke = textTheme.stroke,\n lineWidth = textTheme.lineWidth,\n whiteSpace = textTheme.whiteSpace,\n suffixPosition = textTheme.suffixPosition\n } = attribute;\n const lineHeight =\n calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize) ??\n (attribute.fontSize || textTheme.fontSize);\n if (whiteSpace === 'normal') {\n return this.updateWrapAABBBounds(text);\n }\n if (!this.shouldUpdateShape() && this.cache?.layoutData) {\n const bbox = this.cache.layoutData.bbox;\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n const textMeasure = application.graphicUtil.textMeasure;\n const layoutObj = new CanvasTextLayout(fontFamily, { fontSize, fontWeight, fontFamily }, textMeasure);\n const layoutData = layoutObj.GetLayoutByLines(\n text,\n textAlign,\n textBaseline as any,\n lineHeight,\n ellipsis === true ? (textTheme.ellipsis as string) : ellipsis || undefined,\n false,\n maxLineWidth,\n suffixPosition\n );\n const { bbox } = layoutData;\n this.cache.layoutData = layoutData;\n this.clearUpdateShapeTag();\n\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n /**\n * 计算垂直布局的多行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateVerticalMultilineAABBBounds(text: (number | string)[]): AABBBounds {\n const textTheme = getTheme(this).text;\n const textMeasure = application.graphicUtil.textMeasure;\n let width: number;\n const attribute = this.attribute;\n const { ignoreBuf = textTheme.ignoreBuf } = attribute;\n const buf = ignoreBuf ? 0 : 2;\n const {\n maxLineWidth = textTheme.maxLineWidth,\n ellipsis = textTheme.ellipsis,\n fontFamily = textTheme.fontFamily,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n stroke = textTheme.stroke,\n lineWidth = textTheme.lineWidth,\n // wordBreak = textTheme.wordBreak,\n verticalMode = textTheme.verticalMode,\n suffixPosition = textTheme.suffixPosition\n } = attribute;\n const lineHeight =\n calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize) ??\n (attribute.fontSize || textTheme.fontSize) + buf;\n let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;\n if (!verticalMode) {\n const t = textAlign;\n textAlign = Text.baselineMapAlign[textBaseline] ?? 'left';\n textBaseline = Text.alignMapBaseline[t] ?? 'top';\n }\n width = 0;\n if (!this.shouldUpdateShape() && this.cache) {\n this.cache.verticalList.forEach(item => {\n const w = item.reduce((a, b) => a + b.width, 0);\n width = max(w, width);\n });\n const dx = textDrawOffsetX(textAlign, width);\n const height = this.cache.verticalList.length * lineHeight;\n const dy = textLayoutOffsetY(textBaseline, height, fontSize);\n this._AABBBounds.set(dy, dx, dy + height, dx + width);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n const verticalLists: { text: string; width?: number; direction: TextDirection }[][] = text.map(str => {\n return verticalLayout(str.toString());\n });\n verticalLists.forEach((verticalData, i) => {\n if (Number.isFinite(maxLineWidth)) {\n if (ellipsis) {\n const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n const data = textMeasure.clipTextWithSuffixVertical(\n verticalData,\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n strEllipsis,\n false,\n suffixPosition\n );\n verticalLists[i] = data.verticalList;\n width = data.width;\n } else {\n const data = textMeasure.clipTextVertical(\n verticalData,\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n false\n );\n verticalLists[i] = data.verticalList;\n width = data.width;\n }\n // this.cache.clipedWidth = width;\n // todo 计算原本的宽度\n } else {\n width = 0;\n verticalData.forEach(t => {\n const w =\n t.direction === TextDirection.HORIZONTAL\n ? fontSize\n : textMeasure.measureTextWidth(t.text, { fontSize, fontWeight, fontFamily });\n\n width += w;\n t.width = w;\n });\n }\n });\n this.cache.verticalList = verticalLists;\n this.clearUpdateShapeTag();\n\n this.cache.verticalList.forEach(item => {\n const w = item.reduce((a, b) => a + b.width, 0);\n width = max(w, width);\n });\n\n const dx = textDrawOffsetX(textAlign, width);\n const height = this.cache.verticalList.length * lineHeight;\n const dy = textLayoutOffsetY(textBaseline, height, fontSize);\n this._AABBBounds.set(dy, dx, dy + height, dx + width);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n protected tryUpdateOBBBounds(): OBBBounds {\n throw new Error('暂不支持');\n }\n\n getDefaultAttribute(name: string) {\n const textTheme = getTheme(this).text;\n return textTheme[name];\n }\n\n protected needUpdateTags(keys: string[], k = TEXT_UPDATE_TAG_KEY): boolean {\n return super.needUpdateTags(keys, k);\n }\n protected needUpdateTag(key: string, k = TEXT_UPDATE_TAG_KEY): boolean {\n return super.needUpdateTag(key, k);\n }\n\n clone(): Text {\n return new Text({ ...this.attribute });\n }\n\n getNoWorkAnimateAttr(): Record<string, number> {\n return Text.NOWORK_ANIMATE_ATTR;\n }\n}\n\n// addAttributeToPrototype(DefaultLineStyle, Text, PURE_STYLE_KEY);\n"]}
@@ -1,18 +1,18 @@
1
- import type { IGraphicAttribute, IFullThemeSpec, IGraphic, IGroup, ITheme, IThemeSpec } from '../interface';
1
+ import type { IFullThemeSpec, IGraphic, IGroup, ITheme, IThemeSpec } from '../interface';
2
2
  export declare function newThemeObj(): IFullThemeSpec;
3
3
  export declare class Theme implements ITheme {
4
4
  combinedTheme: IFullThemeSpec;
5
5
  userTheme?: IThemeSpec;
6
- commonTheme?: Partial<IGraphicAttribute>;
7
6
  protected _defaultTheme: IFullThemeSpec;
8
7
  dirty: boolean;
9
8
  constructor();
9
+ initTheme(): void;
10
10
  getTheme(group?: IGroup): IFullThemeSpec;
11
11
  getParentWithTheme(group: IGroup): IGroup;
12
12
  applyTheme(group: IGroup, pt: IThemeSpec, force?: boolean): IThemeSpec;
13
- protected doCombine(parentTheme: IThemeSpec): void;
14
- resetTheme(t: IThemeSpec, g: IGroup): void;
13
+ protected doCombine(parentCombinedTheme?: IThemeSpec): void;
15
14
  setTheme(t: IThemeSpec, g: IGroup): void;
15
+ resetTheme(t: IThemeSpec, g: IGroup): void;
16
16
  dirtyChildren(g: IGroup): void;
17
17
  }
18
18
  export declare const globalTheme: Theme;
@@ -42,27 +42,24 @@ function newThemeObj() {
42
42
  };
43
43
  }
44
44
 
45
- function combineTheme(out, t, rewrite = !0) {
46
- t && (rewrite ? Object.keys(t).forEach((k => {
47
- out[k] ? Object.assign(out[k], t[k]) : out[k] = t[k];
48
- })) : Object.keys(t).forEach((k => {
49
- if (out[k]) {
50
- const outItem = out[k], tItem = t[k];
51
- Object.keys(t[k]).forEach((kItem => {
52
- void 0 === outItem[kItem] && (outItem[kItem] = tItem[kItem]);
53
- }));
54
- } else out[k] = t[k];
55
- })));
45
+ function combine(out, t) {
46
+ Object.keys(t).forEach((k => {
47
+ out[k] = t[k];
48
+ }));
56
49
  }
57
50
 
58
51
  exports.newThemeObj = newThemeObj;
59
52
 
60
- const staticThemePools = new Array(60).fill(0).map((() => newThemeObj()));
53
+ const globalThemeObj = newThemeObj();
61
54
 
62
55
  class Theme {
63
56
  constructor() {
64
- this._defaultTheme = staticThemePools.pop() || newThemeObj(), this.combinedTheme = this._defaultTheme,
65
- this.dirty = !1;
57
+ this.initTheme(), this.dirty = !1;
58
+ }
59
+ initTheme() {
60
+ this._defaultTheme = {}, themeKeys.forEach((key => {
61
+ this._defaultTheme[key] = Object.create(globalThemeObj[key]);
62
+ })), this.combinedTheme = this._defaultTheme;
66
63
  }
67
64
  getTheme(group) {
68
65
  if (!group) return this.combinedTheme;
@@ -81,30 +78,32 @@ class Theme {
81
78
  const parentGroup = this.getParentWithTheme(group);
82
79
  if (parentGroup) {
83
80
  const parentTheme = parentGroup.theme;
84
- (parentTheme.dirty || force) && parentTheme.applyTheme(parentGroup, pt, !0), this.userTheme ? combineTheme(this.userTheme, parentTheme.userTheme, !1) : this.userTheme = (0,
85
- vutils_1.clone)(parentTheme.userTheme), combineTheme(pt, parentTheme.userTheme);
81
+ (parentTheme.dirty || force) && parentTheme.applyTheme(parentGroup, pt, !0);
86
82
  }
87
- this.userTheme ? this.doCombine(pt) : (parentGroup ? this.combinedTheme = parentGroup.theme.combinedTheme : (this.combinedTheme = this._defaultTheme,
88
- console.warn("未知错误,走到不应该走的区域里")), this.dirty = !1);
83
+ this.userTheme ? this.doCombine(parentGroup && parentGroup.theme.combinedTheme) : (parentGroup ? this.combinedTheme = parentGroup.theme.combinedTheme : (this.combinedTheme = this._defaultTheme,
84
+ vutils_1.Logger.getInstance().warn("未知错误,走到不应该走的区域里")), this.dirty = !1);
89
85
  }
90
86
  return this.combinedTheme;
91
87
  }
92
- doCombine(parentTheme) {
93
- const userTheme = this.userTheme, defaultTheme = this._defaultTheme, combinedTheme = this.combinedTheme, parentCommonTheme = parentTheme.common || {}, commonTheme = Object.assign(parentCommonTheme, this.commonTheme);
88
+ doCombine(parentCombinedTheme) {
89
+ const userTheme = this.userTheme, combinedTheme = this.combinedTheme;
94
90
  themeKeys.forEach((k => {
95
- var _a, _b;
96
- userTheme[k] || commonTheme || parentTheme[k] ? combinedTheme[k] = Object.assign({}, defaultTheme[k], null != commonTheme ? commonTheme : {}, null !== (_a = parentTheme[k]) && void 0 !== _a ? _a : {}, null !== (_b = userTheme[k]) && void 0 !== _b ? _b : {}) : combinedTheme[k] = defaultTheme[k];
91
+ const obj = Object.create(globalThemeObj[k]);
92
+ parentCombinedTheme && parentCombinedTheme[k] && combine(obj, parentCombinedTheme[k]),
93
+ combinedTheme[k] && combine(obj, combinedTheme[k]), userTheme[k] && combine(obj, userTheme[k]),
94
+ this.combinedTheme[k] = obj;
95
+ })), userTheme.common && themeKeys.forEach((k => {
96
+ combine(this.combinedTheme[k], userTheme.common);
97
97
  })), this.dirty = !1;
98
98
  }
99
- resetTheme(t, g) {
100
- this.userTheme = t, this.dirty = !0, this.dirtyChildren(g);
101
- }
102
99
  setTheme(t, g) {
103
100
  let userTheme = this.userTheme;
104
101
  userTheme ? Object.keys(t).forEach((k => {
105
102
  userTheme[k] ? Object.assign(userTheme[k], t[k]) : userTheme[k] = Object.assign({}, t[k]);
106
- })) : userTheme = t, t.common && (this.commonTheme ? Object.assign(this.commonTheme, t.common) : this.commonTheme = t.common),
107
- this.userTheme = userTheme, this.dirty = !0, this.dirtyChildren(g);
103
+ })) : userTheme = t, this.userTheme = userTheme, this.dirty = !0, this.dirtyChildren(g);
104
+ }
105
+ resetTheme(t, g) {
106
+ this.userTheme = t, this.dirty = !0, this.dirtyChildren(g);
108
107
  }
109
108
  dirtyChildren(g) {
110
109
  g.forEachChildren((item => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graphic/theme.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAEzC,qCAgBkB;AAElB,MAAM,eAAe,GAAG;IACtB,GAAG,EAAE,4BAAmB;IACxB,IAAI,EAAE,6BAAoB;IAC1B,M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OAAO,CAAC,WAAW,EAAE;YAEvB,OAAO,KAAK,CAAC;SACd;QACD,OAAO,KAAK,CAAC;KACd;IAED,OAAO,iBAAiB,CAAC,OAAO,CAAC,IAAI,mBAAW,CAAC,QAAQ,EAAE,CAAC;AAC9D,CAAC;AAbD,4BAaC;AAED,SAAgB,iBAAiB,CAAC,OAAiB;IACjD,IAAI,CAAS,CAAC;IACd,IAAI,OAAO,CAAC,WAAW,EAAE;QAEvB,CAAC,GAAG,OAAiB,CAAC;KACvB;SAAM;QACL,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;KACpB;IAED,IAAI,CAAC,EAAE;QACL,OAAO,CAAC,EAAE;YACR,IAAI,CAAC,CAAC,KAAK,EAAE;gBACX,MAAM;aACP;YACD,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;SACd;QACD,IAAI,CAAC,CAAC,EAAE;YACN,OAAO,mBAAW,CAAC,QAAQ,EAAE,CAAC;SAC/B;QACD,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE;YACZ,CAAC,CAAC,WAAW,EAAE,CAAC;SACjB;QACD,OAAO,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAW,CAAC,CAAC;KACtC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAzBD,8CAyBC","file":"theme.js","sourcesContent":["import { clone } from '@visactor/vutils';\nimport type { IGraphicAttribute, IFullThemeSpec, IGraphic, IGroup, ITheme, IThemeSpec } from '../interface';\nimport {\n DefaultArcAttribute,\n DefaultAreaAttribute,\n DefaultCircleAttribute,\n DefaultGlyphAttribute,\n DefaultGroupAttribute,\n DefaultImageAttribute,\n DefaultLineAttribute,\n DefaultPathAttribute,\n DefaultPolygonAttribute,\n DefaultRect3dAttribute,\n DefaultRectAttribute,\n DefaultSymbolAttribute,\n DefaultTextAttribute,\n DefaultRichTextAttribute,\n DefaultRichTextIconAttribute\n} from './config';\n\nconst defaultThemeObj = {\n arc: DefaultArcAttribute,\n area: DefaultAreaAttribute,\n circle: DefaultCircleAttribute,\n line: DefaultLineAttribute,\n path: DefaultPathAttribute,\n symbol: DefaultSymbolAttribute,\n text: DefaultTextAttribute,\n rect: DefaultRectAttribute,\n rect3d: DefaultRect3dAttribute,\n polygon: DefaultPolygonAttribute,\n richtext: DefaultRichTextAttribute,\n richtextIcon: DefaultRichTextIconAttribute,\n image: DefaultImageAttribute,\n group: DefaultGroupAttribute,\n glyph: DefaultGlyphAttribute\n};\n\nconst themeKeys = Object.keys(defaultThemeObj);\n\nexport function newThemeObj(): IFullThemeSpec {\n return {\n arc: Object.assign({}, defaultThemeObj.arc),\n area: Object.assign({}, defaultThemeObj.area),\n circle: Object.assign({}, defaultThemeObj.circle),\n line: Object.assign({}, defaultThemeObj.line),\n path: Object.assign({}, defaultThemeObj.path),\n symbol: Object.assign({}, defaultThemeObj.symbol),\n text: Object.assign({}, defaultThemeObj.text),\n rect: Object.assign({}, defaultThemeObj.rect),\n rect3d: Object.assign({}, defaultThemeObj.rect3d),\n polygon: Object.assign({}, defaultThemeObj.polygon),\n richtext: Object.assign({}, defaultThemeObj.richtext),\n richtextIcon: Object.assign({}, defaultThemeObj.richtextIcon),\n image: Object.assign({}, defaultThemeObj.image),\n group: Object.assign({}, defaultThemeObj.group),\n glyph: Object.assign({}, defaultThemeObj.glyph)\n };\n}\n\n// 将t合并到out中\nfunction combineTheme(out: IThemeSpec, t: IThemeSpec, rewrite: boolean = true) {\n if (!t) {\n return;\n }\n if (rewrite) {\n Object.keys(t).forEach(k => {\n if (out[k]) {\n Object.assign(out[k], t[k]);\n } else {\n out[k] = t[k];\n }\n });\n } else {\n Object.keys(t).forEach(k => {\n if (out[k]) {\n // Object.assign(out[k], t[k]);\n const outItem = out[k];\n const tItem = t[k];\n Object.keys(t[k]).forEach(kItem => {\n if (outItem[kItem] === undefined) {\n outItem[kItem] = tItem[kItem];\n }\n });\n } else {\n out[k] = t[k];\n }\n });\n }\n}\n\n// 全局创建60个theme,节省打点耗时时间\nconst staticThemePools = new Array(60).fill(0).map(() => newThemeObj());\n\n// // 性能优化,没有修改的theme都使用这个\n// const defaultCommontTheme = newThemeObj();\n\n// function combineTheme(out: IThemeSpec, userTheme: IThemeSpec, defaultTheme: IFullThemeSpec) {\n\n// }\n\n// 优先级:\n// 1. userTheme\n// 2. commonTheme\n// 3. parentTheme\n// 4. defaultTheme\n\nexport class Theme implements ITheme {\n // 当前的总theme,最终合并后的theme\n combinedTheme: IFullThemeSpec;\n\n // 记录累计应用的所有用户设置上的theme\n userTheme?: IThemeSpec;\n // 公共属性,有些属性所有图元都生效,那就放在common位置\n commonTheme?: Partial<IGraphicAttribute>;\n\n // // 记录下一次设置的theme,同时也作为一个dirty位,记录是否存在没有合并的theme\n // nextTheme?: IThemeSpec;\n\n protected _defaultTheme: IFullThemeSpec;\n\n dirty: boolean;\n\n constructor() {\n // group数量不多,问题不大\n this._defaultTheme = staticThemePools.pop() || newThemeObj();\n this.combinedTheme = this._defaultTheme;\n this.dirty = false;\n }\n\n getTheme(group?: IGroup) {\n if (!group) {\n return this.combinedTheme;\n }\n if (!this.dirty) {\n return this.combinedTheme;\n }\n let parentTheme = {};\n const parentGroup = this.getParentWithTheme(group);\n if (parentGroup) {\n parentTheme = parentGroup.theme;\n }\n this.applyTheme(group, parentTheme);\n return this.combinedTheme;\n }\n\n // 获取具有主题的parent\n getParentWithTheme(group: IGroup) {\n while (group.parent) {\n group = group.parent;\n if (group.theme) {\n return group;\n }\n }\n return null;\n }\n\n // 应用主题,从根节点一直触发到当前节点(如果上层节点需要的话)\n applyTheme(group: IGroup, pt: IThemeSpec, force: boolean = false): IThemeSpec {\n if (this.dirty) {\n const parentGroup = this.getParentWithTheme(group);\n if (parentGroup) {\n const parentTheme = parentGroup.theme;\n if (parentTheme.dirty || force) {\n // 强制apply所有的上层\n parentTheme.applyTheme(parentGroup, pt, true);\n }\n // 将parentTheme.userTheme设置给自己的userTheme\n if (!this.userTheme) {\n this.userTheme = clone(parentTheme.userTheme);\n } else {\n combineTheme(this.userTheme, parentTheme.userTheme, false);\n }\n combineTheme(pt, parentTheme.userTheme);\n }\n // 如果当前节点没有userTheme的话,直接复用上层\n if (!this.userTheme) {\n if (parentGroup) {\n this.combinedTheme = parentGroup.theme.combinedTheme;\n } else {\n this.combinedTheme = this._defaultTheme;\n console.warn('未知错误,走到不应该走的区域里');\n }\n this.dirty = false;\n } else {\n this.doCombine(pt);\n }\n }\n\n return this.combinedTheme;\n }\n\n // 合并userTheme到combinedTheme\n protected doCombine(parentTheme: IThemeSpec) {\n const userTheme = this.userTheme;\n const defaultTheme = this._defaultTheme;\n const combinedTheme = this.combinedTheme;\n const parentCommonTheme = parentTheme.common || {};\n const commonTheme = Object.assign(parentCommonTheme, this.commonTheme);\n // combineTheme({}, this.userTheme, this._defaultTheme);\n themeKeys.forEach(k => {\n if (userTheme[k] || commonTheme || parentTheme[k]) {\n combinedTheme[k] = Object.assign(\n {},\n defaultTheme[k],\n commonTheme ?? {},\n parentTheme[k] ?? {},\n userTheme[k] ?? {}\n );\n } else {\n combinedTheme[k] = defaultTheme[k];\n }\n });\n this.dirty = false;\n }\n\n resetTheme(t: IThemeSpec, g: IGroup) {\n this.userTheme = t;\n // 设置自己和子节点的theme都为dirty\n this.dirty = true;\n this.dirtyChildren(g);\n }\n\n setTheme(t: IThemeSpec, g: IGroup) {\n // 设置自己的nextTheme\n let userTheme = this.userTheme;\n if (userTheme) {\n Object.keys(t).forEach(k => {\n if (userTheme[k]) {\n Object.assign(userTheme[k], t[k]);\n } else {\n // todo,这里调用次数不多,应该问题不大\n userTheme[k] = Object.assign({}, t[k]);\n }\n });\n } else {\n userTheme = t;\n }\n if (t.common) {\n if (!this.commonTheme) {\n this.commonTheme = t.common;\n } else {\n Object.assign(this.commonTheme, t.common);\n }\n }\n this.userTheme = userTheme;\n // 设置自己和子节点的theme都为dirty\n this.dirty = true;\n this.dirtyChildren(g);\n }\n\n dirtyChildren(g: IGroup) {\n g.forEachChildren(item => {\n if ((item as IGroup).isContainer) {\n if ((item as IGroup).theme) {\n (item as IGroup).theme.dirty = true;\n }\n this.dirtyChildren(item as IGroup);\n }\n });\n }\n\n // // 设置theme到子元素,直接设置到currentTheme中去\n // setThemeToChildrenCurrentTheme(t :IThemeSpec, g: IGroup) {\n // g.forEachChildren((item) => {\n // if ((item as IGroup).isContainer) {\n // const currentTheme = (item as IGroup).theme.currentTheme;\n // Object.keys(t).forEach(k => {\n // Object.assign(currentTheme[k], t[k]);\n // });\n // this.setThemeToChildrenCurrentTheme(t, item as IGroup);\n // }\n // })\n // }\n}\n\nexport const globalTheme = new Theme();\n\nexport function getTheme(graphic: IGraphic, theme?: IFullThemeSpec): IFullThemeSpec {\n if (graphic.glyphHost) {\n return getTheme(graphic.glyphHost);\n }\n if (theme) {\n if (graphic.isContainer) {\n // 暂时不支持Group\n return theme;\n }\n return theme;\n }\n\n return getThemeFromGroup(graphic) || globalTheme.getTheme();\n}\n\nexport function getThemeFromGroup(graphic: IGraphic): IFullThemeSpec | null {\n let g: IGroup;\n if (graphic.isContainer) {\n // 找到存在theme的group\n g = graphic as IGroup;\n } else {\n g = graphic.parent;\n }\n\n if (g) {\n while (g) {\n if (g.theme) {\n break;\n }\n g = g.parent;\n }\n if (!g) {\n return globalTheme.getTheme();\n }\n if (!g.theme) {\n g.createTheme();\n }\n return g.theme.getTheme(g as IGroup);\n }\n return null;\n}\n"]}
1
+ {"version":3,"sources":["../src/graphic/theme.ts"],"names":[],"mappings":";;;AAAA,6CAAiD;AAEjD,qCAgBkB;AAElB,MAAM,eAAe,GAAG;IACtB,GAAG,EAAE,4BAAmB;IACxB,IAAI,EAAE,6BAAoB;IAC1B,MAAM,EAAE,+BAAsB;IAC9B,IAAI,EAAE,6BAAoB;IAC1B,IAAI,EAAE,6BAAoB;IAC1B,MAAM,EAAE,+BAAsB;IAC9B,IAAI,EAAE,6BAAoB;IAC1B,IAAI,EAAE,6BAAoB;IAC1B,MAAM,EAAE,+BAAsB;IAC9B,OAAO,EAAE,gCAAuB;IAChC,Q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AAW,CAAC,QAAQ,EAAE,CAAC;AAC9D,CAAC;AAbD,4BAaC;AAED,SAAgB,iBAAiB,CAAC,OAAiB;IACjD,IAAI,CAAS,CAAC;IACd,IAAI,OAAO,CAAC,WAAW,EAAE;QAEvB,CAAC,GAAG,OAAiB,CAAC;KACvB;SAAM;QACL,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;KACpB;IAED,IAAI,CAAC,EAAE;QACL,OAAO,CAAC,EAAE;YACR,IAAI,CAAC,CAAC,KAAK,EAAE;gBACX,MAAM;aACP;YACD,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;SACd;QACD,IAAI,CAAC,CAAC,EAAE;YACN,OAAO,mBAAW,CAAC,QAAQ,EAAE,CAAC;SAC/B;QACD,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE;YACZ,CAAC,CAAC,WAAW,EAAE,CAAC;SACjB;QACD,OAAO,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAW,CAAC,CAAC;KACtC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAzBD,8CAyBC","file":"theme.js","sourcesContent":["import { Logger, clone } from '@visactor/vutils';\nimport type { IGraphicAttribute, IFullThemeSpec, IGraphic, IGroup, ITheme, IThemeSpec } from '../interface';\nimport {\n DefaultArcAttribute,\n DefaultAreaAttribute,\n DefaultCircleAttribute,\n DefaultGlyphAttribute,\n DefaultGroupAttribute,\n DefaultImageAttribute,\n DefaultLineAttribute,\n DefaultPathAttribute,\n DefaultPolygonAttribute,\n DefaultRect3dAttribute,\n DefaultRectAttribute,\n DefaultSymbolAttribute,\n DefaultTextAttribute,\n DefaultRichTextAttribute,\n DefaultRichTextIconAttribute\n} from './config';\n\nconst defaultThemeObj = {\n arc: DefaultArcAttribute,\n area: DefaultAreaAttribute,\n circle: DefaultCircleAttribute,\n line: DefaultLineAttribute,\n path: DefaultPathAttribute,\n symbol: DefaultSymbolAttribute,\n text: DefaultTextAttribute,\n rect: DefaultRectAttribute,\n rect3d: DefaultRect3dAttribute,\n polygon: DefaultPolygonAttribute,\n richtext: DefaultRichTextAttribute,\n richtextIcon: DefaultRichTextIconAttribute,\n image: DefaultImageAttribute,\n group: DefaultGroupAttribute,\n glyph: DefaultGlyphAttribute\n};\n\nconst themeKeys = Object.keys(defaultThemeObj);\n\nexport function newThemeObj(): IFullThemeSpec {\n return {\n arc: Object.assign({}, defaultThemeObj.arc),\n area: Object.assign({}, defaultThemeObj.area),\n circle: Object.assign({}, defaultThemeObj.circle),\n line: Object.assign({}, defaultThemeObj.line),\n path: Object.assign({}, defaultThemeObj.path),\n symbol: Object.assign({}, defaultThemeObj.symbol),\n text: Object.assign({}, defaultThemeObj.text),\n rect: Object.assign({}, defaultThemeObj.rect),\n rect3d: Object.assign({}, defaultThemeObj.rect3d),\n polygon: Object.assign({}, defaultThemeObj.polygon),\n richtext: Object.assign({}, defaultThemeObj.richtext),\n richtextIcon: Object.assign({}, defaultThemeObj.richtextIcon),\n image: Object.assign({}, defaultThemeObj.image),\n group: Object.assign({}, defaultThemeObj.group),\n glyph: Object.assign({}, defaultThemeObj.glyph)\n };\n}\n\n// /**\n// * 将t合并到out中\n// * @param out\n// * @param t\n// * @param rewrite 是否重写out的属性\n// * @returns\n// */\n// function combineTheme(out: IThemeSpec, t: IThemeSpec, rewrite: boolean = true) {\n// if (!t) {\n// return;\n// }\n// if (rewrite) {\n// Object.keys(t).forEach(k => {\n// if (out[k]) {\n// Object.assign(out[k], t[k]);\n// } else {\n// out[k] = t[k];\n// }\n// });\n// } else {\n// Object.keys(t).forEach(k => {\n// if (out[k]) {\n// // Object.assign(out[k], t[k]);\n// const outItem = out[k];\n// const tItem = t[k];\n// Object.keys(t[k]).forEach(kItem => {\n// if (outItem[kItem] === undefined) {\n// outItem[kItem] = tItem[kItem];\n// }\n// });\n// } else {\n// out[k] = t[k];\n// }\n// });\n// }\n// }\n\nfunction combine(out: Record<string, any>, t: Record<string, any>) {\n Object.keys(t).forEach(k => {\n out[k] = t[k];\n });\n}\n\nconst globalThemeObj = newThemeObj();\n\n// // 性能优化,没有修改的theme都使用这个\n// const defaultCommontTheme = newThemeObj();\n\n// function combineTheme(out: IThemeSpec, userTheme: IThemeSpec, defaultTheme: IFullThemeSpec) {\n\n// }\n\n// 优先级:\n// 1. userTheme\n// 2. commonTheme\n// 3. parentTheme\n// 4. defaultTheme\n\n// 使用原型链来保存主题,避免大量的merge操作\nexport class Theme implements ITheme {\n // 当前的总theme,最终合并后的theme\n combinedTheme: IFullThemeSpec;\n // 记录累计应用的所有用户设置上的theme\n userTheme?: IThemeSpec;\n\n protected _defaultTheme: IFullThemeSpec;\n\n dirty: boolean;\n\n constructor() {\n this.initTheme();\n this.dirty = false;\n }\n\n initTheme() {\n this._defaultTheme = {} as any;\n themeKeys.forEach(key => {\n this._defaultTheme[key] = Object.create(globalThemeObj[key]);\n });\n this.combinedTheme = this._defaultTheme;\n }\n\n /**\n * 获取group上应该有的主题配置\n * @param group\n * @returns\n */\n getTheme(group?: IGroup) {\n if (!group) {\n return this.combinedTheme;\n }\n if (!this.dirty) {\n return this.combinedTheme;\n }\n let parentTheme = {};\n const parentGroup = this.getParentWithTheme(group);\n if (parentGroup) {\n parentTheme = parentGroup.theme;\n }\n this.applyTheme(group, parentTheme);\n return this.combinedTheme;\n }\n\n // 获取具有主题的parent\n getParentWithTheme(group: IGroup) {\n while (group.parent) {\n group = group.parent;\n if (group.theme) {\n return group;\n }\n }\n return null;\n }\n\n // 应用主题,从根节点一直触发到当前节点(如果上层节点需要的话)\n applyTheme(group: IGroup, pt: IThemeSpec, force: boolean = false): IThemeSpec {\n if (this.dirty) {\n const parentGroup = this.getParentWithTheme(group);\n if (parentGroup) {\n const parentTheme = parentGroup.theme;\n if (parentTheme.dirty || force) {\n // 强制apply所有的上层\n parentTheme.applyTheme(parentGroup, pt, true);\n }\n }\n // 如果当前节点没有userTheme的话,直接复用上层的combinedTheme\n // 或者直接用默认的theme\n if (!this.userTheme) {\n if (parentGroup) {\n this.combinedTheme = parentGroup.theme.combinedTheme;\n } else {\n this.combinedTheme = this._defaultTheme;\n Logger.getInstance().warn('未知错误,走到不应该走的区域里');\n }\n this.dirty = false;\n } else {\n this.doCombine(parentGroup && parentGroup.theme.combinedTheme);\n }\n }\n\n return this.combinedTheme;\n }\n\n // 合并userTheme到combinedTheme\n protected doCombine(parentCombinedTheme?: IThemeSpec) {\n const userTheme = this.userTheme;\n const combinedTheme = this.combinedTheme;\n\n // 1. userTheme\n // 2. combinedTheme\n // 3. parentCombinedTheme\n // 4. defaultTheme\n themeKeys.forEach(k => {\n // init defaultTheme\n const obj = Object.create(globalThemeObj[k]);\n // merge parentCombinedTheme\n if (parentCombinedTheme && parentCombinedTheme[k]) {\n combine(obj, parentCombinedTheme[k]);\n }\n // merge combinedTheme\n if (combinedTheme[k]) {\n combine(obj, combinedTheme[k]);\n }\n // merge userTheme\n if (userTheme[k]) {\n combine(obj, userTheme[k]);\n }\n this.combinedTheme[k] = obj;\n });\n if (userTheme.common) {\n themeKeys.forEach(k => {\n combine(this.combinedTheme[k], userTheme.common);\n });\n }\n this.dirty = false;\n }\n\n setTheme(t: IThemeSpec, g: IGroup) {\n // 设置自己的nextTheme\n let userTheme = this.userTheme;\n if (userTheme) {\n Object.keys(t).forEach(k => {\n if (userTheme[k]) {\n Object.assign(userTheme[k], t[k]);\n } else {\n // todo,这里调用次数不多,应该问题不大\n userTheme[k] = Object.assign({}, t[k]);\n }\n });\n } else {\n userTheme = t;\n }\n this.userTheme = userTheme;\n // 设置自己和子节点的theme都为dirty\n this.dirty = true;\n this.dirtyChildren(g);\n }\n\n resetTheme(t: IThemeSpec, g: IGroup) {\n this.userTheme = t;\n // 设置自己和子节点的theme都为dirty\n this.dirty = true;\n this.dirtyChildren(g);\n }\n\n dirtyChildren(g: IGroup) {\n g.forEachChildren(item => {\n if ((item as IGroup).isContainer) {\n if ((item as IGroup).theme) {\n (item as IGroup).theme.dirty = true;\n }\n this.dirtyChildren(item as IGroup);\n }\n });\n }\n}\n\nexport const globalTheme = new Theme();\n\nexport function getTheme(graphic: IGraphic, theme?: IFullThemeSpec): IFullThemeSpec {\n if (graphic.glyphHost) {\n return getTheme(graphic.glyphHost);\n }\n if (theme) {\n if (graphic.isContainer) {\n // 暂时不支持Group\n return theme;\n }\n return theme;\n }\n\n return getThemeFromGroup(graphic) || globalTheme.getTheme();\n}\n\nexport function getThemeFromGroup(graphic: IGraphic): IFullThemeSpec | null {\n let g: IGroup;\n if (graphic.isContainer) {\n // 找到存在theme的group\n g = graphic as IGroup;\n } else {\n g = graphic.parent;\n }\n\n if (g) {\n while (g) {\n if (g.theme) {\n break;\n }\n g = g.parent;\n }\n if (!g) {\n return globalTheme.getTheme();\n }\n if (!g.theme) {\n g.createTheme();\n }\n return g.theme.getTheme(g as IGroup);\n }\n return null;\n}\n"]}
@@ -132,7 +132,7 @@ function parseRTTextXML(str) {
132
132
  }
133
133
 
134
134
  function parseCommonXML(str, output) {
135
- const attr = str["@_attribute"];
135
+ const attr = str.attribute;
136
136
  if (attr) {
137
137
  attr.split(";").forEach((attrItem => {
138
138
  if (!attrItem) return;