@visactor/vrender-core 0.21.1 → 0.21.2-vstory.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 (236) hide show
  1. package/cjs/animate/Ticker/default-ticker.d.ts +2 -0
  2. package/cjs/animate/Ticker/default-ticker.js +7 -1
  3. package/cjs/animate/Ticker/default-ticker.js.map +1 -1
  4. package/cjs/animate/animate.js +1 -1
  5. package/cjs/animate/animate.js.map +1 -1
  6. package/cjs/animate/easing-func.d.ts +1 -0
  7. package/cjs/animate/easing-func.js +16 -0
  8. package/cjs/animate/easing-func.js.map +1 -0
  9. package/cjs/animate/easing.d.ts +4 -0
  10. package/cjs/animate/easing.js +12 -1
  11. package/cjs/animate/easing.js.map +1 -1
  12. package/cjs/animate/index.d.ts +1 -0
  13. package/cjs/animate/index.js +1 -1
  14. package/cjs/animate/index.js.map +1 -1
  15. package/cjs/color-string/store.js +1 -2
  16. package/cjs/common/3d-interceptor.js +2 -1
  17. package/cjs/common/bezier-utils.d.ts +3 -0
  18. package/cjs/common/bezier-utils.js +17 -2
  19. package/cjs/common/bezier-utils.js.map +1 -1
  20. package/cjs/common/custom-path2d.d.ts +4 -0
  21. package/cjs/common/custom-path2d.js +43 -11
  22. package/cjs/common/custom-path2d.js.map +1 -1
  23. package/cjs/common/render-area.js +0 -1
  24. package/cjs/common/render-command-list.js +2 -1
  25. package/cjs/common/segment/curve/arc.d.ts +4 -1
  26. package/cjs/common/segment/curve/arc.js +10 -1
  27. package/cjs/common/segment/curve/arc.js.map +1 -1
  28. package/cjs/common/segment/curve/base.d.ts +4 -1
  29. package/cjs/common/segment/curve/base.js.map +1 -1
  30. package/cjs/common/segment/curve/cubic-bezier.d.ts +5 -1
  31. package/cjs/common/segment/curve/cubic-bezier.js +24 -3
  32. package/cjs/common/segment/curve/cubic-bezier.js.map +1 -1
  33. package/cjs/common/segment/curve/curve-context.js +5 -4
  34. package/cjs/common/segment/curve/curve-context.js.map +1 -1
  35. package/cjs/common/segment/curve/ellipse.d.ts +4 -1
  36. package/cjs/common/segment/curve/ellipse.js +9 -0
  37. package/cjs/common/segment/curve/ellipse.js.map +1 -1
  38. package/cjs/common/segment/curve/line.d.ts +4 -1
  39. package/cjs/common/segment/curve/line.js +18 -0
  40. package/cjs/common/segment/curve/line.js.map +1 -1
  41. package/cjs/common/segment/curve/move.d.ts +4 -1
  42. package/cjs/common/segment/curve/move.js +9 -0
  43. package/cjs/common/segment/curve/move.js.map +1 -1
  44. package/cjs/common/segment/curve/path.d.ts +2 -1
  45. package/cjs/common/segment/curve/path.js +5 -2
  46. package/cjs/common/segment/curve/path.js.map +1 -1
  47. package/cjs/common/segment/curve/quadratic-bezier.d.ts +6 -2
  48. package/cjs/common/segment/curve/quadratic-bezier.js +23 -5
  49. package/cjs/common/segment/curve/quadratic-bezier.js.map +1 -1
  50. package/cjs/common/store.js +1 -1
  51. package/cjs/graphic/builtin-symbol/rect.d.ts +2 -1
  52. package/cjs/graphic/builtin-symbol/rect.js +28 -0
  53. package/cjs/graphic/builtin-symbol/rect.js.map +1 -1
  54. package/cjs/graphic/builtin-symbol/utils.d.ts +2 -1
  55. package/cjs/graphic/builtin-symbol/utils.js +5 -0
  56. package/cjs/graphic/builtin-symbol/utils.js.map +1 -1
  57. package/cjs/graphic/config.js +6 -1
  58. package/cjs/graphic/config.js.map +1 -1
  59. package/cjs/graphic/graphic.js +2 -1
  60. package/cjs/graphic/graphic.js.map +1 -1
  61. package/cjs/graphic/richtext/wrapper.d.ts +1 -0
  62. package/cjs/graphic/richtext/wrapper.js +1 -1
  63. package/cjs/graphic/richtext/wrapper.js.map +1 -1
  64. package/cjs/graphic/richtext.js +2 -1
  65. package/cjs/graphic/richtext.js.map +1 -1
  66. package/cjs/index.d.ts +1 -0
  67. package/cjs/index.js +1 -1
  68. package/cjs/index.js.map +1 -1
  69. package/cjs/interface/animate.d.ts +5 -39
  70. package/cjs/interface/animate.js.map +1 -1
  71. package/cjs/interface/graphic/path.d.ts +1 -0
  72. package/cjs/interface/graphic/path.js.map +1 -1
  73. package/cjs/interface/graphic/symbol.d.ts +2 -0
  74. package/cjs/interface/graphic/symbol.js.map +1 -1
  75. package/cjs/interface/graphic.d.ts +6 -2
  76. package/cjs/interface/graphic.js.map +1 -1
  77. package/cjs/interface/path.d.ts +5 -0
  78. package/cjs/interface/path.js.map +1 -1
  79. package/cjs/interface/picker.d.ts +13 -0
  80. package/cjs/interface/picker.js.map +1 -1
  81. package/cjs/picker/constants.d.ts +2 -0
  82. package/cjs/picker/constants.js +3 -2
  83. package/cjs/picker/constants.js.map +1 -1
  84. package/cjs/picker/pick-interceptor.d.ts +7 -2
  85. package/cjs/picker/pick-interceptor.js +19 -2
  86. package/cjs/picker/pick-interceptor.js.map +1 -1
  87. package/cjs/picker/pick-modules.js +7 -4
  88. package/cjs/picker/pick-modules.js.map +1 -1
  89. package/cjs/picker/picker-service.d.ts +4 -2
  90. package/cjs/picker/picker-service.js +13 -12
  91. package/cjs/picker/picker-service.js.map +1 -1
  92. package/cjs/plugins/builtin-plugin/edit-module.d.ts +6 -5
  93. package/cjs/plugins/builtin-plugin/edit-module.js +84 -28
  94. package/cjs/plugins/builtin-plugin/edit-module.js.map +1 -1
  95. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.d.ts +1 -0
  96. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.js +3 -0
  97. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.js.map +1 -0
  98. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.d.ts +49 -30
  99. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +280 -217
  100. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
  101. package/cjs/render/contributions/render/arc3d-render.js.map +1 -1
  102. package/cjs/render/contributions/render/base-render.d.ts +1 -0
  103. package/cjs/render/contributions/render/base-render.js +20 -2
  104. package/cjs/render/contributions/render/base-render.js.map +1 -1
  105. package/cjs/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  106. package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js +29 -2
  107. package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js.map +1 -1
  108. package/cjs/render/contributions/render/contributions/symbol-contribution-render.d.ts +8 -1
  109. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js +30 -2
  110. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  111. package/cjs/render/contributions/render/path-render.js.map +1 -1
  112. package/cjs/render/contributions/render/polygon-render.js.map +1 -1
  113. package/cjs/render/contributions/render/symbol-render.js +15 -12
  114. package/cjs/render/contributions/render/symbol-render.js.map +1 -1
  115. package/cjs/render/contributions/render/utils.d.ts +1 -2
  116. package/cjs/render/contributions/render/utils.js +4 -20
  117. package/cjs/render/contributions/render/utils.js.map +1 -1
  118. package/dist/index.es.js +8296 -7696
  119. package/es/animate/Ticker/default-ticker.d.ts +2 -0
  120. package/es/animate/Ticker/default-ticker.js +7 -1
  121. package/es/animate/Ticker/default-ticker.js.map +1 -1
  122. package/es/animate/animate.js +1 -1
  123. package/es/animate/animate.js.map +1 -1
  124. package/es/animate/easing-func.d.ts +1 -0
  125. package/es/animate/easing-func.js +10 -0
  126. package/es/animate/easing-func.js.map +1 -0
  127. package/es/animate/easing.d.ts +4 -0
  128. package/es/animate/easing.js +12 -1
  129. package/es/animate/easing.js.map +1 -1
  130. package/es/animate/index.d.ts +1 -0
  131. package/es/animate/index.js +2 -0
  132. package/es/animate/index.js.map +1 -1
  133. package/es/color-string/store.js +1 -2
  134. package/es/common/3d-interceptor.js +2 -1
  135. package/es/common/bezier-utils.d.ts +3 -0
  136. package/es/common/bezier-utils.js +14 -0
  137. package/es/common/bezier-utils.js.map +1 -1
  138. package/es/common/custom-path2d.d.ts +4 -0
  139. package/es/common/custom-path2d.js +44 -12
  140. package/es/common/custom-path2d.js.map +1 -1
  141. package/es/common/render-area.js +1 -2
  142. package/es/common/render-command-list.js +2 -1
  143. package/es/common/segment/curve/arc.d.ts +4 -1
  144. package/es/common/segment/curve/arc.js +10 -1
  145. package/es/common/segment/curve/arc.js.map +1 -1
  146. package/es/common/segment/curve/base.d.ts +4 -1
  147. package/es/common/segment/curve/base.js.map +1 -1
  148. package/es/common/segment/curve/cubic-bezier.d.ts +5 -1
  149. package/es/common/segment/curve/cubic-bezier.js +22 -1
  150. package/es/common/segment/curve/cubic-bezier.js.map +1 -1
  151. package/es/common/segment/curve/curve-context.js +6 -3
  152. package/es/common/segment/curve/curve-context.js.map +1 -1
  153. package/es/common/segment/curve/ellipse.d.ts +4 -1
  154. package/es/common/segment/curve/ellipse.js +9 -0
  155. package/es/common/segment/curve/ellipse.js.map +1 -1
  156. package/es/common/segment/curve/line.d.ts +4 -1
  157. package/es/common/segment/curve/line.js +18 -0
  158. package/es/common/segment/curve/line.js.map +1 -1
  159. package/es/common/segment/curve/move.d.ts +4 -1
  160. package/es/common/segment/curve/move.js +9 -0
  161. package/es/common/segment/curve/move.js.map +1 -1
  162. package/es/common/segment/curve/path.d.ts +2 -1
  163. package/es/common/segment/curve/path.js +5 -2
  164. package/es/common/segment/curve/path.js.map +1 -1
  165. package/es/common/segment/curve/quadratic-bezier.d.ts +6 -2
  166. package/es/common/segment/curve/quadratic-bezier.js +28 -5
  167. package/es/common/segment/curve/quadratic-bezier.js.map +1 -1
  168. package/es/common/store.js +1 -1
  169. package/es/graphic/builtin-symbol/rect.d.ts +2 -1
  170. package/es/graphic/builtin-symbol/rect.js +28 -0
  171. package/es/graphic/builtin-symbol/rect.js.map +1 -1
  172. package/es/graphic/builtin-symbol/utils.d.ts +2 -1
  173. package/es/graphic/builtin-symbol/utils.js +5 -0
  174. package/es/graphic/builtin-symbol/utils.js.map +1 -1
  175. package/es/graphic/config.js +6 -1
  176. package/es/graphic/config.js.map +1 -1
  177. package/es/graphic/graphic.js +2 -1
  178. package/es/graphic/graphic.js.map +1 -1
  179. package/es/graphic/richtext/wrapper.d.ts +1 -0
  180. package/es/graphic/richtext/wrapper.js +1 -1
  181. package/es/graphic/richtext/wrapper.js.map +1 -1
  182. package/es/graphic/richtext.js +2 -1
  183. package/es/graphic/richtext.js.map +1 -1
  184. package/es/index.d.ts +1 -0
  185. package/es/index.js +2 -0
  186. package/es/index.js.map +1 -1
  187. package/es/interface/animate.d.ts +5 -39
  188. package/es/interface/animate.js.map +1 -1
  189. package/es/interface/graphic/path.d.ts +1 -0
  190. package/es/interface/graphic/path.js.map +1 -1
  191. package/es/interface/graphic/symbol.d.ts +2 -0
  192. package/es/interface/graphic/symbol.js.map +1 -1
  193. package/es/interface/graphic.d.ts +6 -2
  194. package/es/interface/graphic.js.map +1 -1
  195. package/es/interface/path.d.ts +5 -0
  196. package/es/interface/path.js.map +1 -1
  197. package/es/interface/picker.d.ts +13 -0
  198. package/es/interface/picker.js.map +1 -1
  199. package/es/picker/constants.d.ts +2 -0
  200. package/es/picker/constants.js +4 -0
  201. package/es/picker/constants.js.map +1 -1
  202. package/es/picker/pick-interceptor.d.ts +7 -2
  203. package/es/picker/pick-interceptor.js +19 -1
  204. package/es/picker/pick-interceptor.js.map +1 -1
  205. package/es/picker/pick-modules.js +5 -3
  206. package/es/picker/pick-modules.js.map +1 -1
  207. package/es/picker/picker-service.d.ts +4 -2
  208. package/es/picker/picker-service.js +13 -13
  209. package/es/picker/picker-service.js.map +1 -1
  210. package/es/plugins/builtin-plugin/edit-module.d.ts +6 -5
  211. package/es/plugins/builtin-plugin/edit-module.js +79 -25
  212. package/es/plugins/builtin-plugin/edit-module.js.map +1 -1
  213. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.d.ts +1 -0
  214. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.js +3 -0
  215. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.js.map +1 -0
  216. package/es/plugins/builtin-plugin/richtext-edit-plugin.d.ts +49 -30
  217. package/es/plugins/builtin-plugin/richtext-edit-plugin.js +283 -214
  218. package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
  219. package/es/render/contributions/render/arc3d-render.js.map +1 -1
  220. package/es/render/contributions/render/base-render.d.ts +1 -0
  221. package/es/render/contributions/render/base-render.js +21 -2
  222. package/es/render/contributions/render/base-render.js.map +1 -1
  223. package/es/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  224. package/es/render/contributions/render/contributions/base-texture-contribution-render.js +29 -2
  225. package/es/render/contributions/render/contributions/base-texture-contribution-render.js.map +1 -1
  226. package/es/render/contributions/render/contributions/symbol-contribution-render.d.ts +8 -1
  227. package/es/render/contributions/render/contributions/symbol-contribution-render.js +26 -0
  228. package/es/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  229. package/es/render/contributions/render/path-render.js.map +1 -1
  230. package/es/render/contributions/render/polygon-render.js.map +1 -1
  231. package/es/render/contributions/render/symbol-render.js +16 -13
  232. package/es/render/contributions/render/symbol-render.js.map +1 -1
  233. package/es/render/contributions/render/utils.d.ts +1 -2
  234. package/es/render/contributions/render/utils.js +0 -18
  235. package/es/render/contributions/render/utils.js.map +1 -1
  236. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graphic/richtext/wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAG1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AA8BtC,MAAM,CAAC,OAAO,OAAO,OAAO;IAe1B,YAAY,KAAY;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QAEhC,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,CA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AAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;aACjC;SACF;IACH,CAAC;IAID,GAAG,CAAC,SAAoB,EAAE,UAAoB;QAY5C,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC;QAC3E,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,cAAc,GAAG,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAE5G,MAAM,KAAK,GAAG,kBAAkB,CAC9B,SAAS,CAAC,IAAI,EACd,cAAc,EACd,SAAS,CAAC,SAAS,EACnB,UAAU,EACV,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,YAAY,CACtC,CAAC;QACF,IAAI,KAAK,KAAK,CAAC,EAAE;YACf,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;YACrD,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACf,IAAI,UAAU,EAAE;gBACd,IAAI,CAAC,IAAI,EAAE,CAAC;aACb;iBAAM;gBACL,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;aACf;SACF;aAAM,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YAEvC,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SACtB;IAEH,CAAC;CACF","file":"wrapper.js","sourcesContent":["import Line from './line';\nimport type Frame from './frame';\nimport type Paragraph from './paragraph';\nimport { seperateParagraph } from './paragraph';\nimport { DIRECTION_KEY, getStrByWithCanvas } from './utils';\nimport { RichTextIcon } from './icon';\n\n/**\n * 部分代码参考 https://github.com/danielearwicker/carota/\n * The MIT License (MIT)\n\n \"Carota\" - Copyright (c) 2013 Daniel Earwicker\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n */\n\n// 布局器\n// 参考carota\n// https://github.com/danielearwicker/carota/blob/master/src/wrap.js\nexport default class Wrapper {\n frame: Frame;\n\n lineWidth: number;\n width: number;\n height: number;\n y: number;\n maxAscent: number;\n maxDescent: number;\n maxAscentForBlank: number;\n maxDescentForBlank: number;\n lineBuffer: (Paragraph | RichTextIcon)[];\n direction: 'horizontal' | 'vertical';\n directionKey: { width: string; height: string };\n\n constructor(frame: Frame) {\n this.frame = frame;\n this.width = this.frame.width;\n this.height = this.frame.height;\n\n this.lineWidth = 0;\n this.y = this.frame.top;\n this.maxAscent = 0;\n this.maxDescent = 0;\n // 空字符串测量出的Ascent和Descent和文字不一致(空字符串测量结果ascent和descent一半一半),需要特殊处理\n this.maxAscentForBlank = 0;\n this.maxDescentForBlank = 0;\n this.lineBuffer = [];\n\n this.direction = frame.layoutDirection;\n this.directionKey = DIRECTION_KEY[this.direction];\n }\n\n // 不满一行,存储\n store(paragraph: Paragraph | RichTextIcon) {\n if (paragraph instanceof RichTextIcon) {\n this.frame.icons.set(paragraph.richtextId, paragraph);\n this.lineBuffer.push(paragraph);\n this.lineWidth += paragraph[this.directionKey.width];\n\n // 处理icon textBaseline ascent descent\n let iconAscent = 0;\n let iconDescent = 0;\n if (paragraph.attribute.textBaseline === 'top') {\n iconAscent = 0;\n iconDescent = paragraph.height;\n } else if (paragraph.attribute.textBaseline === 'bottom') {\n iconAscent = paragraph.height;\n iconDescent = 0;\n } else {\n iconAscent = paragraph.height / 2;\n iconDescent = paragraph.height / 2;\n }\n this.maxAscent = Math.max(this.maxAscent, iconAscent);\n this.maxDescent = Math.max(this.maxDescent, iconDescent);\n } else {\n this.lineBuffer.push(paragraph);\n if (paragraph.text.length !== 0) {\n this.lineWidth += paragraph[this.directionKey.width];\n this.maxAscent = Math.max(this.maxAscent, paragraph.ascent);\n this.maxDescent = Math.max(this.maxDescent, paragraph.descent);\n } else {\n this.maxAscentForBlank = Math.max(this.maxAscentForBlank, paragraph.ascent);\n this.maxDescentForBlank = Math.max(this.maxDescentForBlank, paragraph.descent);\n }\n }\n }\n\n // 满一行,生成line\n send() {\n if (this.lineBuffer.length === 0) {\n return;\n }\n // 当一行中有文字和空白时,不考虑空白的ascent和descent;如果只有空白(\\n引起的空行),取空白部分的ascent和descent\n const maxAscent = this.maxAscent === 0 ? this.maxAscentForBlank : this.maxAscent;\n const maxDescent = this.maxDescent === 0 ? this.maxDescentForBlank : this.maxDescent;\n const line = new Line(\n this.frame.left,\n this[this.directionKey.width],\n this.y + maxAscent,\n maxAscent,\n maxDescent,\n this.lineBuffer,\n this.direction,\n this.direction === 'horizontal' ? this.frame.isWidthMax : this.frame.isHeightMax\n );\n this.frame.lines.push(line);\n this.frame.actualHeight += line.height;\n\n // this.y += maxAscent + maxDescent;\n this.y += line.height;\n\n this.lineBuffer.length = 0;\n this.lineWidth = this.maxAscent = this.maxDescent = this.maxAscentForBlank = this.maxDescentForBlank = 0;\n }\n\n // 处理paragraph\n // singleLine表示是否将这个作为单行处理,也就是不拆多行了\n deal(paragraph: Paragraph | RichTextIcon, singleLine: boolean = false) {\n if (paragraph instanceof RichTextIcon) {\n if (\n (this.direction === 'horizontal' && this.width === 0) ||\n (this.direction === 'vertical' && this.height === 0)\n ) {\n // width为0时,宽度不设限制,不主动换行\n this.store(paragraph);\n } else {\n if (this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width]) {\n this.store(paragraph);\n } else if (this.lineBuffer.length === 0) {\n this.store(paragraph);\n this.send();\n } else {\n this.send();\n this.deal(paragraph);\n }\n }\n\n return;\n }\n\n // 可能会出现宽度为负的情况,此时不处理数据\n if (typeof this.width !== 'number' || this.width < 0) {\n return;\n }\n\n if (paragraph.newLine) {\n // 需要换行前,先完成上一行绘制\n this.send();\n }\n\n if (paragraph.text.length === 0) {\n return;\n } // 换行符分割出的Paragraph不进入line\n\n if ((this.direction === 'horizontal' && this.width === 0) || (this.direction === 'vertical' && this.height === 0)) {\n // width为0时,宽度不设限制,不主动换行\n this.store(paragraph);\n } else {\n // // width为有效值时,按照宽度限制,主动换行\n // if (this.lineWidth + paragraph.width <= this.width) {\n // this.store(paragraph);\n // } else if (this.lineWidth === this.width) {\n // this.send();\n // // this.store(paragraph);\n // this.deal(paragraph);\n // } else {\n // this.cut(paragraph);\n // }\n if (this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width]) {\n this.store(paragraph);\n } else if (this.lineWidth === this[this.directionKey.width]) {\n this.send();\n this.deal(paragraph);\n } else {\n this.cut(paragraph, singleLine);\n }\n }\n }\n\n // 文字超长,按需截断\n // 如果singleLine的话,最多就拆两行\n cut(paragraph: Paragraph, singleLine?: boolean) {\n // if (this.direction === 'vertical' && this.lineBuffer.length) {\n // // 纵排不做paragraph内截断\n // this.send();\n // this.deal(paragraph);\n // return;\n // } else if (this.direction === 'vertical') {\n // // 超长不处理?\n // this.store(paragraph);\n // this.send();\n // return;\n // }\n const availableWidth = this[this.directionKey.width] - this.lineWidth || 0;\n const guessIndex = Math.ceil((availableWidth / paragraph[this.directionKey.width]) * paragraph.length) || 0;\n // const index = getStrByWith(paragraph.text, availableWidth, paragraph.style, guessIndex, true);\n const index = getStrByWithCanvas(\n paragraph.text,\n availableWidth,\n paragraph.character,\n guessIndex,\n this.frame.wordBreak === 'break-word'\n );\n if (index !== 0) {\n const [p1, p2] = seperateParagraph(paragraph, index);\n this.store(p1);\n if (singleLine) {\n this.send();\n } else {\n this.deal(p2);\n }\n } else if (this.lineBuffer.length !== 0) {\n // 当前行无法容纳,转下一行处理\n this.send();\n this.deal(paragraph);\n }\n // 宽度过低,无法截断(容不下第一个字符的宽度),不处理\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/graphic/richtext/wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAG1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AA8BtC,MAAM,CAAC,OAAO,OAAO,OAAO;IAgB1B,YAAY,KAAY;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QAEhC,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QAEpB,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC;QAC5B,IAAI,CAAC,UAAU,G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3E,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,cAAc,GAAG,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAE5G,MAAM,KAAK,GAAG,kBAAkB,CAC9B,SAAS,CAAC,IAAI,EACd,cAAc,EACd,SAAS,CAAC,SAAS,EACnB,UAAU,EACV,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,YAAY,CACtC,CAAC;QACF,IAAI,KAAK,KAAK,CAAC,EAAE;YACf,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;YACrD,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACf,IAAI,UAAU,EAAE;gBACd,IAAI,CAAC,IAAI,EAAE,CAAC;aACb;iBAAM;gBACL,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;aACf;SACF;aAAM,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YAEvC,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SACtB;IAEH,CAAC;CACF","file":"wrapper.js","sourcesContent":["import Line from './line';\nimport type Frame from './frame';\nimport type Paragraph from './paragraph';\nimport { seperateParagraph } from './paragraph';\nimport { DIRECTION_KEY, getStrByWithCanvas } from './utils';\nimport { RichTextIcon } from './icon';\n\n/**\n * 部分代码参考 https://github.com/danielearwicker/carota/\n * The MIT License (MIT)\n\n \"Carota\" - Copyright (c) 2013 Daniel Earwicker\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n */\n\n// 布局器\n// 参考carota\n// https://github.com/danielearwicker/carota/blob/master/src/wrap.js\nexport default class Wrapper {\n frame: Frame;\n\n lineWidth: number;\n width: number;\n height: number;\n y: number;\n maxAscent: number;\n maxDescent: number;\n maxAscentForBlank: number;\n maxDescentForBlank: number;\n lineBuffer: (Paragraph | RichTextIcon)[];\n direction: 'horizontal' | 'vertical';\n directionKey: { width: string; height: string };\n newLine: boolean; // 空换行符是否新增一行\n\n constructor(frame: Frame) {\n this.frame = frame;\n this.width = this.frame.width;\n this.height = this.frame.height;\n\n this.lineWidth = 0;\n this.y = this.frame.top;\n this.maxAscent = 0;\n this.maxDescent = 0;\n // 空字符串测量出的Ascent和Descent和文字不一致(空字符串测量结果ascent和descent一半一半),需要特殊处理\n this.maxAscentForBlank = 0;\n this.maxDescentForBlank = 0;\n this.lineBuffer = [];\n\n this.direction = frame.layoutDirection;\n this.directionKey = DIRECTION_KEY[this.direction];\n }\n\n // 不满一行,存储\n store(paragraph: Paragraph | RichTextIcon) {\n if (paragraph instanceof RichTextIcon) {\n this.frame.icons.set(paragraph.richtextId, paragraph);\n this.lineBuffer.push(paragraph);\n this.lineWidth += paragraph[this.directionKey.width];\n\n // 处理icon textBaseline ascent descent\n let iconAscent = 0;\n let iconDescent = 0;\n if (paragraph.attribute.textBaseline === 'top') {\n iconAscent = 0;\n iconDescent = paragraph.height;\n } else if (paragraph.attribute.textBaseline === 'bottom') {\n iconAscent = paragraph.height;\n iconDescent = 0;\n } else {\n iconAscent = paragraph.height / 2;\n iconDescent = paragraph.height / 2;\n }\n this.maxAscent = Math.max(this.maxAscent, iconAscent);\n this.maxDescent = Math.max(this.maxDescent, iconDescent);\n } else {\n this.lineBuffer.push(paragraph);\n if (paragraph.text.length !== 0) {\n this.lineWidth += paragraph[this.directionKey.width];\n this.maxAscent = Math.max(this.maxAscent, paragraph.ascent);\n this.maxDescent = Math.max(this.maxDescent, paragraph.descent);\n } else {\n this.maxAscentForBlank = Math.max(this.maxAscentForBlank, paragraph.ascent);\n this.maxDescentForBlank = Math.max(this.maxDescentForBlank, paragraph.descent);\n }\n }\n }\n\n // 满一行,生成line\n send() {\n if (this.lineBuffer.length === 0) {\n return;\n }\n // 当一行中有文字和空白时,不考虑空白的ascent和descent;如果只有空白(\\n引起的空行),取空白部分的ascent和descent\n const maxAscent = this.maxAscent === 0 ? this.maxAscentForBlank : this.maxAscent;\n const maxDescent = this.maxDescent === 0 ? this.maxDescentForBlank : this.maxDescent;\n const line = new Line(\n this.frame.left,\n this[this.directionKey.width],\n this.y + maxAscent,\n maxAscent,\n maxDescent,\n this.lineBuffer,\n this.direction,\n this.direction === 'horizontal' ? this.frame.isWidthMax : this.frame.isHeightMax\n );\n this.frame.lines.push(line);\n this.frame.actualHeight += line.height;\n\n // this.y += maxAscent + maxDescent;\n this.y += line.height;\n\n this.lineBuffer.length = 0;\n this.lineWidth = this.maxAscent = this.maxDescent = this.maxAscentForBlank = this.maxDescentForBlank = 0;\n }\n\n // 处理paragraph\n // singleLine表示是否将这个作为单行处理,也就是不拆多行了\n deal(paragraph: Paragraph | RichTextIcon, singleLine: boolean = false) {\n if (paragraph instanceof RichTextIcon) {\n if (\n (this.direction === 'horizontal' && this.width === 0) ||\n (this.direction === 'vertical' && this.height === 0)\n ) {\n // width为0时,宽度不设限制,不主动换行\n this.store(paragraph);\n } else {\n if (this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width]) {\n this.store(paragraph);\n } else if (this.lineBuffer.length === 0) {\n this.store(paragraph);\n this.send();\n } else {\n this.send();\n this.deal(paragraph);\n }\n }\n\n return;\n }\n\n // 可能会出现宽度为负的情况,此时不处理数据\n if (typeof this.width !== 'number' || this.width < 0) {\n return;\n }\n\n if (paragraph.newLine) {\n // 需要换行前,先完成上一行绘制\n this.send();\n }\n\n if (paragraph.text.length === 0 && !this.newLine) {\n return;\n } // 换行符分割出的Paragraph不进入line\n\n if ((this.direction === 'horizontal' && this.width === 0) || (this.direction === 'vertical' && this.height === 0)) {\n // width为0时,宽度不设限制,不主动换行\n this.store(paragraph);\n } else {\n // // width为有效值时,按照宽度限制,主动换行\n // if (this.lineWidth + paragraph.width <= this.width) {\n // this.store(paragraph);\n // } else if (this.lineWidth === this.width) {\n // this.send();\n // // this.store(paragraph);\n // this.deal(paragraph);\n // } else {\n // this.cut(paragraph);\n // }\n if (this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width]) {\n this.store(paragraph);\n } else if (this.lineWidth === this[this.directionKey.width]) {\n this.send();\n this.deal(paragraph);\n } else {\n this.cut(paragraph, singleLine);\n }\n }\n }\n\n // 文字超长,按需截断\n // 如果singleLine的话,最多就拆两行\n cut(paragraph: Paragraph, singleLine?: boolean) {\n // if (this.direction === 'vertical' && this.lineBuffer.length) {\n // // 纵排不做paragraph内截断\n // this.send();\n // this.deal(paragraph);\n // return;\n // } else if (this.direction === 'vertical') {\n // // 超长不处理?\n // this.store(paragraph);\n // this.send();\n // return;\n // }\n const availableWidth = this[this.directionKey.width] - this.lineWidth || 0;\n const guessIndex = Math.ceil((availableWidth / paragraph[this.directionKey.width]) * paragraph.length) || 0;\n // const index = getStrByWith(paragraph.text, availableWidth, paragraph.style, guessIndex, true);\n const index = getStrByWithCanvas(\n paragraph.text,\n availableWidth,\n paragraph.character,\n guessIndex,\n this.frame.wordBreak === 'break-word'\n );\n if (index !== 0) {\n const [p1, p2] = seperateParagraph(paragraph, index);\n this.store(p1);\n if (singleLine) {\n this.send();\n } else {\n this.deal(p2);\n }\n } else if (this.lineBuffer.length !== 0) {\n // 当前行无法容纳,转下一行处理\n this.send();\n this.deal(paragraph);\n }\n // 宽度过低,无法截断(容不下第一个字符的宽度),不处理\n }\n}\n"]}
@@ -214,7 +214,8 @@ export class RichText extends Graphic {
214
214
  p.overflow = !0, p.left = 1e3, p.top = 1e3, frame.lines[frame.lines.length - 1].paragraphs.push(p),
215
215
  skip = !0), p.newLine && (skip = !1, wrapper.lineWidth = 0), wrapper.send();
216
216
  }
217
- } else for (let i = 0; i < paragraphs.length; i++) wrapper.deal(paragraphs[i]);
217
+ } else for (let i = 0; i < paragraphs.length; i++) i === paragraphs.length - 1 && (wrapper.newLine = !0),
218
+ wrapper.deal(paragraphs[i]), wrapper.newLine = !1;
218
219
  wrapper.send();
219
220
  if (!("horizontal" === frame.layoutDirection ? richTextWidthEnable : richTextHeightEnable)) {
220
221
  const frameSize = frame.getActualSizeWidthEllipsis();
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graphic/richtext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAgB5C,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAC7C,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,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,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;gBAC1E,QAAQ,CAAC,OAAO,GAAG,CAAC,MAAA,QAAQ,CAAC,SAAS,CAAC,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;aAC3E;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,oBAAoB;QAClB,OAAO,QAAQ,CAAC,mBAAmB,CAAC;IACtC,CAAC;;AA/gBM,4BAAmB,mBACxB,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,CAAC,EACZ,iBAAiB,EAAE,CAAC,EACpB,SAAS,EAAE,CAAC,EACZ,YAAY,EAAE,CAAC,EACf,UAAU,EAAE,CAAC,EACb,eAAe,EAAE,CAAC,IACf,mBAAmB,EACtB;AAygBJ,MAAM,UAAU,cAAc,CAAC,UAAqC;IAClE,OAAO,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC;AAClC,CAAC","file":"richtext.js","sourcesContent":["import type { IAABBBounds } from '@visactor/vutils';\nimport { isNumber } from '@visactor/vutils';\nimport type {\n IRichText,\n IRichTextCharacter,\n RichTextGlobalAlignType,\n RichTextGlobalBaselineType,\n RichTextVerticalDirection,\n RichTextWordBreak,\n IRichTextGraphicAttribute,\n IRichTextImageCharacter,\n IRichTextParagraphCharacter,\n IStage,\n ILayer,\n IRichTextIcon,\n EventPoint\n} from '../interface';\nimport { Graphic, GRAPHIC_UPDATE_TAG_KEY, NOWORK_ANIMATE_ATTR } from './graphic';\nimport { DefaultRichTextAttribute } from './config';\nimport Frame from './richtext/frame';\nimport Paragraph from './richtext/paragraph';\nimport Wrapper from './richtext/wrapper';\nimport { getTheme } from './theme';\nimport { RichTextIcon } from './richtext/icon';\nimport type { FederatedMouseEvent } from '../event';\nimport { application } from '../application';\nimport { RICHTEXT_NUMBER_TYPE } from './constants';\n\nconst RICHTEXT_UPDATE_TAG_KEY = [\n 'width',\n 'height',\n 'ellipsis',\n 'wordBreak',\n 'verticalDirection',\n 'maxHeight',\n 'maxWidth',\n 'textAlign',\n 'textBaseline',\n 'textConfig',\n 'layoutDirection',\n 'fill',\n 'stroke',\n 'fontSize',\n 'fontFamily',\n 'fontStyle',\n 'fontWeight',\n 'lineWidth',\n 'opacity',\n 'fillOpacity',\n 'strokeOpacity',\n ...GRAPHIC_UPDATE_TAG_KEY\n];\n\nexport class RichText extends Graphic<IRichTextGraphicAttribute> implements IRichText {\n type: 'richtext' = 'richtext';\n\n _frameCache: Frame; // 富文本布局画布\n _currentHoverIcon: IRichTextIcon | null = null;\n\n static NOWORK_ANIMATE_ATTR = {\n ellipsis: 1,\n wordBreak: 1,\n verticalDirection: 1,\n textAlign: 1,\n textBaseline: 1,\n textConfig: 1,\n layoutDirection: 1,\n ...NOWORK_ANIMATE_ATTR\n };\n\n constructor(params?: IRichTextGraphicAttribute) {\n super(params);\n this.numberType = RICHTEXT_NUMBER_TYPE;\n\n this.onBeforeAttributeUpdate = ((val: any, attributes: any, key: null | string | string[]) => {\n for (const key in val) {\n if (key === 'hoverIconId') {\n if (val[key] === attributes[key]) {\n continue;\n }\n const icon = this._frameCache.icons.get(val[key]);\n this.updateHoverIconState(icon);\n }\n }\n }) as any;\n }\n\n get width(): number {\n return this.attribute.width ?? DefaultRichTextAttribute.width;\n }\n set width(w: number) {\n if (this.attribute.width === w) {\n return;\n }\n this.attribute.width = w;\n this.addUpdateShapeAndBoundsTag();\n }\n get height(): number {\n return this.attribute.height ?? DefaultRichTextAttribute.height;\n }\n set height(h: number) {\n if (this.attribute.height === h) {\n return;\n }\n this.attribute.height = h;\n this.addUpdateShapeAndBoundsTag();\n }\n get maxWidth(): number | undefined {\n return this.attribute.maxWidth;\n }\n set maxWidth(mw: number | undefined) {\n if (this.attribute.maxWidth === mw) {\n return;\n }\n this.attribute.maxWidth = mw;\n this.addUpdateShapeAndBoundsTag();\n }\n get maxHeight(): number | undefined {\n return this.attribute.maxHeight;\n }\n set maxHeight(mh: number | undefined) {\n if (this.attribute.maxHeight === mh) {\n return;\n }\n this.attribute.maxHeight = mh;\n this.addUpdateShapeAndBoundsTag();\n }\n get ellipsis(): boolean | string {\n return this.attribute.ellipsis ?? DefaultRichTextAttribute.ellipsis;\n }\n set ellipsis(e: boolean | string) {\n if (this.attribute.ellipsis === e) {\n return;\n }\n this.attribute.ellipsis = e;\n this.addUpdateShapeAndBoundsTag();\n }\n get wordBreak(): RichTextWordBreak {\n return this.attribute.wordBreak ?? DefaultRichTextAttribute.wordBreak;\n }\n set wordBreak(wb: RichTextWordBreak) {\n if (this.attribute.wordBreak === wb) {\n return;\n }\n this.attribute.wordBreak = wb;\n this.addUpdateShapeAndBoundsTag();\n }\n get verticalDirection(): RichTextVerticalDirection {\n return this.attribute.verticalDirection ?? DefaultRichTextAttribute.verticalDirection;\n }\n set verticalDirection(vd: RichTextVerticalDirection) {\n if (this.attribute.verticalDirection === vd) {\n return;\n }\n this.attribute.verticalDirection = vd;\n this.addUpdateShapeAndBoundsTag();\n }\n get textAlign(): RichTextGlobalAlignType {\n return this.attribute.textAlign ?? DefaultRichTextAttribute.textAlign;\n }\n set textAlign(align: RichTextGlobalAlignType) {\n if (this.attribute.textAlign === align) {\n return;\n }\n this.attribute.textAlign = align;\n this.addUpdateShapeAndBoundsTag();\n }\n get textBaseline(): RichTextGlobalBaselineType {\n return this.attribute.textBaseline ?? DefaultRichTextAttribute.textBaseline;\n }\n set textBaseline(baseline: RichTextGlobalBaselineType) {\n if (this.attribute.textBaseline === baseline) {\n return;\n }\n this.attribute.textBaseline = baseline;\n this.addUpdateShapeAndBoundsTag();\n }\n get textConfig(): IRichTextCharacter[] {\n return this.attribute.textConfig ?? DefaultRichTextAttribute.textConfig;\n }\n set textConfig(config: IRichTextCharacter[]) {\n this.attribute.textConfig = config;\n this.addUpdateShapeAndBoundsTag();\n }\n\n getGraphicTheme(): Required<IRichTextGraphicAttribute> {\n return getTheme(this).richtext;\n }\n\n protected updateAABBBounds(\n attribute: IRichTextGraphicAttribute,\n richtextTheme: Required<IRichTextGraphicAttribute>,\n aabbBounds: IAABBBounds\n ) {\n const {\n width = richtextTheme.width,\n height = richtextTheme.height,\n maxWidth = richtextTheme.maxWidth,\n maxHeight = richtextTheme.maxHeight,\n textAlign = richtextTheme.textAlign,\n textBaseline = richtextTheme.textBaseline\n } = attribute;\n\n if (width > 0 && height > 0) {\n // 外部设置宽高\n aabbBounds.set(0, 0, width, height);\n } else {\n // 获取内容宽高\n const frameCache = this.getFrameCache();\n const { width: actualWidth, height: actualHeight } = frameCache.getActualSize();\n let contentWidth = width || actualWidth || 0;\n let contentHeight = height || actualHeight || 0;\n\n contentHeight = typeof maxHeight === 'number' && contentHeight > maxHeight ? maxHeight : contentHeight || 0;\n contentWidth = typeof maxWidth === 'number' && contentWidth > maxWidth ? maxWidth : contentWidth || 0;\n\n aabbBounds.set(0, 0, contentWidth, contentHeight);\n }\n\n // 调整对齐方式\n let deltaY = 0;\n switch (textBaseline) {\n case 'top':\n deltaY = 0;\n break;\n case 'middle':\n deltaY = -aabbBounds.height() / 2;\n break;\n case 'bottom':\n deltaY = -aabbBounds.height();\n break;\n default:\n break;\n }\n let deltaX = 0;\n switch (textAlign) {\n case 'left':\n deltaX = 0;\n break;\n case 'center':\n deltaX = -aabbBounds.width() / 2;\n break;\n case 'right':\n deltaX = -aabbBounds.width();\n break;\n default:\n break;\n }\n aabbBounds.translate(deltaX, deltaY);\n\n application.graphicService.updateTempAABBBounds(aabbBounds);\n\n if (attribute.forceBoundsHeight != null || attribute.forceBoundsWidth != null) {\n application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds);\n }\n application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, false, this);\n return aabbBounds;\n }\n\n protected needUpdateTags(keys: string[]): boolean {\n return super.needUpdateTags(keys, RICHTEXT_UPDATE_TAG_KEY);\n }\n protected needUpdateTag(key: string): boolean {\n return super.needUpdateTag(key, RICHTEXT_UPDATE_TAG_KEY);\n }\n getFrameCache(): Frame {\n if (this.shouldUpdateShape()) {\n this.doUpdateFrameCache();\n this.clearUpdateShapeTag();\n }\n return this._frameCache;\n }\n\n get cliped() {\n const frameCache = this.getFrameCache();\n if (frameCache.actualHeight > frameCache.height) {\n return true;\n }\n const { disableAutoWrapLine } = this.attribute;\n if (disableAutoWrapLine) {\n for (let i = 0; i < frameCache.lines.length; i++) {\n const l = frameCache.lines[i];\n for (let j = 0; j < l.paragraphs.length; j++) {\n const p = l.paragraphs[j];\n if ((p as any).overflow && (p as any).text !== '') {\n return true;\n }\n }\n }\n }\n return false;\n // if (height < this.attribute.height || )\n }\n combinedStyleToCharacter(config: IRichTextImageCharacter | IRichTextParagraphCharacter) {\n const {\n fill,\n stroke,\n fontSize,\n fontFamily,\n fontStyle,\n fontWeight,\n lineWidth,\n opacity,\n fillOpacity,\n strokeOpacity\n } = this.attribute;\n return {\n fill,\n stroke,\n fontSize,\n fontFamily,\n fontStyle,\n fontWeight,\n lineWidth,\n opacity,\n fillOpacity,\n strokeOpacity,\n ...config\n };\n }\n doUpdateFrameCache(tc?: IRichTextCharacter[]) {\n // 1. 测量,生成paragraph\n const {\n textConfig: _tc = [],\n maxWidth,\n maxHeight,\n width,\n height,\n ellipsis,\n wordBreak,\n verticalDirection,\n textAlign,\n textBaseline,\n layoutDirection,\n singleLine,\n disableAutoWrapLine\n } = this.attribute;\n const paragraphs: (Paragraph | RichTextIcon)[] = [];\n\n const textConfig = tc ?? _tc;\n\n for (let i = 0; i < textConfig.length; i++) {\n if ('image' in textConfig[i]) {\n const config = this.combinedStyleToCharacter(\n textConfig[i] as IRichTextImageCharacter\n ) as IRichTextImageCharacter;\n (config as any).lineWidth = undefined; // for icon bounds\n // 直接创建icon Mark\n const iconCache =\n config.id && this._frameCache && this._frameCache.icons && this._frameCache.icons.get(config.id);\n if (iconCache) {\n paragraphs.push(iconCache as RichTextIcon);\n } else {\n const icon = new RichTextIcon(config);\n icon.successCallback = () => {\n this.addUpdateBoundTag();\n this.stage?.renderNextFrame();\n };\n icon.richtextId = config.id;\n paragraphs.push(icon);\n }\n } else {\n const richTextConfig = this.combinedStyleToCharacter(\n textConfig[i] as IRichTextParagraphCharacter\n ) as IRichTextParagraphCharacter;\n if (isNumber(richTextConfig.text)) {\n richTextConfig.text = `${richTextConfig.text}`;\n }\n if (richTextConfig.text && richTextConfig.text.includes('\\n')) {\n // 如果有文字内有换行符,将该段文字切为多段,并在后一段加入newLine标记\n const textParts = richTextConfig.text.split('\\n');\n for (let j = 0; j < textParts.length; j++) {\n paragraphs.push(new Paragraph(textParts[j], j !== 0, richTextConfig));\n }\n } else if (richTextConfig.text) {\n paragraphs.push(new Paragraph(richTextConfig.text, false, richTextConfig));\n }\n }\n }\n\n // 2. 布局,生成frame\n // const frameHeight =\n // typeof maxHeight === 'number' && (!height || height > maxHeight) // height = 0或height>maxHeight,使用maxHeight布局\n // ? maxHeight\n // : height;\n // const frameWidth =\n // typeof maxWidth === 'number' && (!width || width > maxWidth) // height = 0或height>maxWidth,使用maxWidth布局\n // ? maxWidth\n // : width;\n\n const maxWidthFinite = typeof maxWidth === 'number' && Number.isFinite(maxWidth) && maxWidth > 0;\n const maxHeightFinite = typeof maxHeight === 'number' && Number.isFinite(maxHeight) && maxHeight > 0;\n\n const richTextWidthEnable =\n typeof width === 'number' &&\n Number.isFinite(width) &&\n width > 0 &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (!maxWidthFinite || width <= maxWidth);\n const richTextHeightEnable =\n typeof height === 'number' &&\n Number.isFinite(height) &&\n height > 0 &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (!maxHeightFinite || height <= maxHeight);\n\n const frameWidth = richTextWidthEnable ? width : maxWidthFinite ? maxWidth : 0;\n const frameHeight = richTextHeightEnable ? height : maxHeightFinite ? maxHeight : 0;\n\n const frame = new Frame(\n 0,\n 0,\n frameWidth || 0,\n frameHeight || 0,\n ellipsis,\n wordBreak,\n verticalDirection,\n textAlign,\n textBaseline,\n layoutDirection || 'horizontal',\n // typeof maxWidth === 'number' && (!width || width > maxWidth),\n // typeof maxHeight === 'number' && (!height || height > maxHeight),\n !richTextWidthEnable && maxWidthFinite,\n !richTextHeightEnable && maxHeightFinite,\n singleLine || false,\n this._frameCache?.icons\n );\n const wrapper = new Wrapper(frame);\n if (disableAutoWrapLine) {\n let lineCount = 0;\n let skip = false;\n for (let i = 0; i < paragraphs.length; i++) {\n const p = paragraphs[i];\n if (skip) {\n (p as Paragraph).overflow = true;\n (p as Paragraph).left = Infinity;\n (p as Paragraph).top = Infinity;\n !(p as Paragraph).newLine && frame.lines[frame.lines.length - 1].paragraphs.push(p);\n } else {\n wrapper.deal(p, true);\n }\n if (frame.lines.length !== lineCount) {\n lineCount = frame.lines.length;\n wrapper.lineBuffer.length = 0;\n (p as Paragraph).overflow = true;\n (p as Paragraph).left = 1000;\n (p as Paragraph).top = 1000;\n frame.lines[frame.lines.length - 1].paragraphs.push(p);\n skip = true;\n }\n if ((p as Paragraph).newLine) {\n skip = false;\n wrapper.lineWidth = 0;\n }\n wrapper.send();\n }\n } else {\n for (let i = 0; i < paragraphs.length; i++) {\n wrapper.deal(paragraphs[i]);\n }\n }\n\n wrapper.send(); // 最后一行手动输出\n\n // 如果对应的配置宽度不可用,那么需要额外进行一次对齐\n const directionEnable = frame.layoutDirection === 'horizontal' ? richTextWidthEnable : richTextHeightEnable;\n if (!directionEnable) {\n // 使用实际宽度\n const frameSize = frame.getActualSizeWidthEllipsis();\n let offsetSize = frame.layoutDirection === 'horizontal' ? frameSize.width : frameSize.height;\n // 如果最大值可用\n if (frame.layoutDirection === 'horizontal' ? maxWidthFinite : maxHeightFinite) {\n // 取2者中的较小值\n offsetSize = Math.min(\n offsetSize,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n frame.layoutDirection === 'horizontal' ? maxWidth : maxHeight\n );\n }\n\n frame.lines.forEach(function (l) {\n l.calcOffset(offsetSize, false);\n });\n }\n\n this._frameCache = frame;\n\n // this.bindIconEvent();\n }\n\n clone() {\n return new RichText({ ...this.attribute });\n }\n\n setStage(stage?: IStage, layer?: ILayer) {\n super.setStage(stage, layer);\n const frameCache = this.getFrameCache();\n // for (let i = 0; i < frameCache.icons.length; i++) {\n // const icon = frameCache.icons[i];\n // icon.setStage(stage, layer);\n // }\n frameCache.icons.forEach(icon => {\n icon.setStage(stage, layer);\n });\n }\n\n // richtext绑定icon交互事件,供外部调用\n bindIconEvent() {\n this.addEventListener('pointermove', (e: FederatedMouseEvent) => {\n const pickedIcon = this.pickIcon(e.global);\n if (pickedIcon && pickedIcon === this._currentHoverIcon) {\n // do nothing\n } else if (pickedIcon) {\n this.setAttribute('hoverIconId', pickedIcon.richtextId);\n\n // this._currentHoverIcon?.setHoverState(false);\n // this._currentHoverIcon = pickedIcon;\n // this._currentHoverIcon.setHoverState(true);\n // this.stage?.setCursor(pickedIcon.attribute.cursor);\n // this.stage?.renderNextFrame();\n } else if (!pickedIcon && this._currentHoverIcon) {\n this.setAttribute('hoverIconId', undefined);\n\n // this._currentHoverIcon.setHoverState(false);\n // this._currentHoverIcon = null;\n // this.stage?.setCursor();\n // this.stage?.renderNextFrame();\n }\n });\n\n this.addEventListener('pointerleave', (e: FederatedMouseEvent) => {\n if (this._currentHoverIcon) {\n this.setAttribute('hoverIconId', undefined);\n\n // this._currentHoverIcon.setHoverState(false);\n // this._currentHoverIcon = null;\n // this.stage?.setCursor();\n // this.stage?.renderNextFrame();\n }\n });\n }\n\n updateHoverIconState(pickedIcon?: IRichTextIcon) {\n if (pickedIcon) {\n this._currentHoverIcon?.setHoverState(false);\n this._currentHoverIcon = pickedIcon;\n this._currentHoverIcon.setHoverState(true);\n this.stage?.setCursor(pickedIcon.attribute.cursor);\n this.stage?.renderNextFrame();\n } else {\n this._currentHoverIcon.setHoverState(false);\n this._currentHoverIcon = null;\n this.stage?.setCursor();\n this.stage?.renderNextFrame();\n }\n }\n\n pickIcon(point: EventPoint): IRichTextIcon | undefined {\n const frameCache = this.getFrameCache();\n const { e: x, f: y } = this.globalTransMatrix;\n // for (let i = 0; i < frameCache.icons.length; i++) {\n // const icon = frameCache.icons[i];\n // if (icon.containsPoint(point.x - x, point.y - y)) {\n // return icon;\n // }\n // }\n let pickIcon: IRichTextIcon | undefined;\n frameCache.icons.forEach((icon, key) => {\n const bounds = icon.AABBBounds.clone();\n bounds.translate(icon._marginArray[3], icon._marginArray[0]);\n if (bounds.containsPoint({ x: point.x - x, y: point.y - y })) {\n pickIcon = icon;\n\n pickIcon.globalX = (pickIcon.attribute.x ?? 0) + x + icon._marginArray[3];\n pickIcon.globalY = (pickIcon.attribute.y ?? 0) + y + icon._marginArray[0];\n }\n });\n\n return pickIcon;\n }\n\n getNoWorkAnimateAttr(): Record<string, number> {\n return RichText.NOWORK_ANIMATE_ATTR;\n }\n}\n\nexport function createRichText(attributes: IRichTextGraphicAttribute): IRichText {\n return new RichText(attributes);\n}\n"]}
1
+ {"version":3,"sources":["../src/graphic/richtext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAgB5C,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAC7C,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,uBAAuB,GAAG;IAC9B,OA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BAEhB,QAAQ,CAAC,OAAO,GAAG,CAAC,MAAA,QAAQ,CAAC,SAAS,CAAC,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;gBAC1E,QAAQ,CAAC,OAAO,GAAG,CAAC,MAAA,QAAQ,CAAC,SAAS,CAAC,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;aAC3E;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,oBAAoB;QAClB,OAAO,QAAQ,CAAC,mBAAmB,CAAC;IACtC,CAAC;;AAnhBM,4BAAmB,mBACxB,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,CAAC,EACZ,iBAAiB,EAAE,CAAC,EACpB,SAAS,EAAE,CAAC,EACZ,YAAY,EAAE,CAAC,EACf,UAAU,EAAE,CAAC,EACb,eAAe,EAAE,CAAC,IACf,mBAAmB,EACtB;AA6gBJ,MAAM,UAAU,cAAc,CAAC,UAAqC;IAClE,OAAO,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC;AAClC,CAAC","file":"richtext.js","sourcesContent":["import type { IAABBBounds } from '@visactor/vutils';\nimport { isNumber } from '@visactor/vutils';\nimport type {\n IRichText,\n IRichTextCharacter,\n RichTextGlobalAlignType,\n RichTextGlobalBaselineType,\n RichTextVerticalDirection,\n RichTextWordBreak,\n IRichTextGraphicAttribute,\n IRichTextImageCharacter,\n IRichTextParagraphCharacter,\n IStage,\n ILayer,\n IRichTextIcon,\n EventPoint\n} from '../interface';\nimport { Graphic, GRAPHIC_UPDATE_TAG_KEY, NOWORK_ANIMATE_ATTR } from './graphic';\nimport { DefaultRichTextAttribute } from './config';\nimport Frame from './richtext/frame';\nimport Paragraph from './richtext/paragraph';\nimport Wrapper from './richtext/wrapper';\nimport { getTheme } from './theme';\nimport { RichTextIcon } from './richtext/icon';\nimport type { FederatedMouseEvent } from '../event';\nimport { application } from '../application';\nimport { RICHTEXT_NUMBER_TYPE } from './constants';\n\nconst RICHTEXT_UPDATE_TAG_KEY = [\n 'width',\n 'height',\n 'ellipsis',\n 'wordBreak',\n 'verticalDirection',\n 'maxHeight',\n 'maxWidth',\n 'textAlign',\n 'textBaseline',\n 'textConfig',\n 'layoutDirection',\n 'fill',\n 'stroke',\n 'fontSize',\n 'fontFamily',\n 'fontStyle',\n 'fontWeight',\n 'lineWidth',\n 'opacity',\n 'fillOpacity',\n 'strokeOpacity',\n ...GRAPHIC_UPDATE_TAG_KEY\n];\n\nexport class RichText extends Graphic<IRichTextGraphicAttribute> implements IRichText {\n type: 'richtext' = 'richtext';\n\n _frameCache: Frame; // 富文本布局画布\n _currentHoverIcon: IRichTextIcon | null = null;\n\n static NOWORK_ANIMATE_ATTR = {\n ellipsis: 1,\n wordBreak: 1,\n verticalDirection: 1,\n textAlign: 1,\n textBaseline: 1,\n textConfig: 1,\n layoutDirection: 1,\n ...NOWORK_ANIMATE_ATTR\n };\n\n constructor(params?: IRichTextGraphicAttribute) {\n super(params);\n this.numberType = RICHTEXT_NUMBER_TYPE;\n\n this.onBeforeAttributeUpdate = ((val: any, attributes: any, key: null | string | string[]) => {\n for (const key in val) {\n if (key === 'hoverIconId') {\n if (val[key] === attributes[key]) {\n continue;\n }\n const icon = this._frameCache.icons.get(val[key]);\n this.updateHoverIconState(icon);\n }\n }\n }) as any;\n }\n\n get width(): number {\n return this.attribute.width ?? DefaultRichTextAttribute.width;\n }\n set width(w: number) {\n if (this.attribute.width === w) {\n return;\n }\n this.attribute.width = w;\n this.addUpdateShapeAndBoundsTag();\n }\n get height(): number {\n return this.attribute.height ?? DefaultRichTextAttribute.height;\n }\n set height(h: number) {\n if (this.attribute.height === h) {\n return;\n }\n this.attribute.height = h;\n this.addUpdateShapeAndBoundsTag();\n }\n get maxWidth(): number | undefined {\n return this.attribute.maxWidth;\n }\n set maxWidth(mw: number | undefined) {\n if (this.attribute.maxWidth === mw) {\n return;\n }\n this.attribute.maxWidth = mw;\n this.addUpdateShapeAndBoundsTag();\n }\n get maxHeight(): number | undefined {\n return this.attribute.maxHeight;\n }\n set maxHeight(mh: number | undefined) {\n if (this.attribute.maxHeight === mh) {\n return;\n }\n this.attribute.maxHeight = mh;\n this.addUpdateShapeAndBoundsTag();\n }\n get ellipsis(): boolean | string {\n return this.attribute.ellipsis ?? DefaultRichTextAttribute.ellipsis;\n }\n set ellipsis(e: boolean | string) {\n if (this.attribute.ellipsis === e) {\n return;\n }\n this.attribute.ellipsis = e;\n this.addUpdateShapeAndBoundsTag();\n }\n get wordBreak(): RichTextWordBreak {\n return this.attribute.wordBreak ?? DefaultRichTextAttribute.wordBreak;\n }\n set wordBreak(wb: RichTextWordBreak) {\n if (this.attribute.wordBreak === wb) {\n return;\n }\n this.attribute.wordBreak = wb;\n this.addUpdateShapeAndBoundsTag();\n }\n get verticalDirection(): RichTextVerticalDirection {\n return this.attribute.verticalDirection ?? DefaultRichTextAttribute.verticalDirection;\n }\n set verticalDirection(vd: RichTextVerticalDirection) {\n if (this.attribute.verticalDirection === vd) {\n return;\n }\n this.attribute.verticalDirection = vd;\n this.addUpdateShapeAndBoundsTag();\n }\n get textAlign(): RichTextGlobalAlignType {\n return this.attribute.textAlign ?? DefaultRichTextAttribute.textAlign;\n }\n set textAlign(align: RichTextGlobalAlignType) {\n if (this.attribute.textAlign === align) {\n return;\n }\n this.attribute.textAlign = align;\n this.addUpdateShapeAndBoundsTag();\n }\n get textBaseline(): RichTextGlobalBaselineType {\n return this.attribute.textBaseline ?? DefaultRichTextAttribute.textBaseline;\n }\n set textBaseline(baseline: RichTextGlobalBaselineType) {\n if (this.attribute.textBaseline === baseline) {\n return;\n }\n this.attribute.textBaseline = baseline;\n this.addUpdateShapeAndBoundsTag();\n }\n get textConfig(): IRichTextCharacter[] {\n return this.attribute.textConfig ?? DefaultRichTextAttribute.textConfig;\n }\n set textConfig(config: IRichTextCharacter[]) {\n this.attribute.textConfig = config;\n this.addUpdateShapeAndBoundsTag();\n }\n\n getGraphicTheme(): Required<IRichTextGraphicAttribute> {\n return getTheme(this).richtext;\n }\n\n protected updateAABBBounds(\n attribute: IRichTextGraphicAttribute,\n richtextTheme: Required<IRichTextGraphicAttribute>,\n aabbBounds: IAABBBounds\n ) {\n const {\n width = richtextTheme.width,\n height = richtextTheme.height,\n maxWidth = richtextTheme.maxWidth,\n maxHeight = richtextTheme.maxHeight,\n textAlign = richtextTheme.textAlign,\n textBaseline = richtextTheme.textBaseline\n } = attribute;\n\n if (width > 0 && height > 0) {\n // 外部设置宽高\n aabbBounds.set(0, 0, width, height);\n } else {\n // 获取内容宽高\n const frameCache = this.getFrameCache();\n const { width: actualWidth, height: actualHeight } = frameCache.getActualSize();\n let contentWidth = width || actualWidth || 0;\n let contentHeight = height || actualHeight || 0;\n\n contentHeight = typeof maxHeight === 'number' && contentHeight > maxHeight ? maxHeight : contentHeight || 0;\n contentWidth = typeof maxWidth === 'number' && contentWidth > maxWidth ? maxWidth : contentWidth || 0;\n\n aabbBounds.set(0, 0, contentWidth, contentHeight);\n }\n\n // 调整对齐方式\n let deltaY = 0;\n switch (textBaseline) {\n case 'top':\n deltaY = 0;\n break;\n case 'middle':\n deltaY = -aabbBounds.height() / 2;\n break;\n case 'bottom':\n deltaY = -aabbBounds.height();\n break;\n default:\n break;\n }\n let deltaX = 0;\n switch (textAlign) {\n case 'left':\n deltaX = 0;\n break;\n case 'center':\n deltaX = -aabbBounds.width() / 2;\n break;\n case 'right':\n deltaX = -aabbBounds.width();\n break;\n default:\n break;\n }\n aabbBounds.translate(deltaX, deltaY);\n\n application.graphicService.updateTempAABBBounds(aabbBounds);\n\n if (attribute.forceBoundsHeight != null || attribute.forceBoundsWidth != null) {\n application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds);\n }\n application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, false, this);\n return aabbBounds;\n }\n\n protected needUpdateTags(keys: string[]): boolean {\n return super.needUpdateTags(keys, RICHTEXT_UPDATE_TAG_KEY);\n }\n protected needUpdateTag(key: string): boolean {\n return super.needUpdateTag(key, RICHTEXT_UPDATE_TAG_KEY);\n }\n getFrameCache(): Frame {\n if (this.shouldUpdateShape()) {\n this.doUpdateFrameCache();\n this.clearUpdateShapeTag();\n }\n return this._frameCache;\n }\n\n get cliped() {\n const frameCache = this.getFrameCache();\n if (frameCache.actualHeight > frameCache.height) {\n return true;\n }\n const { disableAutoWrapLine } = this.attribute;\n if (disableAutoWrapLine) {\n for (let i = 0; i < frameCache.lines.length; i++) {\n const l = frameCache.lines[i];\n for (let j = 0; j < l.paragraphs.length; j++) {\n const p = l.paragraphs[j];\n if ((p as any).overflow && (p as any).text !== '') {\n return true;\n }\n }\n }\n }\n return false;\n // if (height < this.attribute.height || )\n }\n combinedStyleToCharacter(config: IRichTextImageCharacter | IRichTextParagraphCharacter) {\n const {\n fill,\n stroke,\n fontSize,\n fontFamily,\n fontStyle,\n fontWeight,\n lineWidth,\n opacity,\n fillOpacity,\n strokeOpacity\n } = this.attribute;\n return {\n fill,\n stroke,\n fontSize,\n fontFamily,\n fontStyle,\n fontWeight,\n lineWidth,\n opacity,\n fillOpacity,\n strokeOpacity,\n ...config\n };\n }\n doUpdateFrameCache(tc?: IRichTextCharacter[]) {\n // 1. 测量,生成paragraph\n const {\n textConfig: _tc = [],\n maxWidth,\n maxHeight,\n width,\n height,\n ellipsis,\n wordBreak,\n verticalDirection,\n textAlign,\n textBaseline,\n layoutDirection,\n singleLine,\n disableAutoWrapLine\n } = this.attribute;\n const paragraphs: (Paragraph | RichTextIcon)[] = [];\n\n const textConfig = tc ?? _tc;\n\n for (let i = 0; i < textConfig.length; i++) {\n if ('image' in textConfig[i]) {\n const config = this.combinedStyleToCharacter(\n textConfig[i] as IRichTextImageCharacter\n ) as IRichTextImageCharacter;\n (config as any).lineWidth = undefined; // for icon bounds\n // 直接创建icon Mark\n const iconCache =\n config.id && this._frameCache && this._frameCache.icons && this._frameCache.icons.get(config.id);\n if (iconCache) {\n paragraphs.push(iconCache as RichTextIcon);\n } else {\n const icon = new RichTextIcon(config);\n icon.successCallback = () => {\n this.addUpdateBoundTag();\n this.stage?.renderNextFrame();\n };\n icon.richtextId = config.id;\n paragraphs.push(icon);\n }\n } else {\n const richTextConfig = this.combinedStyleToCharacter(\n textConfig[i] as IRichTextParagraphCharacter\n ) as IRichTextParagraphCharacter;\n if (isNumber(richTextConfig.text)) {\n richTextConfig.text = `${richTextConfig.text}`;\n }\n if (richTextConfig.text && richTextConfig.text.includes('\\n')) {\n // 如果有文字内有换行符,将该段文字切为多段,并在后一段加入newLine标记\n const textParts = richTextConfig.text.split('\\n');\n for (let j = 0; j < textParts.length; j++) {\n paragraphs.push(new Paragraph(textParts[j], j !== 0, richTextConfig));\n }\n } else if (richTextConfig.text) {\n paragraphs.push(new Paragraph(richTextConfig.text, false, richTextConfig));\n }\n }\n }\n\n // 2. 布局,生成frame\n // const frameHeight =\n // typeof maxHeight === 'number' && (!height || height > maxHeight) // height = 0或height>maxHeight,使用maxHeight布局\n // ? maxHeight\n // : height;\n // const frameWidth =\n // typeof maxWidth === 'number' && (!width || width > maxWidth) // height = 0或height>maxWidth,使用maxWidth布局\n // ? maxWidth\n // : width;\n\n const maxWidthFinite = typeof maxWidth === 'number' && Number.isFinite(maxWidth) && maxWidth > 0;\n const maxHeightFinite = typeof maxHeight === 'number' && Number.isFinite(maxHeight) && maxHeight > 0;\n\n const richTextWidthEnable =\n typeof width === 'number' &&\n Number.isFinite(width) &&\n width > 0 &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (!maxWidthFinite || width <= maxWidth);\n const richTextHeightEnable =\n typeof height === 'number' &&\n Number.isFinite(height) &&\n height > 0 &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (!maxHeightFinite || height <= maxHeight);\n\n const frameWidth = richTextWidthEnable ? width : maxWidthFinite ? maxWidth : 0;\n const frameHeight = richTextHeightEnable ? height : maxHeightFinite ? maxHeight : 0;\n\n const frame = new Frame(\n 0,\n 0,\n frameWidth || 0,\n frameHeight || 0,\n ellipsis,\n wordBreak,\n verticalDirection,\n textAlign,\n textBaseline,\n layoutDirection || 'horizontal',\n // typeof maxWidth === 'number' && (!width || width > maxWidth),\n // typeof maxHeight === 'number' && (!height || height > maxHeight),\n !richTextWidthEnable && maxWidthFinite,\n !richTextHeightEnable && maxHeightFinite,\n singleLine || false,\n this._frameCache?.icons\n );\n const wrapper = new Wrapper(frame);\n if (disableAutoWrapLine) {\n let lineCount = 0;\n let skip = false;\n for (let i = 0; i < paragraphs.length; i++) {\n const p = paragraphs[i];\n if (skip) {\n (p as Paragraph).overflow = true;\n (p as Paragraph).left = Infinity;\n (p as Paragraph).top = Infinity;\n !(p as Paragraph).newLine && frame.lines[frame.lines.length - 1].paragraphs.push(p);\n } else {\n wrapper.deal(p, true);\n }\n if (frame.lines.length !== lineCount) {\n lineCount = frame.lines.length;\n wrapper.lineBuffer.length = 0;\n (p as Paragraph).overflow = true;\n (p as Paragraph).left = 1000;\n (p as Paragraph).top = 1000;\n frame.lines[frame.lines.length - 1].paragraphs.push(p);\n skip = true;\n }\n if ((p as Paragraph).newLine) {\n skip = false;\n wrapper.lineWidth = 0;\n }\n wrapper.send();\n }\n } else {\n for (let i = 0; i < paragraphs.length; i++) {\n if (i === paragraphs.length - 1) {\n wrapper.newLine = true;\n }\n wrapper.deal(paragraphs[i]);\n wrapper.newLine = false;\n }\n }\n\n wrapper.send(); // 最后一行手动输出\n\n // 如果对应的配置宽度不可用,那么需要额外进行一次对齐\n const directionEnable = frame.layoutDirection === 'horizontal' ? richTextWidthEnable : richTextHeightEnable;\n if (!directionEnable) {\n // 使用实际宽度\n const frameSize = frame.getActualSizeWidthEllipsis();\n let offsetSize = frame.layoutDirection === 'horizontal' ? frameSize.width : frameSize.height;\n // 如果最大值可用\n if (frame.layoutDirection === 'horizontal' ? maxWidthFinite : maxHeightFinite) {\n // 取2者中的较小值\n offsetSize = Math.min(\n offsetSize,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n frame.layoutDirection === 'horizontal' ? maxWidth : maxHeight\n );\n }\n\n frame.lines.forEach(function (l) {\n l.calcOffset(offsetSize, false);\n });\n }\n\n this._frameCache = frame;\n\n // this.bindIconEvent();\n }\n\n clone() {\n return new RichText({ ...this.attribute });\n }\n\n setStage(stage?: IStage, layer?: ILayer) {\n super.setStage(stage, layer);\n const frameCache = this.getFrameCache();\n // for (let i = 0; i < frameCache.icons.length; i++) {\n // const icon = frameCache.icons[i];\n // icon.setStage(stage, layer);\n // }\n frameCache.icons.forEach(icon => {\n icon.setStage(stage, layer);\n });\n }\n\n // richtext绑定icon交互事件,供外部调用\n bindIconEvent() {\n this.addEventListener('pointermove', (e: FederatedMouseEvent) => {\n const pickedIcon = this.pickIcon(e.global);\n if (pickedIcon && pickedIcon === this._currentHoverIcon) {\n // do nothing\n } else if (pickedIcon) {\n this.setAttribute('hoverIconId', pickedIcon.richtextId);\n\n // this._currentHoverIcon?.setHoverState(false);\n // this._currentHoverIcon = pickedIcon;\n // this._currentHoverIcon.setHoverState(true);\n // this.stage?.setCursor(pickedIcon.attribute.cursor);\n // this.stage?.renderNextFrame();\n } else if (!pickedIcon && this._currentHoverIcon) {\n this.setAttribute('hoverIconId', undefined);\n\n // this._currentHoverIcon.setHoverState(false);\n // this._currentHoverIcon = null;\n // this.stage?.setCursor();\n // this.stage?.renderNextFrame();\n }\n });\n\n this.addEventListener('pointerleave', (e: FederatedMouseEvent) => {\n if (this._currentHoverIcon) {\n this.setAttribute('hoverIconId', undefined);\n\n // this._currentHoverIcon.setHoverState(false);\n // this._currentHoverIcon = null;\n // this.stage?.setCursor();\n // this.stage?.renderNextFrame();\n }\n });\n }\n\n updateHoverIconState(pickedIcon?: IRichTextIcon) {\n if (pickedIcon) {\n this._currentHoverIcon?.setHoverState(false);\n this._currentHoverIcon = pickedIcon;\n this._currentHoverIcon.setHoverState(true);\n this.stage?.setCursor(pickedIcon.attribute.cursor);\n this.stage?.renderNextFrame();\n } else {\n this._currentHoverIcon.setHoverState(false);\n this._currentHoverIcon = null;\n this.stage?.setCursor();\n this.stage?.renderNextFrame();\n }\n }\n\n pickIcon(point: EventPoint): IRichTextIcon | undefined {\n const frameCache = this.getFrameCache();\n const { e: x, f: y } = this.globalTransMatrix;\n // for (let i = 0; i < frameCache.icons.length; i++) {\n // const icon = frameCache.icons[i];\n // if (icon.containsPoint(point.x - x, point.y - y)) {\n // return icon;\n // }\n // }\n let pickIcon: IRichTextIcon | undefined;\n frameCache.icons.forEach((icon, key) => {\n const bounds = icon.AABBBounds.clone();\n bounds.translate(icon._marginArray[3], icon._marginArray[0]);\n if (bounds.containsPoint({ x: point.x - x, y: point.y - y })) {\n pickIcon = icon;\n\n pickIcon.globalX = (pickIcon.attribute.x ?? 0) + x + icon._marginArray[3];\n pickIcon.globalY = (pickIcon.attribute.y ?? 0) + y + icon._marginArray[0];\n }\n });\n\n return pickIcon;\n }\n\n getNoWorkAnimateAttr(): Record<string, number> {\n return RichText.NOWORK_ANIMATE_ATTR;\n }\n}\n\nexport function createRichText(attributes: IRichTextGraphicAttribute): IRichText {\n return new RichText(attributes);\n}\n"]}
package/es/index.d.ts CHANGED
@@ -89,3 +89,4 @@ export * from './plugins/builtin-plugin/html-attribute-plugin';
89
89
  export * from './plugins/builtin-plugin/react-attribute-plugin';
90
90
  export * from './plugins/builtin-plugin/3dview-transform-plugin';
91
91
  export * from './plugins/builtin-plugin/flex-layout-plugin';
92
+ export * from './animate/easing-func';
package/es/index.js CHANGED
@@ -179,4 +179,6 @@ export * from "./plugins/builtin-plugin/react-attribute-plugin";
179
179
  export * from "./plugins/builtin-plugin/3dview-transform-plugin";
180
180
 
181
181
  export * from "./plugins/builtin-plugin/flex-layout-plugin";
182
+
183
+ export * from "./animate/easing-func";
182
184
  //# sourceMappingURL=index.js.map
package/es/index.js.map C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ChE,cAAc,kDAAkD,CAAC;AACjE,cAAc,6CAA6C,CAAC","file":"index.js","sourcesContent":["// import 'core-js/proposals/reflect-metadata';\nimport './modules';\n\nexport * from './container';\nexport * from './core/global';\nexport * from './graphic';\nexport * from './modules';\nexport * from './create';\nexport * from './event';\nexport * from './interface';\nexport * from './render';\nexport * from './render/contributions/render/base-render';\nexport * from './canvas';\nexport * from './core';\nexport * from './core/light';\nexport * from './core/camera';\nexport * from './picker';\nexport * from './animate';\nexport * from './resource-loader/loader';\nexport * from './color-string';\nexport * from './factory';\n\n/* export common */\nexport * from './common/text';\nexport * from './common/bezier-utils';\nexport * from './common/bounds-context';\nexport * from './common/seg-context';\nexport * from './common/custom-path2d';\nexport * from './common/segment';\nexport * from './common/canvas-utils';\nexport * from './common/contribution-provider';\nexport * from './common/generator';\nexport * from './common/utils';\nexport * from './common/shape/arc';\nexport * from './common/shape/rect';\nexport * from './common/matrix';\nexport * from './common/simplify';\n\nexport * from './common/path-svg';\nexport * from './common/render-curve';\nexport * from './common/render-area';\nexport * from './common/render-command-list';\nexport * from './common/sort';\nexport * from './common/morphing-utils';\nexport * from './common/split-path';\nexport * from './common/enums';\nexport * from './common/generator';\nexport * from './plugins/constants';\nexport * from './plugins/builtin-plugin/richtext-edit-plugin';\nexport * from './allocator/matrix-allocate';\nexport * from './allocator/canvas-allocate';\nexport * from './allocator/graphic-allocate';\n\nexport * from './animate/default-ticker';\nexport { wrapCanvas, wrapContext } from './canvas/util';\nexport * from './common/xml';\nexport * from './common/inversify-lite';\nexport * from './constants';\nexport * from './application';\nexport * from './env-check';\n\nexport * from './render/contributions/render/arc-module';\nexport * from './render/contributions/render/rect-module';\nexport * from './render/contributions/render/line-module';\nexport * from './render/contributions/render/area-module';\nexport * from './render/contributions/render/symbol-module';\nexport * from './render/contributions/render/circle-module';\nexport * from './render/contributions/render/text-module';\nexport * from './render/contributions/render/path-module';\nexport * from './render/contributions/render/polygon-module';\nexport * from './render/contributions/render/glyph-module';\nexport * from './render/contributions/render/richtext-module';\nexport * from './render/contributions/render/image-module';\nexport * from './render/contributions/render/rect3d-module';\nexport * from './render/contributions/render/arc3d-module';\nexport * from './render/contributions/render/pyramid3d-module';\n\nexport * from './register/register-arc';\nexport * from './register/register-arc3d';\nexport * from './register/register-area';\nexport * from './register/register-circle';\nexport * from './register/register-glyph';\nexport * from './register/register-group';\nexport * from './register/register-image';\nexport * from './register/register-line';\nexport * from './register/register-path';\nexport * from './register/register-polygon';\nexport * from './register/register-pyramid3d';\nexport * from './register/register-rect';\nexport * from './register/register-rect3d';\nexport * from './register/register-richtext';\nexport * from './register/register-symbol';\nexport * from './register/register-text';\nexport * from './register/register-shadowRoot';\nexport * from './register/register-wraptext';\n\n// plugin\nexport * from './plugins/builtin-plugin/html-attribute-plugin';\nexport * from './plugins/builtin-plugin/react-attribute-plugin';\nexport * from './plugins/builtin-plugin/3dview-transform-plugin';\nexport * from './plugins/builtin-plugin/flex-layout-plugin';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,CAAC;AAEnB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,2CAA2C,CAAC;AAC1D,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAG1B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,c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AC;AAC3D,cAAc,gDAAgD,CAAC;AAE/D,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAG7C,cAAc,gDAAgD,CAAC;AAC/D,cAAc,iDAAiD,CAAC;AAChE,cAAc,kDAAkD,CAAC;AACjE,cAAc,6CAA6C,CAAC;AAE5D,cAAc,uBAAuB,CAAC","file":"index.js","sourcesContent":["// import 'core-js/proposals/reflect-metadata';\nimport './modules';\n\nexport * from './container';\nexport * from './core/global';\nexport * from './graphic';\nexport * from './modules';\nexport * from './create';\nexport * from './event';\nexport * from './interface';\nexport * from './render';\nexport * from './render/contributions/render/base-render';\nexport * from './canvas';\nexport * from './core';\nexport * from './core/light';\nexport * from './core/camera';\nexport * from './picker';\nexport * from './animate';\nexport * from './resource-loader/loader';\nexport * from './color-string';\nexport * from './factory';\n\n/* export common */\nexport * from './common/text';\nexport * from './common/bezier-utils';\nexport * from './common/bounds-context';\nexport * from './common/seg-context';\nexport * from './common/custom-path2d';\nexport * from './common/segment';\nexport * from './common/canvas-utils';\nexport * from './common/contribution-provider';\nexport * from './common/generator';\nexport * from './common/utils';\nexport * from './common/shape/arc';\nexport * from './common/shape/rect';\nexport * from './common/matrix';\nexport * from './common/simplify';\n\nexport * from './common/path-svg';\nexport * from './common/render-curve';\nexport * from './common/render-area';\nexport * from './common/render-command-list';\nexport * from './common/sort';\nexport * from './common/morphing-utils';\nexport * from './common/split-path';\nexport * from './common/enums';\nexport * from './common/generator';\nexport * from './plugins/constants';\nexport * from './plugins/builtin-plugin/richtext-edit-plugin';\nexport * from './allocator/matrix-allocate';\nexport * from './allocator/canvas-allocate';\nexport * from './allocator/graphic-allocate';\n\nexport * from './animate/default-ticker';\nexport { wrapCanvas, wrapContext } from './canvas/util';\nexport * from './common/xml';\nexport * from './common/inversify-lite';\nexport * from './constants';\nexport * from './application';\nexport * from './env-check';\n\nexport * from './render/contributions/render/arc-module';\nexport * from './render/contributions/render/rect-module';\nexport * from './render/contributions/render/line-module';\nexport * from './render/contributions/render/area-module';\nexport * from './render/contributions/render/symbol-module';\nexport * from './render/contributions/render/circle-module';\nexport * from './render/contributions/render/text-module';\nexport * from './render/contributions/render/path-module';\nexport * from './render/contributions/render/polygon-module';\nexport * from './render/contributions/render/glyph-module';\nexport * from './render/contributions/render/richtext-module';\nexport * from './render/contributions/render/image-module';\nexport * from './render/contributions/render/rect3d-module';\nexport * from './render/contributions/render/arc3d-module';\nexport * from './render/contributions/render/pyramid3d-module';\n\nexport * from './register/register-arc';\nexport * from './register/register-arc3d';\nexport * from './register/register-area';\nexport * from './register/register-circle';\nexport * from './register/register-glyph';\nexport * from './register/register-group';\nexport * from './register/register-image';\nexport * from './register/register-line';\nexport * from './register/register-path';\nexport * from './register/register-polygon';\nexport * from './register/register-pyramid3d';\nexport * from './register/register-rect';\nexport * from './register/register-rect3d';\nexport * from './register/register-richtext';\nexport * from './register/register-symbol';\nexport * from './register/register-text';\nexport * from './register/register-shadowRoot';\nexport * from './register/register-wraptext';\n\n// plugin\nexport * from './plugins/builtin-plugin/html-attribute-plugin';\nexport * from './plugins/builtin-plugin/react-attribute-plugin';\nexport * from './plugins/builtin-plugin/3dview-transform-plugin';\nexport * from './plugins/builtin-plugin/flex-layout-plugin';\n\nexport * from './animate/easing-func';\n"]}
@@ -2,48 +2,10 @@ import type { EventEmitter } from '@visactor/vutils';
2
2
  import type { AnimateMode, AnimateStatus, AnimateStepType } from '../common/enums';
3
3
  import type { Releaseable } from './common';
4
4
  import type { IGraphic } from './graphic';
5
- export declare class Easing {
6
- static linear(t: number): number;
7
- static none(): typeof Easing.linear;
8
- static get(amount: number): (t: number) => number;
9
- static getPowIn(pow: number): (t: number) => number;
10
- static getPowOut(pow: number): (t: number) => number;
11
- static getPowInOut(pow: number): (t: number) => number;
12
- static quadIn: (t: number) => number;
13
- static quadOut: (t: number) => number;
14
- static quadInOut: (t: number) => number;
15
- static cubicIn: (t: number) => number;
16
- static cubicOut: (t: number) => number;
17
- static cubicInOut: (t: number) => number;
18
- static quartIn: (t: number) => number;
19
- static quartOut: (t: number) => number;
20
- static quartInOut: (t: number) => number;
21
- static quintIn: (t: number) => number;
22
- static quintOut: (t: number) => number;
23
- static quintInOut: (t: number) => number;
24
- static getBackIn(amount: number): (t: number) => number;
25
- static getBackOut(amount: number): (t: number) => number;
26
- static getBackInOut(amount: number): (t: number) => number;
27
- static backIn: (t: number) => number;
28
- static backOut: (t: number) => number;
29
- static backInOut: (t: number) => number;
30
- static circIn(t: number): number;
31
- static circOut(t: number): number;
32
- static circInOut(t: number): number;
33
- static bounceOut(t: number): number;
34
- static bounceIn(t: number): number;
35
- static bounceInOut(t: number): number;
36
- static getElasticIn(amplitude: number, period: number): (t: number) => number;
37
- static getElasticOut(amplitude: number, period: number): (t: number) => number;
38
- static getElasticInOut(amplitude: number, period: number): (t: number) => number;
39
- static elasticIn: (t: number) => number;
40
- static elasticOut: (t: number) => number;
41
- static elasticInOut: (t: number) => number;
42
- }
43
5
  export interface Timeline {
44
6
  AnimateList: IAnimate[];
45
7
  }
46
- export type EasingTypeStr = 'linear' | 'quadIn' | 'quadOut' | 'quadInOut' | 'quadInOut' | 'cubicIn' | 'cubicOut' | 'cubicInOut' | 'quartIn' | 'quartOut' | 'quartInOut' | 'quintIn' | 'quintOut' | 'quintInOut' | 'backIn' | 'backOut' | 'backInOut' | 'circIn' | 'circOut' | 'circInOut' | 'bounceOut' | 'bounceIn' | 'bounceInOut' | 'elasticIn' | 'elasticOut' | 'elasticInOut' | 'sineIn' | 'sineOut' | 'sineInOut' | 'expoIn' | 'expoOut' | 'expoInOut' | '';
8
+ export type EasingTypeStr = 'linear' | 'quadIn' | 'quadOut' | 'quadInOut' | 'quadInOut' | 'cubicIn' | 'cubicOut' | 'cubicInOut' | 'quartIn' | 'quartOut' | 'quartInOut' | 'quintIn' | 'quintOut' | 'quintInOut' | 'backIn' | 'backOut' | 'backInOut' | 'circIn' | 'circOut' | 'circInOut' | 'bounceOut' | 'bounceIn' | 'bounceInOut' | 'elasticIn' | 'elasticOut' | 'elasticInOut' | 'sineIn' | 'sineOut' | 'sineInOut' | 'expoIn' | 'expoOut' | 'expoInOut' | 'easeInOutQuad' | 'easeOutElastic' | 'easeInOutElastic' | '';
47
9
  export type EasingTypeFunc = (t: number) => number;
48
10
  export type EasingType = EasingTypeStr | EasingTypeFunc;
49
11
  export type IAnimateStepType = keyof typeof AnimateStepType;
@@ -103,6 +65,7 @@ export interface IAnimate {
103
65
  getStartProps: () => Record<string, any>;
104
66
  getEndProps: () => Record<string, any>;
105
67
  setTimeline: (timeline: ITimeline) => void;
68
+ readonly timeline: ITimeline;
106
69
  bind: (target: IAnimateTarget) => this;
107
70
  to: (props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) => this;
108
71
  from: (props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) => this;
@@ -190,5 +153,8 @@ export interface ITicker extends EventEmitter {
190
153
  stop: () => void;
191
154
  addTimeline: (timeline: ITimeline) => void;
192
155
  remTimeline: (timeline: ITimeline) => void;
156
+ getTimelines: () => ITimeline[];
157
+ release: () => void;
158
+ autoStop: boolean;
193
159
  trySyncTickStatus: () => void;
194
160
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/interface/animate.ts"],"names":[],"mappings":"","file":"animate.js","sourcesContent":["import type { EventEmitter } from '@visactor/vutils';\nimport type { AnimateMode, AnimateStatus, AnimateStepType } from '../common/enums';\nimport type { Releaseable } from './common';\nimport type { IGraphic } from './graphic';\n\n// export type EasingType = (...args: any) => any;\n\nexport declare class Easing {\n static linear(t: number): number;\n static none(): typeof Easing.linear;\n /**\n * 获取缓动函数,amount指示这个缓动函数的插值方式\n * @param amount\n * @returns\n */\n static get(amount: number): (t: number) => number;\n static getPowIn(pow: number): (t: number) => number;\n static getPowOut(pow: number): (t: number) => number;\n static getPowInOut(pow: number): (t: number) => number;\n static quadIn: (t: number) => number;\n static quadOut: (t: number) => number;\n static quadInOut: (t: number) => number;\n static cubicIn: (t: number) => number;\n static cubicOut: (t: number) => number;\n static cubicInOut: (t: number) => number;\n static quartIn: (t: number) => number;\n static quartOut: (t: number) => number;\n static quartInOut: (t: number) => number;\n static quintIn: (t: number) => number;\n static quintOut: (t: number) => number;\n static quintInOut: (t: number) => number;\n static getBackIn(amount: number): (t: number) => number;\n static getBackOut(amount: number): (t: number) => number;\n static getBackInOut(amount: number): (t: number) => number;\n static backIn: (t: number) => number;\n static backOut: (t: number) => number;\n static backInOut: (t: number) => number;\n static circIn(t: number): number;\n static circOut(t: number): number;\n static circInOut(t: number): number;\n static bounceOut(t: number): number;\n static bounceIn(t: number): number;\n static bounceInOut(t: number): number;\n static getElasticIn(amplitude: number, period: number): (t: number) => number;\n static getElasticOut(amplitude: number, period: number): (t: number) => number;\n static getElasticInOut(amplitude: number, period: number): (t: number) => number;\n static elasticIn: (t: number) => number;\n static elasticOut: (t: number) => number;\n static elasticInOut: (t: number) => number;\n}\n\n// timeline管理一堆的animate,多个timeline互不影响\n// timeline主要作用是基于layer层面的整体管理\n// 每个layer默认带有一个timeline\nexport interface Timeline {\n AnimateList: IAnimate[];\n}\n\ntype IStopType = 'end' | 'start' | 'current';\n\n// TODO: 提供options配置可序列化\ninterface AnimateSpecItem {\n type: 'to' | 'delay' | 'stop' | 'any';\n params: any[];\n}\n\nexport type EasingTypeStr =\n | 'linear'\n | 'quadIn'\n | 'quadOut'\n | 'quadInOut'\n | 'quadInOut'\n | 'cubicIn'\n | 'cubicOut'\n | 'cubicInOut'\n | 'quartIn'\n | 'quartOut'\n | 'quartInOut'\n | 'quintIn'\n | 'quintOut'\n | 'quintInOut'\n | 'backIn'\n | 'backOut'\n | 'backInOut'\n | 'circIn'\n | 'circOut'\n | 'circInOut'\n | 'bounceOut'\n | 'bounceIn'\n | 'bounceInOut'\n | 'elasticIn'\n | 'elasticOut'\n | 'elasticInOut'\n | 'sineIn'\n | 'sineOut'\n | 'sineInOut'\n | 'expoIn'\n | 'expoOut'\n | 'expoInOut'\n | '';\nexport type EasingTypeFunc = (t: number) => number;\n\nexport type EasingType = EasingTypeStr | EasingTypeFunc;\n\nexport type IAnimateStepType = keyof typeof AnimateStepType;\n\nexport interface IStep {\n type: IAnimateStepType;\n prev?: IStep;\n // 持续时间\n duration: number;\n // 在animate中的位置\n position: number;\n next?: IStep;\n props?: any;\n parsedProps?: any;\n propKeys?: string[];\n easing?: EasingTypeFunc;\n customAnimate?: ICustomAnimate;\n\n append: (step: IStep) => void;\n getLastProps: () => any;\n}\n\nexport interface IStepConfig {\n tempProps?: boolean; // props为临时props,可以直接使用不用拷贝\n noPreventAttrs?: boolean;\n}\n\nexport interface IAnimateTarget {\n onAnimateBind?: (animte: IAnimate | ISubAnimate) => void;\n // 添加动画step的时候调用\n onAddStep?: (step: IStep) => void;\n // step时调用\n onStep: (subAnimate: ISubAnimate, animate: IAnimate, step: IStep, ratio: number, end: boolean) => void;\n // 插值函数\n stepInterpolate: (\n subAnimate: ISubAnimate,\n animate: IAnimate,\n nextAttributes: Record<string, any>,\n step: IStep,\n ratio: number,\n end: boolean,\n nextProps: Record<string, any>,\n lastProps?: Record<string, any>,\n nextParsedProps?: any,\n propKeys?: string[]\n ) => void;\n // 获取属性\n getComputedAttribute: (name: string) => any;\n // 获取默认属性\n getDefaultAttribute: (name: string) => any;\n onStop: (props?: Record<string, any>) => void;\n animates: Map<string | number, IAnimate>;\n [key: string]: any;\n}\n\nexport interface ICustomAnimate {\n duration: number;\n easing: EasingType;\n step?: IStep;\n mode?: AnimateMode;\n\n bind: (target: IAnimateTarget, subAni: ISubAnimate) => void;\n // 在第一次调用的时候触发\n onBind: () => void;\n // 第一次执行的时候调用\n onFirstRun: () => void;\n // 开始执行的时候调用(如果有循环,那每个周期都会调用)\n onStart: () => void;\n // 结束执行的时候调用(如果有循环,那每个周期都会调用)\n onEnd: () => void;\n onUpdate: (end: boolean, ratio: number, out: Record<string, any>) => void;\n update: (end: boolean, ratio: number, out: Record<string, any>) => void;\n getEndProps: () => Record<string, any> | void;\n getFromProps: () => Record<string, any> | void;\n getMergedEndProps: () => Record<string, any> | void;\n}\n\n// 每一个animate绑定一个graphic,用于描述这个graphic的动画内容\n// 在timeline层面,animate相当于是一段timeslice\nexport interface IAnimate {\n readonly id: string | number;\n status: AnimateStatus;\n\n interpolateFunc: (key: string, ratio: number, from: any, to: any, nextAttributes: any) => boolean;\n\n _onStart?: (() => void)[];\n _onFrame?: ((step: IStep, ratio: number) => void)[];\n _onEnd?: (() => void)[];\n _onRemove?: (() => void)[];\n\n getStartProps: () => Record<string, any>;\n getEndProps: () => Record<string, any>;\n\n setTimeline: (timeline: ITimeline) => void;\n\n bind: (target: IAnimateTarget) => this;\n to: (props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) => this;\n from: (props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) => this;\n pause: () => void;\n resume: () => void;\n onStart: (cb: () => void) => void;\n onEnd: (cb: () => void) => void;\n onFrame: (cb: (step: IStep, ratio: number) => void) => void;\n // 屏蔽属性\n preventAttr: (key: string) => void;\n // 屏蔽属性\n preventAttrs: (key: string[]) => void;\n // 属性是否合法\n validAttr: (key: string) => boolean;\n\n runCb: (cb: (a: IAnimate, step: IStep) => void) => IAnimate;\n\n // 自定义插值,返回false表示没有匹配上\n customInterpolate: (\n key: string,\n ratio: number,\n from: any,\n to: any,\n target: IAnimateTarget,\n ret: Record<string, any>\n ) => boolean;\n //\n play: (customAnimate: ICustomAnimate) => this;\n\n // 获取该属性的上一个值\n // getLastPropByName: (name: string, step: IStep) => any;\n // delay: (duration: number) => IAnimate;\n stop: (type?: 'start' | 'end' | Record<string, any>) => void;\n /** 打上END标志,下一帧被删除 */\n release: () => void;\n // 获取持续的时长\n getDuration: () => number;\n // 获取动画开始时间(注意并不是子动画的startAt)\n getStartTime: () => number;\n // done: (cb: (_: any) => any) => IAnimate;\n // pause: () => IAnimate;\n // spec: (spec: AnimateSpecItem[]) => IAnimate;\n // start: () => void; // 有start方法,避免动画提前开始(VGrammar需要时间处理数据)\n wait: (delay: number) => this;\n\n // // 编排\n afterAll: (list: IAnimate[]) => this;\n after: (animate: IAnimate) => this;\n parallel: (animate: IAnimate) => this;\n\n // // timislice (getter)\n // startTime: number;\n // endTime: number;\n // startTimes: number[];\n // endTimes: number[];\n\n // // 高级参数,frame到frameEnd之间可以进行reverse,loop,bounce效果\n // frame: () => IAnimate;\n // frameEnd: () => IAnimate;\n reversed: (r: boolean) => IAnimate;\n loop: (n: number) => IAnimate;\n bounce: (b: boolean) => IAnimate;\n\n nextAnimate?: IAnimate;\n prevAnimate?: IAnimate;\n\n advance: (delta: number) => void;\n\n startAt: (t: number) => IAnimate;\n\n // // 语法糖\n // create: (duration: number) => IAnimate;\n // fadeIn: (duration: number) => IAnimate;\n}\n\nexport interface ISubAnimate {\n getLastStep: () => IStep;\n animate: IAnimate;\n // 获取该属性的上一个值\n getLastPropByName: (name: string, step: IStep) => any;\n}\n\n// rect.animate().abc().to({}, 1000).delay(1000).frame().to().delay().to().frameEnd().loop().bounce()\n\nexport interface BaseAnimateConfig {\n id?: number | string;\n interpolate?: (key: string, ratio: number, from: any, to: any, nextAttributes: any) => boolean;\n onStart?: () => void;\n onFrame?: (step: IStep, ratio: number) => void;\n onEnd?: () => void;\n onRemove?: () => void;\n}\n\n// VGrammar和 vrender命名不一致,好尴尬\nexport interface MorphingAnimateConfig extends Omit<BaseAnimateConfig, 'interpolate'> {\n duration?: number;\n easing?: EasingType; // 统一到easing\n delay?: number;\n}\n\nexport interface MultiMorphingAnimateConfig extends MorphingAnimateConfig {\n splitPath?: 'clone' | ((graphic: IGraphic, count: number, needAppend?: boolean) => IGraphic[]);\n individualDelay?: (index: number, count: number, fromGraphic: IGraphic, toGraphic: IGraphic) => number;\n}\n\nexport interface ITimeline {\n id: number;\n animateCount: number;\n addAnimate: (animate: IAnimate) => void;\n removeAnimate: (animate: IAnimate, release?: boolean) => void;\n tick: (delta: number) => void;\n clear: () => void;\n pause: () => void;\n resume: () => void;\n}\n\nexport interface ITickHandler extends Releaseable {\n avaliable: () => boolean;\n /**\n * 开始执行tick\n * @param interval 延时 ms\n * @param cb 执行的回调\n */\n tick: (interval: number, cb: (handler: ITickHandler) => void) => void; // 开始\n tickTo?: (t: number, cb: (handler: ITickHandler, params?: { once: boolean }) => void) => void;\n getTime: () => number; // 获取时间\n}\n\nexport interface ITickerHandlerStatic {\n Avaliable: () => boolean;\n new (): ITickHandler;\n}\n\nexport interface ITicker extends EventEmitter {\n setFPS?: (fps: number) => void;\n setInterval?: (interval: number) => void;\n getFPS?: () => number;\n getInterval?: () => number;\n tick: (interval: number) => void;\n tickAt?: (time: number) => void;\n pause: () => boolean;\n resume: () => boolean;\n /**\n * 开启tick,force为true强制开启,否则如果timeline为空则不开启\n */\n start: (force?: boolean) => boolean;\n stop: () => void;\n addTimeline: (timeline: ITimeline) => void;\n remTimeline: (timeline: ITimeline) => void;\n trySyncTickStatus: () => void;\n}\n"]}
1
+ {"version":3,"sources":["../src/interface/animate.ts"],"names":[],"mappings":"","file":"animate.js","sourcesContent":["import type { EventEmitter } from '@visactor/vutils';\nimport type { AnimateMode, AnimateStatus, AnimateStepType } from '../common/enums';\nimport type { Releaseable } from './common';\nimport type { IGraphic } from './graphic';\n\n// export type EasingType = (...args: any) => any;\n\n// export declare class Easing {\n// static linear(t: number): number;\n// static none(): typeof Easing.linear;\n// /**\n// * 获取缓动函数,amount指示这个缓动函数的插值方式\n// * @param amount\n// * @returns\n// */\n// static get(amount: number): (t: number) => number;\n// static getPowIn(pow: number): (t: number) => number;\n// static getPowOut(pow: number): (t: number) => number;\n// static getPowInOut(pow: number): (t: number) => number;\n// static quadIn: (t: number) => number;\n// static quadOut: (t: number) => number;\n// static quadInOut: (t: number) => number;\n// static cubicIn: (t: number) => number;\n// static cubicOut: (t: number) => number;\n// static cubicInOut: (t: number) => number;\n// static quartIn: (t: number) => number;\n// static quartOut: (t: number) => number;\n// static quartInOut: (t: number) => number;\n// static quintIn: (t: number) => number;\n// static quintOut: (t: number) => number;\n// static quintInOut: (t: number) => number;\n// static getBackIn(amount: number): (t: number) => number;\n// static getBackOut(amount: number): (t: number) => number;\n// static getBackInOut(amount: number): (t: number) => number;\n// static backIn: (t: number) => number;\n// static backOut: (t: number) => number;\n// static backInOut: (t: number) => number;\n// static circIn(t: number): number;\n// static circOut(t: number): number;\n// static circInOut(t: number): number;\n// static bounceOut(t: number): number;\n// static bounceIn(t: number): number;\n// static bounceInOut(t: number): number;\n// static getElasticIn(amplitude: number, period: number): (t: number) => number;\n// static getElasticOut(amplitude: number, period: number): (t: number) => number;\n// static getElasticInOut(amplitude: number, period: number): (t: number) => number;\n// static elasticIn: (t: number) => number;\n// static elasticOut: (t: number) => number;\n// static elasticInOut: (t: number) => number;\n// }\n\n// timeline管理一堆的animate,多个timeline互不影响\n// timeline主要作用是基于layer层面的整体管理\n// 每个layer默认带有一个timeline\nexport interface Timeline {\n AnimateList: IAnimate[];\n}\n\ntype IStopType = 'end' | 'start' | 'current';\n\n// TODO: 提供options配置可序列化\ninterface AnimateSpecItem {\n type: 'to' | 'delay' | 'stop' | 'any';\n params: any[];\n}\n\nexport type EasingTypeStr =\n | 'linear'\n | 'quadIn'\n | 'quadOut'\n | 'quadInOut'\n | 'quadInOut'\n | 'cubicIn'\n | 'cubicOut'\n | 'cubicInOut'\n | 'quartIn'\n | 'quartOut'\n | 'quartInOut'\n | 'quintIn'\n | 'quintOut'\n | 'quintInOut'\n | 'backIn'\n | 'backOut'\n | 'backInOut'\n | 'circIn'\n | 'circOut'\n | 'circInOut'\n | 'bounceOut'\n | 'bounceIn'\n | 'bounceInOut'\n | 'elasticIn'\n | 'elasticOut'\n | 'elasticInOut'\n | 'sineIn'\n | 'sineOut'\n | 'sineInOut'\n | 'expoIn'\n | 'expoOut'\n | 'expoInOut'\n // @since 0.21.0\n | 'easeInOutQuad'\n | 'easeOutElastic'\n | 'easeInOutElastic'\n | '';\nexport type EasingTypeFunc = (t: number) => number;\n\nexport type EasingType = EasingTypeStr | EasingTypeFunc;\n\nexport type IAnimateStepType = keyof typeof AnimateStepType;\n\nexport interface IStep {\n type: IAnimateStepType;\n prev?: IStep;\n // 持续时间\n duration: number;\n // 在animate中的位置\n position: number;\n next?: IStep;\n props?: any;\n parsedProps?: any;\n propKeys?: string[];\n easing?: EasingTypeFunc;\n customAnimate?: ICustomAnimate;\n\n append: (step: IStep) => void;\n getLastProps: () => any;\n}\n\nexport interface IStepConfig {\n tempProps?: boolean; // props为临时props,可以直接使用不用拷贝\n noPreventAttrs?: boolean;\n}\n\nexport interface IAnimateTarget {\n onAnimateBind?: (animte: IAnimate | ISubAnimate) => void;\n // 添加动画step的时候调用\n onAddStep?: (step: IStep) => void;\n // step时调用\n onStep: (subAnimate: ISubAnimate, animate: IAnimate, step: IStep, ratio: number, end: boolean) => void;\n // 插值函数\n stepInterpolate: (\n subAnimate: ISubAnimate,\n animate: IAnimate,\n nextAttributes: Record<string, any>,\n step: IStep,\n ratio: number,\n end: boolean,\n nextProps: Record<string, any>,\n lastProps?: Record<string, any>,\n nextParsedProps?: any,\n propKeys?: string[]\n ) => void;\n // 获取属性\n getComputedAttribute: (name: string) => any;\n // 获取默认属性\n getDefaultAttribute: (name: string) => any;\n onStop: (props?: Record<string, any>) => void;\n animates: Map<string | number, IAnimate>;\n [key: string]: any;\n}\n\nexport interface ICustomAnimate {\n duration: number;\n easing: EasingType;\n step?: IStep;\n mode?: AnimateMode;\n\n bind: (target: IAnimateTarget, subAni: ISubAnimate) => void;\n // 在第一次调用的时候触发\n onBind: () => void;\n // 第一次执行的时候调用\n onFirstRun: () => void;\n // 开始执行的时候调用(如果有循环,那每个周期都会调用)\n onStart: () => void;\n // 结束执行的时候调用(如果有循环,那每个周期都会调用)\n onEnd: () => void;\n onUpdate: (end: boolean, ratio: number, out: Record<string, any>) => void;\n update: (end: boolean, ratio: number, out: Record<string, any>) => void;\n getEndProps: () => Record<string, any> | void;\n getFromProps: () => Record<string, any> | void;\n getMergedEndProps: () => Record<string, any> | void;\n}\n\n// 每一个animate绑定一个graphic,用于描述这个graphic的动画内容\n// 在timeline层面,animate相当于是一段timeslice\nexport interface IAnimate {\n readonly id: string | number;\n status: AnimateStatus;\n\n interpolateFunc: (key: string, ratio: number, from: any, to: any, nextAttributes: any) => boolean;\n\n _onStart?: (() => void)[];\n _onFrame?: ((step: IStep, ratio: number) => void)[];\n _onEnd?: (() => void)[];\n _onRemove?: (() => void)[];\n\n getStartProps: () => Record<string, any>;\n getEndProps: () => Record<string, any>;\n\n setTimeline: (timeline: ITimeline) => void;\n // getTimeline: () => ITimeline;\n readonly timeline: ITimeline;\n\n bind: (target: IAnimateTarget) => this;\n to: (props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) => this;\n from: (props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) => this;\n pause: () => void;\n resume: () => void;\n onStart: (cb: () => void) => void;\n onEnd: (cb: () => void) => void;\n onFrame: (cb: (step: IStep, ratio: number) => void) => void;\n // 屏蔽属性\n preventAttr: (key: string) => void;\n // 屏蔽属性\n preventAttrs: (key: string[]) => void;\n // 属性是否合法\n validAttr: (key: string) => boolean;\n\n runCb: (cb: (a: IAnimate, step: IStep) => void) => IAnimate;\n\n // 自定义插值,返回false表示没有匹配上\n customInterpolate: (\n key: string,\n ratio: number,\n from: any,\n to: any,\n target: IAnimateTarget,\n ret: Record<string, any>\n ) => boolean;\n //\n play: (customAnimate: ICustomAnimate) => this;\n\n // 获取该属性的上一个值\n // getLastPropByName: (name: string, step: IStep) => any;\n // delay: (duration: number) => IAnimate;\n stop: (type?: 'start' | 'end' | Record<string, any>) => void;\n /** 打上END标志,下一帧被删除 */\n release: () => void;\n // 获取持续的时长\n getDuration: () => number;\n // 获取动画开始时间(注意并不是子动画的startAt)\n getStartTime: () => number;\n // done: (cb: (_: any) => any) => IAnimate;\n // pause: () => IAnimate;\n // spec: (spec: AnimateSpecItem[]) => IAnimate;\n // start: () => void; // 有start方法,避免动画提前开始(VGrammar需要时间处理数据)\n wait: (delay: number) => this;\n\n // // 编排\n afterAll: (list: IAnimate[]) => this;\n after: (animate: IAnimate) => this;\n parallel: (animate: IAnimate) => this;\n\n // // timislice (getter)\n // startTime: number;\n // endTime: number;\n // startTimes: number[];\n // endTimes: number[];\n\n // // 高级参数,frame到frameEnd之间可以进行reverse,loop,bounce效果\n // frame: () => IAnimate;\n // frameEnd: () => IAnimate;\n reversed: (r: boolean) => IAnimate;\n loop: (n: number) => IAnimate;\n bounce: (b: boolean) => IAnimate;\n\n nextAnimate?: IAnimate;\n prevAnimate?: IAnimate;\n\n advance: (delta: number) => void;\n\n startAt: (t: number) => IAnimate;\n\n // // 语法糖\n // create: (duration: number) => IAnimate;\n // fadeIn: (duration: number) => IAnimate;\n}\n\nexport interface ISubAnimate {\n getLastStep: () => IStep;\n animate: IAnimate;\n // 获取该属性的上一个值\n getLastPropByName: (name: string, step: IStep) => any;\n}\n\n// rect.animate().abc().to({}, 1000).delay(1000).frame().to().delay().to().frameEnd().loop().bounce()\n\nexport interface BaseAnimateConfig {\n id?: number | string;\n interpolate?: (key: string, ratio: number, from: any, to: any, nextAttributes: any) => boolean;\n onStart?: () => void;\n onFrame?: (step: IStep, ratio: number) => void;\n onEnd?: () => void;\n onRemove?: () => void;\n}\n\n// VGrammar和 vrender命名不一致,好尴尬\nexport interface MorphingAnimateConfig extends Omit<BaseAnimateConfig, 'interpolate'> {\n duration?: number;\n easing?: EasingType; // 统一到easing\n delay?: number;\n}\n\nexport interface MultiMorphingAnimateConfig extends MorphingAnimateConfig {\n splitPath?: 'clone' | ((graphic: IGraphic, count: number, needAppend?: boolean) => IGraphic[]);\n individualDelay?: (index: number, count: number, fromGraphic: IGraphic, toGraphic: IGraphic) => number;\n}\n\nexport interface ITimeline {\n id: number;\n animateCount: number;\n addAnimate: (animate: IAnimate) => void;\n removeAnimate: (animate: IAnimate, release?: boolean) => void;\n tick: (delta: number) => void;\n clear: () => void;\n pause: () => void;\n resume: () => void;\n}\n\nexport interface ITickHandler extends Releaseable {\n avaliable: () => boolean;\n /**\n * 开始执行tick\n * @param interval 延时 ms\n * @param cb 执行的回调\n */\n tick: (interval: number, cb: (handler: ITickHandler) => void) => void; // 开始\n tickTo?: (t: number, cb: (handler: ITickHandler, params?: { once: boolean }) => void) => void;\n getTime: () => number; // 获取时间\n}\n\nexport interface ITickerHandlerStatic {\n Avaliable: () => boolean;\n new (): ITickHandler;\n}\n\nexport interface ITicker extends EventEmitter {\n setFPS?: (fps: number) => void;\n setInterval?: (interval: number) => void;\n getFPS?: () => number;\n getInterval?: () => number;\n tick: (interval: number) => void;\n tickAt?: (time: number) => void;\n pause: () => boolean;\n resume: () => boolean;\n /**\n * 开启tick,force为true强制开启,否则如果timeline为空则不开启\n */\n start: (force?: boolean) => boolean;\n stop: () => void;\n addTimeline: (timeline: ITimeline) => void;\n remTimeline: (timeline: ITimeline) => void;\n getTimelines: () => ITimeline[];\n\n release: () => void;\n\n // 是否自动停止,默认为true\n autoStop: boolean;\n trySyncTickStatus: () => void;\n}\n"]}
@@ -2,6 +2,7 @@ import type { IGraphicAttribute, IGraphic } from '../graphic';
2
2
  import type { ICustomPath2D } from '../path';
3
3
  export type IPathAttribute = {
4
4
  path: ICustomPath2D | string;
5
+ clipRange: number;
5
6
  customPath: (context: ICustomPath2D, pathMark: IPath) => void;
6
7
  };
7
8
  export type IPathGraphicAttribute = Partial<IGraphicAttribute> & Partial<IPathAttribute>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/interface/graphic/path.ts"],"names":[],"mappings":"","file":"path.js","sourcesContent":["import type { IGraphicAttribute, IGraphic } from '../graphic';\nimport type { ICustomPath2D } from '../path';\n// TODO: Path svg <Path path='' />\n\nexport type IPathAttribute = {\n path: ICustomPath2D | string;\n customPath: (context: ICustomPath2D, pathMark: IPath) => void;\n};\n\nexport type IPathGraphicAttribute = Partial<IGraphicAttribute> & Partial<IPathAttribute>;\n\nexport type ShapeType = 'area' | 'circle' | 'ellipse' | 'line' | 'rect';\n\nexport interface IPath extends IGraphic<IPathGraphicAttribute> {\n originType?: ShapeType;\n cache?: ICustomPath2D;\n pathShape: ICustomPath2D;\n\n getParsedPathShape: () => ICustomPath2D;\n}\n"]}
1
+ {"version":3,"sources":["../src/interface/graphic/path.ts"],"names":[],"mappings":"","file":"path.js","sourcesContent":["import type { IGraphicAttribute, IGraphic } from '../graphic';\nimport type { ICustomPath2D } from '../path';\n// TODO: Path svg <Path path='' />\n\nexport type IPathAttribute = {\n path: ICustomPath2D | string;\n clipRange: number;\n customPath: (context: ICustomPath2D, pathMark: IPath) => void;\n};\n\nexport type IPathGraphicAttribute = Partial<IGraphicAttribute> & Partial<IPathAttribute>;\n\nexport type ShapeType = 'area' | 'circle' | 'ellipse' | 'line' | 'rect';\n\nexport interface IPath extends IGraphic<IPathGraphicAttribute> {\n originType?: ShapeType;\n cache?: ICustomPath2D;\n pathShape: ICustomPath2D;\n\n getParsedPathShape: () => ICustomPath2D;\n}\n"]}
@@ -4,6 +4,7 @@ import type { ICustomPath2D, IPath2D } from '../path';
4
4
  export type ISymbolAttribute = {
5
5
  symbolType: SymbolType;
6
6
  size: number | [number, number];
7
+ clipRange: number;
7
8
  };
8
9
  export type ISymbolGraphicAttribute = Partial<IGraphicAttribute> & Partial<ISymbolAttribute>;
9
10
  export interface ISymbol extends IGraphic<ISymbolGraphicAttribute> {
@@ -16,6 +17,7 @@ export interface ISymbolClass {
16
17
  pathStr: string;
17
18
  isSvg?: boolean;
18
19
  draw: (ctx: IPath2D, size: number | [number, number], x: number, y: number, z?: number, cb?: (p: ICustomPath2D, a: any) => void) => boolean;
20
+ drawWithClipRange?: (ctx: IPath2D, size: number | [number, number], x: number, y: number, clipRange: number, z?: number, cb?: (p: ICustomPath2D, a: any) => void) => boolean;
19
21
  drawOffset: (ctx: IPath2D, size: number | [number, number], x: number, y: number, offset: number, z?: number, cb?: (p: ICustomPath2D, a: any) => void) => boolean;
20
22
  drawToSvgPath?: (size: number | [number, number], x: number, y: number, z?: number) => string;
21
23
  bounds: (size: number | [number, number], bounds: IBounds) => void;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/interface/graphic/symbol.ts"],"names":[],"mappings":"","file":"symbol.js","sourcesContent":["import type { IBounds } from '@visactor/vutils';\nimport type { IGraphicAttribute, IGraphic } from '../graphic';\nimport type { ICustomPath2D, IPath2D } from '../path';\n\nexport type ISymbolAttribute = {\n symbolType: SymbolType;\n size: number | [number, number];\n};\n\nexport type ISymbolGraphicAttribute = Partial<IGraphicAttribute> & Partial<ISymbolAttribute>;\n\nexport interface ISymbol extends IGraphic<ISymbolGraphicAttribute> {\n getParsedPath: () => ISymbolClass;\n}\n\nexport type SymbolType =\n | 'circle'\n | 'cross'\n | 'diamond'\n | 'square'\n | 'arrow'\n | 'arrowLeft'\n | 'arrowRight'\n | 'arrow2Left'\n | 'arrow2Right'\n | 'wedge'\n | 'thinTriangle'\n | 'triangle'\n | 'triangleUp'\n | 'triangleDown'\n | 'triangleRight'\n | 'triangleLeft'\n | 'stroke'\n | 'star'\n | 'wye'\n | 'rect'\n | 'rectRound'\n | 'roundLine'\n | string;\n\nexport interface ISymbolClass {\n type: SymbolType | string;\n path?: ICustomPath2D;\n pathStr: string;\n isSvg?: boolean;\n\n // 返回true表示内部已经调用closePath,返回false表示没有调用closePath,外部需要调用closePath\n draw: (\n ctx: IPath2D,\n size: number | [number, number],\n x: number,\n y: number,\n z?: number,\n cb?: (p: ICustomPath2D, a: any) => void\n ) => boolean;\n drawOffset: (\n ctx: IPath2D,\n size: number | [number, number],\n x: number,\n y: number,\n offset: number,\n z?: number,\n cb?: (p: ICustomPath2D, a: any) => void\n ) => boolean;\n\n drawToSvgPath?: (size: number | [number, number], x: number, y: number, z?: number) => string;\n\n bounds: (size: number | [number, number], bounds: IBounds) => void;\n}\n"]}
1
+ {"version":3,"sources":["../src/interface/graphic/symbol.ts"],"names":[],"mappings":"","file":"symbol.js","sourcesContent":["import type { IBounds } from '@visactor/vutils';\nimport type { IGraphicAttribute, IGraphic } from '../graphic';\nimport type { ICustomPath2D, IPath2D } from '../path';\n\nexport type ISymbolAttribute = {\n symbolType: SymbolType;\n size: number | [number, number];\n clipRange: number;\n};\n\nexport type ISymbolGraphicAttribute = Partial<IGraphicAttribute> & Partial<ISymbolAttribute>;\n\nexport interface ISymbol extends IGraphic<ISymbolGraphicAttribute> {\n getParsedPath: () => ISymbolClass;\n}\n\nexport type SymbolType =\n | 'circle'\n | 'cross'\n | 'diamond'\n | 'square'\n | 'arrow'\n | 'arrowLeft'\n | 'arrowRight'\n | 'arrow2Left'\n | 'arrow2Right'\n | 'wedge'\n | 'thinTriangle'\n | 'triangle'\n | 'triangleUp'\n | 'triangleDown'\n | 'triangleRight'\n | 'triangleLeft'\n | 'stroke'\n | 'star'\n | 'wye'\n | 'rect'\n | 'rectRound'\n | 'roundLine'\n | string;\n\nexport interface ISymbolClass {\n type: SymbolType | string;\n path?: ICustomPath2D;\n pathStr: string;\n isSvg?: boolean;\n\n // 返回true表示内部已经调用closePath,返回false表示没有调用closePath,外部需要调用closePath\n draw: (\n ctx: IPath2D,\n size: number | [number, number],\n x: number,\n y: number,\n z?: number,\n cb?: (p: ICustomPath2D, a: any) => void\n ) => boolean;\n drawWithClipRange?: (\n ctx: IPath2D,\n size: number | [number, number],\n x: number,\n y: number,\n clipRange: number,\n z?: number,\n cb?: (p: ICustomPath2D, a: any) => void\n ) => boolean;\n drawOffset: (\n ctx: IPath2D,\n size: number | [number, number],\n x: number,\n y: number,\n offset: number,\n z?: number,\n cb?: (p: ICustomPath2D, a: any) => void\n ) => boolean;\n\n drawToSvgPath?: (size: number | [number, number], x: number, y: number, z?: number) => string;\n\n bounds: (size: number | [number, number], bounds: IBounds) => void;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { IAABBBounds, IMatrix, IPointLike, IPoint, BoundsAnchorType, IOBBBounds } from '@visactor/vutils';
2
- import type { IAnimate, IStep, EasingType, IAnimateTarget } from './animate';
2
+ import type { IAnimate, IStep, EasingType, IAnimateTarget, ITimeline } from './animate';
3
3
  import type { IColor } from './color';
4
4
  import type { IGroup } from './graphic/group';
5
5
  import type { IShadowRoot } from './graphic/shadow-root';
@@ -16,7 +16,7 @@ type IStrokeSeg = {
16
16
  end: number;
17
17
  length: number;
18
18
  };
19
- export type GraphicType = 'area' | 'circle' | 'ellipse' | 'line' | 'rect' | 'rect3d' | 'path' | 'richtext' | 'text' | 'arc' | 'arc3d' | 'image' | 'symbol' | 'group' | 'shadowroot' | 'polygon' | 'pyramid3d' | 'glyph';
19
+ export type GraphicType = 'area' | 'circle' | 'ellipse' | 'line' | 'rect' | 'rect3d' | 'path' | 'richtext' | 'text' | 'arc' | 'arc3d' | 'image' | 'symbol' | 'group' | 'shadowroot' | 'polygon' | 'pyramid3d' | 'glyph' | string;
20
20
  export type Cursor = 'auto' | 'default' | 'none' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'grab' | 'grabbing' | 'all-scroll' | 'col-resize' | 'row-resize' | 'n-resize' | 'e-resize' | 's-resize' | 'w-resize' | 'ne-resize' | 'nw-resize' | 'se-resize' | 'sw-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'zoom-in' | 'zoom-out';
21
21
  export type ITransform = {
22
22
  x: number;
@@ -120,6 +120,9 @@ export type IGraphicStyle = ILayout & IFillStyle & IStrokeStyle & IPickStyle & {
120
120
  backgroundFit: boolean;
121
121
  backgroundCornerRadius: number | number[];
122
122
  backgroundOpacity: number;
123
+ autoAnimateTexture: boolean;
124
+ textureRatio: number;
125
+ textureOptions: any;
123
126
  background: IBackgroundType | {
124
127
  background: IBackgroundType;
125
128
  dx?: number;
@@ -192,6 +195,7 @@ export type ISetAttributeContext = {
192
195
  export type IGraphicAnimateParams = {
193
196
  slience?: boolean;
194
197
  id?: number | string;
198
+ timeline?: ITimeline;
195
199
  onStart?: () => void;
196
200
  onFrame?: (step: IStep, ratio: number) => void;
197
201
  onEnd?: () => void;