@visactor/vrender-core 0.21.8 → 0.22.0-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 (342) 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/custom-animate.js +14 -25
  7. package/cjs/animate/custom-animate.js.map +1 -1
  8. package/cjs/animate/easing-func.d.ts +1 -0
  9. package/cjs/animate/easing-func.js +16 -0
  10. package/cjs/animate/easing-func.js.map +1 -0
  11. package/cjs/animate/easing.d.ts +4 -0
  12. package/cjs/animate/easing.js +24 -1
  13. package/cjs/animate/easing.js.map +1 -1
  14. package/cjs/animate/index.d.ts +1 -0
  15. package/cjs/animate/index.js +1 -1
  16. package/cjs/animate/index.js.map +1 -1
  17. package/cjs/color-string/store.js +1 -2
  18. package/cjs/common/3d-interceptor.js +2 -1
  19. package/cjs/common/bezier-utils.d.ts +3 -0
  20. package/cjs/common/bezier-utils.js +17 -2
  21. package/cjs/common/bezier-utils.js.map +1 -1
  22. package/cjs/common/custom-path2d.d.ts +4 -0
  23. package/cjs/common/custom-path2d.js +43 -11
  24. package/cjs/common/custom-path2d.js.map +1 -1
  25. package/cjs/common/render-area.js +0 -1
  26. package/cjs/common/render-command-list.js +2 -1
  27. package/cjs/common/segment/curve/arc.d.ts +4 -1
  28. package/cjs/common/segment/curve/arc.js +10 -1
  29. package/cjs/common/segment/curve/arc.js.map +1 -1
  30. package/cjs/common/segment/curve/base.d.ts +4 -1
  31. package/cjs/common/segment/curve/base.js.map +1 -1
  32. package/cjs/common/segment/curve/cubic-bezier.d.ts +5 -1
  33. package/cjs/common/segment/curve/cubic-bezier.js +24 -3
  34. package/cjs/common/segment/curve/cubic-bezier.js.map +1 -1
  35. package/cjs/common/segment/curve/curve-context.js +5 -4
  36. package/cjs/common/segment/curve/curve-context.js.map +1 -1
  37. package/cjs/common/segment/curve/ellipse.d.ts +4 -1
  38. package/cjs/common/segment/curve/ellipse.js +9 -0
  39. package/cjs/common/segment/curve/ellipse.js.map +1 -1
  40. package/cjs/common/segment/curve/line.d.ts +4 -1
  41. package/cjs/common/segment/curve/line.js +18 -0
  42. package/cjs/common/segment/curve/line.js.map +1 -1
  43. package/cjs/common/segment/curve/move.d.ts +4 -1
  44. package/cjs/common/segment/curve/move.js +9 -0
  45. package/cjs/common/segment/curve/move.js.map +1 -1
  46. package/cjs/common/segment/curve/path.d.ts +2 -1
  47. package/cjs/common/segment/curve/path.js +5 -2
  48. package/cjs/common/segment/curve/path.js.map +1 -1
  49. package/cjs/common/segment/curve/quadratic-bezier.d.ts +6 -2
  50. package/cjs/common/segment/curve/quadratic-bezier.js +23 -5
  51. package/cjs/common/segment/curve/quadratic-bezier.js.map +1 -1
  52. package/cjs/common/shape/rect.d.ts +1 -1
  53. package/cjs/common/shape/rect.js +30 -25
  54. package/cjs/common/shape/rect.js.map +1 -1
  55. package/cjs/common/store.js +1 -1
  56. package/cjs/core/contributions/env/base-contribution.d.ts +2 -0
  57. package/cjs/core/contributions/env/base-contribution.js +6 -0
  58. package/cjs/core/contributions/env/base-contribution.js.map +1 -1
  59. package/cjs/core/global.d.ts +2 -0
  60. package/cjs/core/global.js +6 -0
  61. package/cjs/core/global.js.map +1 -1
  62. package/cjs/graphic/builtin-symbol/rect.d.ts +2 -1
  63. package/cjs/graphic/builtin-symbol/rect.js +28 -0
  64. package/cjs/graphic/builtin-symbol/rect.js.map +1 -1
  65. package/cjs/graphic/builtin-symbol/utils.d.ts +2 -1
  66. package/cjs/graphic/builtin-symbol/utils.js +5 -0
  67. package/cjs/graphic/builtin-symbol/utils.js.map +1 -1
  68. package/cjs/graphic/config.js +19 -5
  69. package/cjs/graphic/config.js.map +1 -1
  70. package/cjs/graphic/graphic.js +15 -1
  71. package/cjs/graphic/graphic.js.map +1 -1
  72. package/cjs/graphic/richtext/line.js +1 -1
  73. package/cjs/graphic/richtext/line.js.map +1 -1
  74. package/cjs/graphic/richtext/paragraph.d.ts +1 -1
  75. package/cjs/graphic/richtext/paragraph.js +9 -4
  76. package/cjs/graphic/richtext/paragraph.js.map +1 -1
  77. package/cjs/graphic/richtext/utils.d.ts +4 -0
  78. package/cjs/graphic/richtext/utils.js +19 -6
  79. package/cjs/graphic/richtext/utils.js.map +1 -1
  80. package/cjs/graphic/richtext/wrapper.d.ts +1 -0
  81. package/cjs/graphic/richtext/wrapper.js +1 -1
  82. package/cjs/graphic/richtext/wrapper.js.map +1 -1
  83. package/cjs/graphic/richtext.d.ts +7 -2
  84. package/cjs/graphic/richtext.js +33 -3
  85. package/cjs/graphic/richtext.js.map +1 -1
  86. package/cjs/index.d.ts +2 -0
  87. package/cjs/index.js +2 -1
  88. package/cjs/index.js.map +1 -1
  89. package/cjs/interface/animate.d.ts +5 -39
  90. package/cjs/interface/animate.js.map +1 -1
  91. package/cjs/interface/context.d.ts +1 -0
  92. package/cjs/interface/context.js.map +1 -1
  93. package/cjs/interface/global.d.ts +4 -0
  94. package/cjs/interface/global.js.map +1 -1
  95. package/cjs/interface/graphic/group.d.ts +1 -0
  96. package/cjs/interface/graphic/group.js.map +1 -1
  97. package/cjs/interface/graphic/image.d.ts +1 -0
  98. package/cjs/interface/graphic/image.js.map +1 -1
  99. package/cjs/interface/graphic/path.d.ts +1 -0
  100. package/cjs/interface/graphic/path.js.map +1 -1
  101. package/cjs/interface/graphic/rect.d.ts +1 -0
  102. package/cjs/interface/graphic/rect.js.map +1 -1
  103. package/cjs/interface/graphic/richText.d.ts +2 -0
  104. package/cjs/interface/graphic/richText.js.map +1 -1
  105. package/cjs/interface/graphic/symbol.d.ts +2 -0
  106. package/cjs/interface/graphic/symbol.js.map +1 -1
  107. package/cjs/interface/graphic.d.ts +11 -2
  108. package/cjs/interface/graphic.js.map +1 -1
  109. package/cjs/interface/path.d.ts +5 -0
  110. package/cjs/interface/path.js.map +1 -1
  111. package/cjs/interface/picker.d.ts +13 -0
  112. package/cjs/interface/picker.js.map +1 -1
  113. package/cjs/picker/constants.d.ts +2 -0
  114. package/cjs/picker/constants.js +3 -2
  115. package/cjs/picker/constants.js.map +1 -1
  116. package/cjs/picker/pick-interceptor.d.ts +7 -2
  117. package/cjs/picker/pick-interceptor.js +19 -2
  118. package/cjs/picker/pick-interceptor.js.map +1 -1
  119. package/cjs/picker/pick-modules.js +7 -4
  120. package/cjs/picker/pick-modules.js.map +1 -1
  121. package/cjs/picker/picker-service.d.ts +4 -2
  122. package/cjs/picker/picker-service.js +13 -12
  123. package/cjs/picker/picker-service.js.map +1 -1
  124. package/cjs/plugins/builtin-plugin/edit-module.d.ts +15 -5
  125. package/cjs/plugins/builtin-plugin/edit-module.js +123 -42
  126. package/cjs/plugins/builtin-plugin/edit-module.js.map +1 -1
  127. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.d.ts +1 -0
  128. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.js +3 -0
  129. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.js.map +1 -0
  130. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.d.ts +62 -29
  131. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +346 -212
  132. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
  133. package/cjs/render/contributions/render/arc3d-render.js.map +1 -1
  134. package/cjs/render/contributions/render/base-render.d.ts +1 -0
  135. package/cjs/render/contributions/render/base-render.js +20 -2
  136. package/cjs/render/contributions/render/base-render.js.map +1 -1
  137. package/cjs/render/contributions/render/contributions/base-contribution-render.d.ts +7 -1
  138. package/cjs/render/contributions/render/contributions/base-contribution-render.js +16 -8
  139. package/cjs/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  140. package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js +29 -2
  141. package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js.map +1 -1
  142. package/cjs/render/contributions/render/contributions/group-contribution-render.js +8 -3
  143. package/cjs/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
  144. package/cjs/render/contributions/render/contributions/image-contribution-render.d.ts +1 -1
  145. package/cjs/render/contributions/render/contributions/image-contribution-render.js +2 -2
  146. package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
  147. package/cjs/render/contributions/render/contributions/rect-contribution-render.js +4 -4
  148. package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  149. package/cjs/render/contributions/render/contributions/symbol-contribution-render.d.ts +8 -1
  150. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js +30 -2
  151. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  152. package/cjs/render/contributions/render/contributions/text-contribution-render.js +5 -3
  153. package/cjs/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
  154. package/cjs/render/contributions/render/group-render.js +2 -2
  155. package/cjs/render/contributions/render/group-render.js.map +1 -1
  156. package/cjs/render/contributions/render/image-render.js +3 -3
  157. package/cjs/render/contributions/render/image-render.js.map +1 -1
  158. package/cjs/render/contributions/render/path-render.js.map +1 -1
  159. package/cjs/render/contributions/render/polygon-render.js.map +1 -1
  160. package/cjs/render/contributions/render/rect-render.js +2 -2
  161. package/cjs/render/contributions/render/rect-render.js.map +1 -1
  162. package/cjs/render/contributions/render/richtext-render.js +1 -1
  163. package/cjs/render/contributions/render/richtext-render.js.map +1 -1
  164. package/cjs/render/contributions/render/symbol-render.js +15 -13
  165. package/cjs/render/contributions/render/symbol-render.js.map +1 -1
  166. package/cjs/render/contributions/render/utils.d.ts +1 -2
  167. package/cjs/render/contributions/render/utils.js +4 -20
  168. package/cjs/render/contributions/render/utils.js.map +1 -1
  169. package/cjs/resource-loader/loader.js +1 -1
  170. package/cjs/resource-loader/loader.js.map +1 -1
  171. package/dist/index.es.js +8646 -7686
  172. package/es/animate/Ticker/default-ticker.d.ts +2 -0
  173. package/es/animate/Ticker/default-ticker.js +7 -1
  174. package/es/animate/Ticker/default-ticker.js.map +1 -1
  175. package/es/animate/animate.js +1 -1
  176. package/es/animate/animate.js.map +1 -1
  177. package/es/animate/custom-animate.js +14 -25
  178. package/es/animate/custom-animate.js.map +1 -1
  179. package/es/animate/easing-func.d.ts +1 -0
  180. package/es/animate/easing-func.js +10 -0
  181. package/es/animate/easing-func.js.map +1 -0
  182. package/es/animate/easing.d.ts +4 -0
  183. package/es/animate/easing.js +24 -1
  184. package/es/animate/easing.js.map +1 -1
  185. package/es/animate/index.d.ts +1 -0
  186. package/es/animate/index.js +2 -0
  187. package/es/animate/index.js.map +1 -1
  188. package/es/color-string/store.js +1 -2
  189. package/es/common/3d-interceptor.js +2 -1
  190. package/es/common/bezier-utils.d.ts +3 -0
  191. package/es/common/bezier-utils.js +14 -0
  192. package/es/common/bezier-utils.js.map +1 -1
  193. package/es/common/custom-path2d.d.ts +4 -0
  194. package/es/common/custom-path2d.js +44 -12
  195. package/es/common/custom-path2d.js.map +1 -1
  196. package/es/common/render-area.js +1 -2
  197. package/es/common/render-command-list.js +2 -1
  198. package/es/common/segment/curve/arc.d.ts +4 -1
  199. package/es/common/segment/curve/arc.js +10 -1
  200. package/es/common/segment/curve/arc.js.map +1 -1
  201. package/es/common/segment/curve/base.d.ts +4 -1
  202. package/es/common/segment/curve/base.js.map +1 -1
  203. package/es/common/segment/curve/cubic-bezier.d.ts +5 -1
  204. package/es/common/segment/curve/cubic-bezier.js +22 -1
  205. package/es/common/segment/curve/cubic-bezier.js.map +1 -1
  206. package/es/common/segment/curve/curve-context.js +6 -3
  207. package/es/common/segment/curve/curve-context.js.map +1 -1
  208. package/es/common/segment/curve/ellipse.d.ts +4 -1
  209. package/es/common/segment/curve/ellipse.js +9 -0
  210. package/es/common/segment/curve/ellipse.js.map +1 -1
  211. package/es/common/segment/curve/line.d.ts +4 -1
  212. package/es/common/segment/curve/line.js +18 -0
  213. package/es/common/segment/curve/line.js.map +1 -1
  214. package/es/common/segment/curve/move.d.ts +4 -1
  215. package/es/common/segment/curve/move.js +9 -0
  216. package/es/common/segment/curve/move.js.map +1 -1
  217. package/es/common/segment/curve/path.d.ts +2 -1
  218. package/es/common/segment/curve/path.js +5 -2
  219. package/es/common/segment/curve/path.js.map +1 -1
  220. package/es/common/segment/curve/quadratic-bezier.d.ts +6 -2
  221. package/es/common/segment/curve/quadratic-bezier.js +28 -5
  222. package/es/common/segment/curve/quadratic-bezier.js.map +1 -1
  223. package/es/common/shape/rect.d.ts +1 -1
  224. package/es/common/shape/rect.js +30 -25
  225. package/es/common/shape/rect.js.map +1 -1
  226. package/es/common/store.js +1 -1
  227. package/es/core/contributions/env/base-contribution.d.ts +2 -0
  228. package/es/core/contributions/env/base-contribution.js +6 -0
  229. package/es/core/contributions/env/base-contribution.js.map +1 -1
  230. package/es/core/global.d.ts +2 -0
  231. package/es/core/global.js +6 -0
  232. package/es/core/global.js.map +1 -1
  233. package/es/graphic/builtin-symbol/rect.d.ts +2 -1
  234. package/es/graphic/builtin-symbol/rect.js +28 -0
  235. package/es/graphic/builtin-symbol/rect.js.map +1 -1
  236. package/es/graphic/builtin-symbol/utils.d.ts +2 -1
  237. package/es/graphic/builtin-symbol/utils.js +5 -0
  238. package/es/graphic/builtin-symbol/utils.js.map +1 -1
  239. package/es/graphic/config.js +19 -5
  240. package/es/graphic/config.js.map +1 -1
  241. package/es/graphic/graphic.js +15 -1
  242. package/es/graphic/graphic.js.map +1 -1
  243. package/es/graphic/richtext/line.js +1 -1
  244. package/es/graphic/richtext/line.js.map +1 -1
  245. package/es/graphic/richtext/paragraph.d.ts +1 -1
  246. package/es/graphic/richtext/paragraph.js +9 -4
  247. package/es/graphic/richtext/paragraph.js.map +1 -1
  248. package/es/graphic/richtext/utils.d.ts +4 -0
  249. package/es/graphic/richtext/utils.js +15 -2
  250. package/es/graphic/richtext/utils.js.map +1 -1
  251. package/es/graphic/richtext/wrapper.d.ts +1 -0
  252. package/es/graphic/richtext/wrapper.js +1 -1
  253. package/es/graphic/richtext/wrapper.js.map +1 -1
  254. package/es/graphic/richtext.d.ts +7 -2
  255. package/es/graphic/richtext.js +33 -4
  256. package/es/graphic/richtext.js.map +1 -1
  257. package/es/index.d.ts +2 -0
  258. package/es/index.js +4 -0
  259. package/es/index.js.map +1 -1
  260. package/es/interface/animate.d.ts +5 -39
  261. package/es/interface/animate.js.map +1 -1
  262. package/es/interface/context.d.ts +1 -0
  263. package/es/interface/context.js.map +1 -1
  264. package/es/interface/global.d.ts +4 -0
  265. package/es/interface/global.js.map +1 -1
  266. package/es/interface/graphic/group.d.ts +1 -0
  267. package/es/interface/graphic/group.js.map +1 -1
  268. package/es/interface/graphic/image.d.ts +1 -0
  269. package/es/interface/graphic/image.js.map +1 -1
  270. package/es/interface/graphic/path.d.ts +1 -0
  271. package/es/interface/graphic/path.js.map +1 -1
  272. package/es/interface/graphic/rect.d.ts +1 -0
  273. package/es/interface/graphic/rect.js.map +1 -1
  274. package/es/interface/graphic/richText.d.ts +2 -0
  275. package/es/interface/graphic/richText.js.map +1 -1
  276. package/es/interface/graphic/symbol.d.ts +2 -0
  277. package/es/interface/graphic/symbol.js.map +1 -1
  278. package/es/interface/graphic.d.ts +11 -2
  279. package/es/interface/graphic.js.map +1 -1
  280. package/es/interface/path.d.ts +5 -0
  281. package/es/interface/path.js.map +1 -1
  282. package/es/interface/picker.d.ts +13 -0
  283. package/es/interface/picker.js.map +1 -1
  284. package/es/picker/constants.d.ts +2 -0
  285. package/es/picker/constants.js +4 -0
  286. package/es/picker/constants.js.map +1 -1
  287. package/es/picker/pick-interceptor.d.ts +7 -2
  288. package/es/picker/pick-interceptor.js +19 -1
  289. package/es/picker/pick-interceptor.js.map +1 -1
  290. package/es/picker/pick-modules.js +5 -3
  291. package/es/picker/pick-modules.js.map +1 -1
  292. package/es/picker/picker-service.d.ts +4 -2
  293. package/es/picker/picker-service.js +13 -13
  294. package/es/picker/picker-service.js.map +1 -1
  295. package/es/plugins/builtin-plugin/edit-module.d.ts +15 -5
  296. package/es/plugins/builtin-plugin/edit-module.js +119 -40
  297. package/es/plugins/builtin-plugin/edit-module.js.map +1 -1
  298. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.d.ts +1 -0
  299. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.js +3 -0
  300. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.js.map +1 -0
  301. package/es/plugins/builtin-plugin/richtext-edit-plugin.d.ts +62 -29
  302. package/es/plugins/builtin-plugin/richtext-edit-plugin.js +349 -211
  303. package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
  304. package/es/render/contributions/render/arc3d-render.js.map +1 -1
  305. package/es/render/contributions/render/base-render.d.ts +1 -0
  306. package/es/render/contributions/render/base-render.js +21 -2
  307. package/es/render/contributions/render/base-render.js.map +1 -1
  308. package/es/render/contributions/render/contributions/base-contribution-render.d.ts +7 -1
  309. package/es/render/contributions/render/contributions/base-contribution-render.js +16 -8
  310. package/es/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  311. package/es/render/contributions/render/contributions/base-texture-contribution-render.js +29 -2
  312. package/es/render/contributions/render/contributions/base-texture-contribution-render.js.map +1 -1
  313. package/es/render/contributions/render/contributions/group-contribution-render.js +8 -3
  314. package/es/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
  315. package/es/render/contributions/render/contributions/image-contribution-render.d.ts +1 -1
  316. package/es/render/contributions/render/contributions/image-contribution-render.js +2 -2
  317. package/es/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
  318. package/es/render/contributions/render/contributions/rect-contribution-render.js +4 -4
  319. package/es/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  320. package/es/render/contributions/render/contributions/symbol-contribution-render.d.ts +8 -1
  321. package/es/render/contributions/render/contributions/symbol-contribution-render.js +26 -0
  322. package/es/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  323. package/es/render/contributions/render/contributions/text-contribution-render.js +5 -3
  324. package/es/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
  325. package/es/render/contributions/render/group-render.js +2 -2
  326. package/es/render/contributions/render/group-render.js.map +1 -1
  327. package/es/render/contributions/render/image-render.js +3 -2
  328. package/es/render/contributions/render/image-render.js.map +1 -1
  329. package/es/render/contributions/render/path-render.js.map +1 -1
  330. package/es/render/contributions/render/polygon-render.js.map +1 -1
  331. package/es/render/contributions/render/rect-render.js +2 -2
  332. package/es/render/contributions/render/rect-render.js.map +1 -1
  333. package/es/render/contributions/render/richtext-render.js +1 -1
  334. package/es/render/contributions/render/richtext-render.js.map +1 -1
  335. package/es/render/contributions/render/symbol-render.js +16 -14
  336. package/es/render/contributions/render/symbol-render.js.map +1 -1
  337. package/es/render/contributions/render/utils.d.ts +1 -2
  338. package/es/render/contributions/render/utils.js +0 -18
  339. package/es/render/contributions/render/utils.js.map +1 -1
  340. package/es/resource-loader/loader.js +1 -1
  341. package/es/resource-loader/loader.js.map +1 -1
  342. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/interface/graphic/richText.ts"],"names":[],"mappings":"","file":"richText.js","sourcesContent":["import type { IColor } from '../color';\nimport type { IContext2d } from '../context';\nimport type { IGraphicAttribute, IGraphic } from '../graphic';\nimport type { IImage, IImageGraphicAttribute } from './image';\nimport type { ITextGraphicAttribute } from './text';\n\nexport type IRichTextAttribute = {\n width: number;\n height: number;\n editable: boolean;\n ellipsis: boolean | string;\n wordBreak: RichTextWordBreak;\n verticalDirection: RichTextVerticalDirection;\n maxHeight: number;\n maxWidth: number;\n textAlign: RichTextGlobalAlignType;\n textBaseline: RichTextGlobalBaselineType;\n layoutDirection: RichTextLayoutDirectionType;\n textConfig: IRichTextCharacter[];\n // 是否不自动每行截断\n disableAutoWrapLine: boolean;\n singleLine: boolean;\n};\n\nexport type IRichTextGraphicAttribute = Partial<IGraphicAttribute & ITextGraphicAttribute> &\n Partial<IRichTextAttribute>;\n\nexport type RichTextWordBreak = 'break-word' | 'break-all';\nexport type RichTextVerticalDirection = 'top' | 'middle' | 'bottom';\nexport type RichTextGlobalAlignType = 'left' | 'right' | 'center';\nexport type RichTextGlobalBaselineType = 'top' | 'middle' | 'bottom';\nexport type RichTextLayoutDirectionType = 'horizontal' | 'vertical';\nexport type RichTextFontStyle = 'normal' | 'italic' | 'oblique';\nexport type RichTextTextDecoration = 'none' | 'underline' | 'line-through';\n// export type RichTextTextAlign = 'left' | 'right' | 'center';\nexport type RichTextScript = 'normal' | 'sub' | 'super';\n\nexport type IRichTextBasicCharacter = {\n lineHeight?: number | string;\n textAlign?: CanvasTextAlign; // left, right, center\n textBaseline?: CanvasTextBaseline;\n direction?: RichTextLayoutDirectionType;\n};\n\nexport type IRichTextParagraphCharacter = IRichTextBasicCharacter & {\n text: string | number;\n fontSize?: number;\n fontFamily?: string;\n fill?: IColor | boolean;\n stroke?: IColor | boolean;\n fontWeight?: string;\n lineWidth?: number;\n // lineHeight?: number;\n fontStyle?: RichTextFontStyle; // normal, italic, oblique\n textDecoration?: RichTextTextDecoration; // none, underline, line-through\n // textAlign?: RichTextTextAlign; // left, right, center\n script?: RichTextScript; // normal, sub, super\n underline?: boolean;\n lineThrough?: boolean;\n opacity?: number;\n fillOpacity?: number;\n strokeOpacity?: number;\n // direction?: RichTextLayoutDirectionType;\n};\n\nexport type IRichTextImageCharacter = IRichTextBasicCharacter & {\n // 图片基础属性\n image: string | HTMLImageElement | HTMLCanvasElement;\n width: number;\n height: number;\n\n // hover相关属性\n // backgroundShow?: boolean; // 是否显示background\n backgroundShowMode?: 'always' | 'hover';\n backgroundFill?: boolean | IColor; // 背景矩形填充颜色\n backgroundFillOpacity?: number; // 背景矩形填充透明度\n backgroundStroke?: boolean | IColor; // 背景矩形边框颜色\n backgroundStrokeOpacity?: number; // 背景矩形边框透明度\n backgroundRadius?: number; // 背景矩形圆角\n // background size 同时控制了该icon的响应范围\n backgroundWidth?: number;\n backgroundHeight?: number;\n\n // 唯一标识符\n id?: string;\n\n // lineHeight?: number;\n // textAlign?: RichTextTextAlign; // left, right, center\n // direction?: RichTextLayoutDirectionType;\n margin?: number | number[];\n\n funcType?: string;\n hoverImage?: string | HTMLImageElement | HTMLCanvasElement;\n};\n\nexport type IRichTextCharacter = IRichTextParagraphCharacter | IRichTextImageCharacter;\n\nexport type IRichTextIconGraphicAttribute = IImageGraphicAttribute & {\n id?: string;\n backgroundShowMode?: 'always' | 'hover' | 'never';\n backgroundFill?: boolean | IColor; // 背景矩形填充颜色\n backgroundFillOpacity?: number; // 背景矩形填充透明度\n backgroundStroke?: boolean | IColor; // 背景矩形边框颜色\n backgroundStrokeOpacity?: number; // 背景矩形边框透明度\n backgroundRadius?: number; // 背景矩形圆角\n backgroundWidth?: number;\n backgroundHeight?: number;\n\n // lineHeight?: number;\n textAlign?: CanvasTextAlign; // left, right, center\n textBaseline?: CanvasTextBaseline;\n direction?: RichTextLayoutDirectionType;\n\n margin?: number | number[];\n\n // backgroundShow?: boolean;\n};\n\nexport interface IRichTextParagraph {\n text: string;\n ascent: number;\n descent: number;\n width: number;\n height: number;\n lineHeight: number;\n fontSize: number;\n length: number;\n newLine: boolean;\n character: IRichTextParagraphCharacter;\n left: number;\n top: number;\n direction?: 'horizontal' | 'vertical';\n widthOrigin?: number;\n heightOrigin?: number;\n textBaseline?: CanvasTextBaseline;\n ellipsis: 'normal' | 'add' | 'replace' | 'hide';\n ellipsisWidth: number;\n ellipsisOtherParagraphWidth: number;\n verticalEllipsis?: boolean;\n updateWidth: () => void;\n draw: (ctx: IContext2d, baseline: number, deltaLeft: number, isLineFirst: boolean, textAlign: string) => void;\n getWidthWithEllips: (direction: string) => number;\n}\n\nexport interface IRichTextLine {\n left: number;\n top: number;\n width: number;\n height: number;\n baseline: number;\n ascent: number;\n descent: number;\n paragraphs: (IRichTextParagraph | IRichTextIcon)[];\n actualWidth: number;\n blankWidth: number;\n textAlign: string;\n direction: 'horizontal' | 'vertical';\n directionKey: {\n width: string;\n height: string;\n left: string;\n x: string;\n y: string;\n };\n draw: (\n ctx: IContext2d,\n lastLine: boolean,\n x: number,\n y: number,\n drawEllipsis: boolean | string,\n drawIcon: (icon: IRichTextIcon, context: IContext2d, x: number, y: number, baseline: number) => void\n ) => void;\n getWidthWithEllips: (ellipsis: string) => number;\n}\n\nexport interface IRichTextFrame {\n left: number;\n top: number;\n bottom: number;\n right: number;\n width: number;\n height: number;\n actualHeight: number;\n ellipsis: boolean | string;\n wordBreak: 'break-word' | 'break-all';\n verticalDirection: 'top' | 'middle' | 'bottom';\n lines: IRichTextLine[];\n globalAlign: 'left' | 'center' | 'right' | 'start' | 'end';\n globalBaseline: 'top' | 'middle' | 'bottom';\n layoutDirection: 'horizontal' | 'vertical';\n directionKey: {\n width: string;\n height: string;\n left: string;\n top: string;\n bottom: string;\n };\n isWidthMax: boolean;\n isHeightMax: boolean;\n singleLine: boolean;\n icons: Map<string, IRichTextIcon>;\n draw: (\n ctx: IContext2d,\n drawIcon: (icon: IRichTextIcon, context: IContext2d, x: number, y: number, baseline: number) => void\n ) => boolean;\n getActualSize: () => {\n width: number;\n height: number;\n };\n getRawActualSize: () => {\n width: number;\n height: number;\n };\n getActualSizeWidthEllipsis: () => {\n width: number;\n height: number;\n };\n}\n\nexport interface IRichText extends IGraphic<IRichTextGraphicAttribute> {\n getFrameCache: () => IRichTextFrame;\n cliped?: boolean;\n}\n\nexport interface IRichTextIcon extends IImage {\n attribute: IRichTextIconGraphicAttribute;\n richtextId?: string;\n globalX?: number;\n globalY?: number;\n\n _x: number;\n _y: number;\n _hovered: boolean;\n _marginArray: [number, number, number, number];\n\n setHoverState: (hovered: boolean) => void;\n}\n"]}
1
+ {"version":3,"sources":["../src/interface/graphic/richText.ts"],"names":[],"mappings":"","file":"richText.js","sourcesContent":["import type { IColor } from '../color';\nimport type { IContext2d } from '../context';\nimport type { IGraphicAttribute, IGraphic } from '../graphic';\nimport type { IImage, IImageGraphicAttribute } from './image';\nimport type { ITextGraphicAttribute } from './text';\n\nexport type IRichTextAttribute = {\n width: number;\n height: number;\n editable: boolean;\n ellipsis: boolean | string;\n wordBreak: RichTextWordBreak;\n verticalDirection: RichTextVerticalDirection;\n maxHeight: number;\n maxWidth: number;\n textAlign: RichTextGlobalAlignType;\n textBaseline: RichTextGlobalBaselineType;\n layoutDirection: RichTextLayoutDirectionType;\n textConfig: IRichTextCharacter[];\n // 是否不自动每行截断\n disableAutoWrapLine: boolean;\n singleLine: boolean;\n};\n\nexport type IRichTextGraphicAttribute = Partial<IGraphicAttribute & ITextGraphicAttribute> &\n Partial<IRichTextAttribute>;\n\nexport type RichTextWordBreak = 'break-word' | 'break-all';\nexport type RichTextVerticalDirection = 'top' | 'middle' | 'bottom';\nexport type RichTextGlobalAlignType = 'left' | 'right' | 'center';\nexport type RichTextGlobalBaselineType = 'top' | 'middle' | 'bottom';\nexport type RichTextLayoutDirectionType = 'horizontal' | 'vertical';\nexport type RichTextFontStyle = 'normal' | 'italic' | 'oblique';\nexport type RichTextTextDecoration = 'none' | 'underline' | 'line-through';\n// export type RichTextTextAlign = 'left' | 'right' | 'center';\nexport type RichTextScript = 'normal' | 'sub' | 'super';\n\nexport type IRichTextBasicCharacter = {\n lineHeight?: number | string;\n textAlign?: CanvasTextAlign; // left, right, center\n textBaseline?: CanvasTextBaseline;\n direction?: RichTextLayoutDirectionType;\n};\n\nexport type IRichTextParagraphCharacter = IRichTextBasicCharacter & {\n text: string | number;\n fontSize?: number;\n fontFamily?: string;\n fill?: IColor | boolean;\n stroke?: IColor | boolean;\n fontWeight?: string;\n lineWidth?: number;\n // lineHeight?: number;\n fontStyle?: RichTextFontStyle; // normal, italic, oblique\n textDecoration?: RichTextTextDecoration; // none, underline, line-through\n // textAlign?: RichTextTextAlign; // left, right, center\n script?: RichTextScript; // normal, sub, super\n underline?: boolean;\n lineThrough?: boolean;\n opacity?: number;\n fillOpacity?: number;\n strokeOpacity?: number;\n // 仅支持纯色背景\n background?: string;\n // 背景透明度\n backgroundOpacity?: number;\n // direction?: RichTextLayoutDirectionType;\n};\n\nexport type IRichTextImageCharacter = IRichTextBasicCharacter & {\n // 图片基础属性\n image: string | HTMLImageElement | HTMLCanvasElement;\n width: number;\n height: number;\n\n // hover相关属性\n // backgroundShow?: boolean; // 是否显示background\n backgroundShowMode?: 'always' | 'hover';\n backgroundFill?: boolean | IColor; // 背景矩形填充颜色\n backgroundFillOpacity?: number; // 背景矩形填充透明度\n backgroundStroke?: boolean | IColor; // 背景矩形边框颜色\n backgroundStrokeOpacity?: number; // 背景矩形边框透明度\n backgroundRadius?: number; // 背景矩形圆角\n // background size 同时控制了该icon的响应范围\n backgroundWidth?: number;\n backgroundHeight?: number;\n\n // 唯一标识符\n id?: string;\n\n // lineHeight?: number;\n // textAlign?: RichTextTextAlign; // left, right, center\n // direction?: RichTextLayoutDirectionType;\n margin?: number | number[];\n\n funcType?: string;\n hoverImage?: string | HTMLImageElement | HTMLCanvasElement;\n};\n\nexport type IRichTextCharacter = IRichTextParagraphCharacter | IRichTextImageCharacter;\n\nexport type IRichTextIconGraphicAttribute = IImageGraphicAttribute & {\n id?: string;\n backgroundShowMode?: 'always' | 'hover' | 'never';\n backgroundFill?: boolean | IColor; // 背景矩形填充颜色\n backgroundFillOpacity?: number; // 背景矩形填充透明度\n backgroundStroke?: boolean | IColor; // 背景矩形边框颜色\n backgroundStrokeOpacity?: number; // 背景矩形边框透明度\n backgroundRadius?: number; // 背景矩形圆角\n backgroundWidth?: number;\n backgroundHeight?: number;\n\n // lineHeight?: number;\n textAlign?: CanvasTextAlign; // left, right, center\n textBaseline?: CanvasTextBaseline;\n direction?: RichTextLayoutDirectionType;\n\n margin?: number | number[];\n\n // backgroundShow?: boolean;\n};\n\nexport interface IRichTextParagraph {\n text: string;\n ascent: number;\n descent: number;\n width: number;\n height: number;\n lineHeight: number;\n fontSize: number;\n length: number;\n newLine: boolean;\n character: IRichTextParagraphCharacter;\n left: number;\n top: number;\n direction?: 'horizontal' | 'vertical';\n widthOrigin?: number;\n heightOrigin?: number;\n textBaseline?: CanvasTextBaseline;\n ellipsis: 'normal' | 'add' | 'replace' | 'hide';\n ellipsisWidth: number;\n ellipsisOtherParagraphWidth: number;\n verticalEllipsis?: boolean;\n updateWidth: () => void;\n draw: (ctx: IContext2d, baseline: number, deltaLeft: number, isLineFirst: boolean, textAlign: string) => void;\n getWidthWithEllips: (direction: string) => number;\n}\n\nexport interface IRichTextLine {\n left: number;\n top: number;\n width: number;\n height: number;\n baseline: number;\n ascent: number;\n descent: number;\n paragraphs: (IRichTextParagraph | IRichTextIcon)[];\n actualWidth: number;\n blankWidth: number;\n textAlign: string;\n direction: 'horizontal' | 'vertical';\n directionKey: {\n width: string;\n height: string;\n left: string;\n x: string;\n y: string;\n };\n draw: (\n ctx: IContext2d,\n lastLine: boolean,\n x: number,\n y: number,\n drawEllipsis: boolean | string,\n drawIcon: (icon: IRichTextIcon, context: IContext2d, x: number, y: number, baseline: number) => void\n ) => void;\n getWidthWithEllips: (ellipsis: string) => number;\n}\n\nexport interface IRichTextFrame {\n left: number;\n top: number;\n bottom: number;\n right: number;\n width: number;\n height: number;\n actualHeight: number;\n ellipsis: boolean | string;\n wordBreak: 'break-word' | 'break-all';\n verticalDirection: 'top' | 'middle' | 'bottom';\n lines: IRichTextLine[];\n globalAlign: 'left' | 'center' | 'right' | 'start' | 'end';\n globalBaseline: 'top' | 'middle' | 'bottom';\n layoutDirection: 'horizontal' | 'vertical';\n directionKey: {\n width: string;\n height: string;\n left: string;\n top: string;\n bottom: string;\n };\n isWidthMax: boolean;\n isHeightMax: boolean;\n singleLine: boolean;\n icons: Map<string, IRichTextIcon>;\n draw: (\n ctx: IContext2d,\n drawIcon: (icon: IRichTextIcon, context: IContext2d, x: number, y: number, baseline: number) => void\n ) => boolean;\n getActualSize: () => {\n width: number;\n height: number;\n };\n getRawActualSize: () => {\n width: number;\n height: number;\n };\n getActualSizeWidthEllipsis: () => {\n width: number;\n height: number;\n };\n}\n\nexport interface IRichText extends IGraphic<IRichTextGraphicAttribute> {\n getFrameCache: () => IRichTextFrame;\n cliped?: boolean;\n}\n\nexport interface IRichTextIcon extends IImage {\n attribute: IRichTextIconGraphicAttribute;\n richtextId?: string;\n globalX?: number;\n globalY?: number;\n\n _x: number;\n _y: number;\n _hovered: boolean;\n _marginArray: [number, number, number, number];\n\n setHoverState: (hovered: boolean) => void;\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;
@@ -119,8 +119,15 @@ export type IGraphicStyle = ILayout & IFillStyle & IStrokeStyle & IPickStyle & {
119
119
  shadowGraphic?: IGraphic | undefined;
120
120
  backgroundMode: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat';
121
121
  backgroundFit: boolean;
122
+ backgroundScale: number;
123
+ backgroundOffsetX: number;
124
+ backgroundOffsetY: number;
125
+ backgroundClip: boolean;
122
126
  backgroundCornerRadius: number | number[];
123
127
  backgroundOpacity: number;
128
+ autoAnimateTexture: boolean;
129
+ textureRatio: number;
130
+ textureOptions: any;
124
131
  background: IBackgroundType | {
125
132
  background: IBackgroundType;
126
133
  dx?: number;
@@ -135,6 +142,7 @@ export type IGraphicStyle = ILayout & IFillStyle & IStrokeStyle & IPickStyle & {
135
142
  textureSize: number;
136
143
  texturePadding: number;
137
144
  blur: number;
145
+ filter: string;
138
146
  cursor: Cursor | null;
139
147
  renderStyle?: 'default' | 'rough' | any;
140
148
  html: ({
@@ -193,6 +201,7 @@ export type ISetAttributeContext = {
193
201
  export type IGraphicAnimateParams = {
194
202
  slience?: boolean;
195
203
  id?: number | string;
204
+ timeline?: ITimeline;
196
205
  onStart?: () => void;
197
206
  onFrame?: (step: IStep, ratio: number) => void;
198
207
  onEnd?: () => void;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/interface/graphic.ts"],"names":[],"mappings":"","file":"graphic.js","sourcesContent":["import type { IAABBBounds, IMatrix, IPointLike, IPoint, BoundsAnchorType, IOBBBounds } from '@visactor/vutils';\nimport type { IAnimate, IStep, EasingType, IAnimateTarget } from './animate';\nimport type { IColor } from './color';\nimport type { IGroup } from './graphic/group';\nimport type { IShadowRoot } from './graphic/shadow-root';\nimport type { ILayer } from './layer';\nimport type { INode } from './node-tree';\nimport type { ICustomPath2D } from './path';\nimport type { IStage } from './stage';\nimport type { IGlyphGraphicAttribute } from './graphic/glyph';\nimport type { IContainPointMode } from '../common/enums';\nimport type { IFace3d } from './graphic/face3d';\nimport type { IPickerService } from './picker';\n\ntype IStrokeSeg = {\n start: number; // 百分比\n // end和length二选一\n end: number; // 百分比\n length: number; // 像素长度\n};\n\n// TODO 最后加一个any\nexport type GraphicType =\n | 'area'\n | 'circle'\n | 'ellipse'\n | 'line'\n | 'rect'\n | 'rect3d'\n | 'path'\n | 'richtext'\n | 'text'\n | 'arc'\n | 'arc3d'\n | 'image'\n | 'symbol'\n | 'group'\n | 'shadowroot'\n | 'polygon'\n | 'pyramid3d'\n | 'glyph';\n\n// Cursor style\n// See: https://developer.mozilla.org/en-US/docs/Web/CSS/cursor\nexport type Cursor =\n | 'auto'\n | 'default'\n | 'none'\n | 'context-menu'\n | 'help'\n | 'pointer'\n | 'progress'\n | 'wait'\n | 'cell'\n | 'crosshair'\n | 'text'\n | 'vertical-text'\n | 'alias'\n | 'copy'\n | 'move'\n | 'no-drop'\n | 'not-allowed'\n | 'grab'\n | 'grabbing'\n | 'all-scroll'\n | 'col-resize'\n | 'row-resize'\n | 'n-resize'\n | 'e-resize'\n | 's-resize'\n | 'w-resize'\n | 'ne-resize'\n | 'nw-resize'\n | 'se-resize'\n | 'sw-resize'\n | 'ew-resize'\n | 'ns-resize'\n | 'nesw-resize'\n | 'nwse-resize'\n | 'zoom-in'\n | 'zoom-out';\n\nexport type ITransform = {\n x: number;\n y: number;\n z: number;\n dx: number;\n dy: number;\n dz: number;\n scrollX: number;\n scrollY: number;\n scaleX: number;\n scaleY: number;\n scaleZ: number;\n angle: number;\n alpha: number;\n beta: number;\n scaleCenter: [number | string, number | string];\n anchor: [number | string, number | string]; // 基于AABB的锚点位置,用于简单的定位某些path\n anchor3d: [number | string, number | string, number] | [number | string, number | string]; // 3d的锚点位置\n postMatrix: IMatrix;\n};\n\nexport type IFillType = boolean | string | IColor;\nexport type IFillStyle = {\n fillOpacity: number;\n shadowBlur: number;\n shadowColor: string;\n shadowOffsetX: number;\n shadowOffsetY: number;\n fill: IFillType;\n};\n\nexport type ILayout = {\n alignSelf: 'auto' | 'flex-start' | 'flex-end' | 'center';\n};\n\nexport type IBorderStyle = Omit<IStrokeStyle, 'outerBorder' | 'innerBorder'> & {\n distance: number | string;\n visible?: boolean;\n};\n\nexport type IStrokeType = boolean | string | IColor | null;\nexport type IStrokeStyle = {\n outerBorder: Partial<IBorderStyle>;\n innerBorder: Partial<IBorderStyle>;\n strokeOpacity: number;\n lineDash: number[];\n lineDashOffset: number;\n lineWidth: number;\n lineCap: CanvasLineCap;\n lineJoin: CanvasLineJoin;\n miterLimit: number;\n // 描边的boundsBuffer,用于控制bounds的buffer\n strokeBoundsBuffer: number;\n /**\n * stroke - true 全描边\n * stroke - false 不描边\n * stroke 为数值类型,适用于rect\\arc等图形,用于配置部分描边的场景,其中\n *\n * 0b00000 - 不描边\n * 0b000001 - top\n * 0b000010 - right\n * 0b000100 - bottom\n * 0b001000 - left\n * 相应的:\n * 0b000011 - top + right\n * 0b000111 - top + right + bottom\n * 0b001111 - 全描边\n *\n * stroke - boolean[],适用于rect\\arc等图形,用于配置部分描边的场景\n */\n stroke: IStrokeType[] | IStrokeType;\n};\n\ntype TextureType = 'circle' | 'diamond' | 'rect' | 'vertical-line' | 'horizontal-line' | 'bias-lr' | 'bias-rl' | 'grid';\n\nexport type IConnectedStyle = {\n // 连接,取零或者断开\n connectedType: 'connect' | 'zero' | 'none';\n connectedStyle: {\n stroke: IStrokeStyle['stroke'];\n strokeOpacity: IStrokeStyle['strokeOpacity'];\n lineDash: IStrokeStyle['lineDash'];\n lineDashOffset: IStrokeStyle['lineDashOffset'];\n lineCap: IStrokeStyle['lineCap'];\n lineJoin: IStrokeStyle['lineJoin'];\n lineWidth: IStrokeStyle['lineWidth'];\n fill: IFillStyle['fill'];\n fillOpacity: IFillStyle['fillOpacity'];\n };\n connectedX: number;\n connectedY: number;\n};\n\nexport type IBackgroundConfig = {\n stroke?: string | boolean;\n fill?: string | boolean;\n lineWidth?: number;\n cornerRadius?: number;\n expandX?: number;\n expandY?: number;\n};\n\ntype IBackgroundType = string | HTMLImageElement | HTMLCanvasElement | IBackgroundConfig;\n\nexport interface SimpleDomStyleOptions {\n width: number; // 容器的宽度\n height: number; // 容器的高度\n style?:\n | string\n | Record<string, any>\n | ((\n pos: { top: number; left: number; width: number; height: number },\n graphic: IGraphic,\n wrapContainer: HTMLElement\n ) => Record<string, any>); // 容器的样式\n}\n\nexport interface CommonDomOptions {\n id?: string;\n container: string | HTMLElement | null; // id或者dom\n visible?: boolean;\n pointerEvents?: boolean | string;\n // 可穿透的事件列表\n // @since 0.21.2\n penetrateEventList?: string[];\n anchorType?: 'position' | 'boundsLeftTop' | BoundsAnchorType;\n}\n\nexport type IGraphicStyle = ILayout &\n IFillStyle &\n IStrokeStyle &\n IPickStyle & {\n forceBoundsWidth: number | (() => number) | undefined;\n forceBoundsHeight: number | (() => number) | undefined;\n opacity: number;\n shadowGraphic?: IGraphic | undefined;\n backgroundMode: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat'; // 填充模式(与具体图元有关)\n backgroundFit: boolean; // 是否正好填充,只在repeat-x或者repeat-y以及no-repeat的时候生效\n backgroundCornerRadius: number | number[];\n backgroundOpacity: number;\n background:\n | IBackgroundType\n | {\n background: IBackgroundType;\n dx?: number;\n dy?: number;\n width?: number;\n height?: number;\n x?: number;\n y?: number;\n }\n | null; // 背景,可以与fill同时存在\n texture: TextureType | string; // 纹理\n textureColor: string; // 纹理颜色\n textureSize: number; // 纹理大小\n texturePadding: number; // 纹理间隙\n blur: number;\n cursor: Cursor | null; // 鼠标样式\n renderStyle?: 'default' | 'rough' | any;\n // HTML的dom或者string\n html:\n | ({\n dom: string | HTMLElement; // dom字符串或者dom\n } & SimpleDomStyleOptions &\n CommonDomOptions)\n | null;\n react:\n | ({\n element: any; // react场景节点\n } & SimpleDomStyleOptions &\n CommonDomOptions)\n | null;\n };\n\nexport type IPickStyle = {\n // 给stroke模式的pick额外加的buffer,用于外界控制stroke区域的pick范围\n pickStrokeBuffer: number;\n};\n\nexport type IDebugType = {\n _debug_bounds: boolean | ((c: any, g: any) => void);\n};\nexport type IGraphicAttribute = IDebugType &\n IGraphicStyle &\n ITransform & {\n /**\n * stroke百分比\n */\n strokeSeg: IStrokeSeg | null;\n // 包围盒的padding\n boundsPadding: number | number[];\n /**\n * 选择模式,精确模式,粗糙模式(包围盒模式),自定义模式\n */\n pickMode: 'accurate' | 'imprecise' | 'custom';\n boundsMode: 'accurate' | 'imprecise';\n customPickShape: () => boolean | null;\n /**\n * 是否支持事件拾取,默认为 true。\n * @default true\n */\n pickable: boolean;\n /**\n * 是否支持fill拾取,默认为 true。\n * @experimental\n * @default true\n */\n fillPickable: boolean;\n /**\n * 是否支持stroke拾取,默认为 true。\n * @experimental\n * @default true\n */\n strokePickable: boolean;\n /**\n * 对于 group 节点,是否支持其子元素的事件拾取,默认为 true。\n * 如果 group `pickable` 关闭,`childrenPickable` 开启,那么 group 的子节点仍参与事件拾取\n * @default true\n */\n childrenPickable: boolean;\n /**\n * 元素是否可见。\n * @default true\n */\n visible: boolean;\n zIndex: number;\n layout: any;\n /**\n * 是否隐藏元素(只是绘制的时候不绘制)\n */\n renderable: boolean;\n /**\n * 是否在3d中控制方向\n * false: 不控制方向\n * true: 始终控制方向朝摄像机\n */\n keepDirIn3d?: boolean;\n shadowRootIdx: number;\n shadowPickMode?: 'full' | 'graphic';\n globalZIndex: number;\n globalCompositeOperation: CanvasRenderingContext2D['globalCompositeOperation'] | '';\n // 完全支持滚动 | 完全不支持滚动 | 支持x方向的滚动 | 支持y方向的滚动\n overflow: 'scroll' | 'hidden' | 'scroll-x' | 'scroll-y';\n // 绘制fill和stroke的顺序,为0表示fill先绘制,1表示stroke先绘制\n fillStrokeOrder: number;\n // @since 0.20.15\n // 保持stroke的scale,默认为false,为true的话stroke显示的宽度会随着scale变化\n keepStrokeScale: boolean;\n };\n\nexport interface IGraphicJson<T extends Partial<IGraphicAttribute> = Partial<IGraphicAttribute>> {\n attribute: Partial<T>;\n _uid: number;\n type: string;\n name: string;\n children: IGraphicJson<T>[];\n}\n\n/** the context of setAttribute */\nexport type ISetAttributeContext = {\n /** type of setAttribute */\n type?: number;\n animationState?: {\n step?: IStep;\n isFirstFrameOfStep?: boolean;\n /** ratio of animation */\n ratio?: number;\n /** is animation end? */\n end?: boolean;\n };\n skipUpdateCallback?: boolean;\n};\n\nexport type IGraphicAnimateParams = {\n slience?: boolean;\n id?: number | string;\n onStart?: () => void;\n onFrame?: (step: IStep, ratio: number) => void;\n onEnd?: () => void;\n onRemove?: () => void;\n interpolate?: (key: string, ratio: number, from: any, to: any, nextAttributes: any) => boolean;\n};\n\nexport interface IGraphic<T extends Partial<IGraphicAttribute> = Partial<IGraphicAttribute>>\n extends INode,\n IAnimateTarget {\n type?: GraphicType;\n numberType?: number;\n stage?: IStage;\n layer?: ILayer;\n shadowRoot?: IShadowRoot;\n glyphHost?: IGraphic<IGlyphGraphicAttribute>;\n backgroundImg?: boolean;\n attachedThemeGraphic?: IGraphic<any>;\n\n bindDom?: Map<\n string | HTMLElement,\n { container: HTMLElement | string; dom: HTMLElement | any; wrapGroup: HTMLDivElement | any; root?: any }\n >;\n\n valid: boolean;\n parent: IGroup | null;\n isContainer?: boolean;\n // 是否是3d模式(是否应用3d视角)\n in3dMode?: boolean;\n\n // 上次更新的stamp\n stamp?: number;\n animationBackUps?: {\n from: Record<string, any>;\n to: Record<string, any>;\n };\n\n attribute: Partial<T>;\n\n /** 用于实现morph动画场景,转换成bezier曲线渲染 */\n pathProxy?: ICustomPath2D | ((attrs: T) => ICustomPath2D);\n incremental?: number;\n incrementalAt?: number;\n\n /** 记录state对应的图形属性 */\n states?: Record<string, Partial<T>>;\n normalAttrs?: Partial<T>;\n stateProxy?: (stateName: string, targetStates?: string[]) => Partial<T>;\n findFace?: () => IFace3d;\n toggleState: (stateName: string, hasAnimation?: boolean) => void;\n removeState: (stateName: string, hasAnimation?: boolean) => void;\n clearStates: (hasAnimation?: boolean) => void;\n useStates: (states: string[], hasAnimation?: boolean) => void;\n addState: (stateName: string, keepCurrentStates?: boolean, hasAnimation?: boolean) => void;\n hasState: (stateName?: string) => boolean;\n getState: (stateName: string) => Partial<T>;\n onBeforeAttributeUpdate?: (\n val: any,\n attributes: Partial<T>,\n key: null | string | string[],\n context?: ISetAttributeContext\n ) => T | undefined;\n applyStateAttrs: (attrs: Partial<T>, stateNames: string[], hasAnimation?: boolean, isClear?: boolean) => void;\n updateNormalAttrs: (stateAttrs: Partial<T>) => void;\n\n // get\n readonly AABBBounds: IAABBBounds; // 用于获取当前节点的AABB包围盒\n readonly OBBBounds: IOBBBounds; // 获取OBB包围盒,旋转防重叠需要用\n readonly globalAABBBounds: IAABBBounds; // 全局AABB包围盒\n readonly transMatrix: IMatrix; // 变换矩阵,动态计算\n readonly globalTransMatrix: IMatrix; // 变换矩阵,动态计算\n\n getOffsetXY: (attr?: ITransform) => IPoint;\n\n // function\n containsPoint: (x: number, y: number, mode?: IContainPointMode, picker?: IPickerService) => boolean;\n\n setMode: (mode: '3d' | '2d') => void;\n isValid: () => boolean;\n\n // TODO: transform API\n // 基于当前transform的变换,普通用户尽量别用,拿捏不住的~\n translate: (x: number, y: number) => this;\n translateTo: (x: number, y: number) => this;\n scale: (scaleX: number, scaleY: number, scaleCenter?: IPointLike) => this;\n scaleTo: (scaleX: number, scaleY: number) => this;\n rotate: (angle: number, rotateCenter?: IPointLike) => this;\n rotateTo: (angle: number) => this;\n skewTo: (b: number, c: number) => this;\n addUpdateBoundTag: () => void;\n addUpdateShapeAndBoundsTag: () => void;\n addUpdateLayoutTag: () => void;\n\n update: (d?: { bounds: boolean; trans: boolean }) => void;\n\n // animate\n animate: (params?: IGraphicAnimateParams) => IAnimate;\n\n // 语法糖,可有可无,有的为了首屏性能考虑做成get方法,有的由外界直接托管,内部不赋值\n name?: string;\n\n // 供render处理shape缓存tag\n shouldUpdateShape: () => boolean;\n clearUpdateShapeTag: () => void;\n\n // // 供render缓存shape\n // cacheShape?: ICustomPath2D;\n // // 线段使用的path2D\n // cacheLine?: ISegPath2D | ISegPath2D[];\n // // 面积图使用的path2D\n // cacheArea?: IAreaCacheItem | IAreaCacheItem[];\n\n setAttributes: (params: Partial<T>, forceUpdateTag?: boolean, context?: ISetAttributeContext) => void;\n\n initAttributes: (params: Partial<T>) => void;\n\n setAttribute: (key: string, value: any, forceUpdateTag?: boolean, context?: ISetAttributeContext) => void;\n\n setStage: (stage?: IStage, layer?: ILayer) => void;\n onSetStage: (cb: (g: IGraphic, stage: IStage) => void) => void;\n\n shouldUpdateAABBBounds: () => boolean;\n shouldSelfChangeUpdateAABBBounds: () => boolean;\n shouldUpdateGlobalMatrix: () => boolean;\n\n addUpdatePositionTag: () => void;\n addUpdateGlobalPositionTag: () => void;\n\n attachShadow: () => IShadowRoot;\n detachShadow: () => void;\n\n toJson: () => IGraphicJson;\n\n /** 创建pathProxy */\n createPathProxy: (path?: string) => void;\n /** 将图形转换成CustomPath2D */\n toCustomPath?: () => ICustomPath2D;\n\n resources?: Map<\n string | HTMLImageElement | HTMLCanvasElement | IBackgroundConfig,\n { state: 'init' | 'loading' | 'success' | 'fail'; data?: HTMLImageElement | HTMLCanvasElement }\n >;\n imageLoadSuccess: (url: string, data: HTMLImageElement) => void;\n imageLoadFail: (url: string) => void;\n\n clone: () => IGraphic;\n stopAnimates: (stopChildren?: boolean) => void;\n getNoWorkAnimateAttr: () => Record<string, number>;\n getGraphicTheme: () => T;\n}\n\nexport interface IRoot extends IGraphic {\n pick: (x: number, y: number) => IGraphic;\n}\n\n/**\n * 动画配置\n */\nexport type IAnimateConfig = {\n duration?: number;\n easing?: EasingType;\n};\n\nexport type GraphicReleaseStatus = 'released' | 'willRelease';\n"]}
1
+ {"version":3,"sources":["../src/interface/graphic.ts"],"names":[],"mappings":"","file":"graphic.js","sourcesContent":["import type { IAABBBounds, IMatrix, IPointLike, IPoint, BoundsAnchorType, IOBBBounds } from '@visactor/vutils';\nimport type { IAnimate, IStep, EasingType, IAnimateTarget, ITimeline } from './animate';\nimport type { IColor } from './color';\nimport type { IGroup } from './graphic/group';\nimport type { IShadowRoot } from './graphic/shadow-root';\nimport type { ILayer } from './layer';\nimport type { INode } from './node-tree';\nimport type { ICustomPath2D } from './path';\nimport type { IStage } from './stage';\nimport type { IGlyphGraphicAttribute } from './graphic/glyph';\nimport type { IContainPointMode } from '../common/enums';\nimport type { IFace3d } from './graphic/face3d';\nimport type { IPickerService } from './picker';\n\ntype IStrokeSeg = {\n start: number; // 百分比\n // end和length二选一\n end: number; // 百分比\n length: number; // 像素长度\n};\n\n// TODO 最后加一个any\nexport type GraphicType =\n | 'area'\n | 'circle'\n | 'ellipse'\n | 'line'\n | 'rect'\n | 'rect3d'\n | 'path'\n | 'richtext'\n | 'text'\n | 'arc'\n | 'arc3d'\n | 'image'\n | 'symbol'\n | 'group'\n | 'shadowroot'\n | 'polygon'\n | 'pyramid3d'\n | 'glyph'\n | string;\n\n// Cursor style\n// See: https://developer.mozilla.org/en-US/docs/Web/CSS/cursor\nexport type Cursor =\n | 'auto'\n | 'default'\n | 'none'\n | 'context-menu'\n | 'help'\n | 'pointer'\n | 'progress'\n | 'wait'\n | 'cell'\n | 'crosshair'\n | 'text'\n | 'vertical-text'\n | 'alias'\n | 'copy'\n | 'move'\n | 'no-drop'\n | 'not-allowed'\n | 'grab'\n | 'grabbing'\n | 'all-scroll'\n | 'col-resize'\n | 'row-resize'\n | 'n-resize'\n | 'e-resize'\n | 's-resize'\n | 'w-resize'\n | 'ne-resize'\n | 'nw-resize'\n | 'se-resize'\n | 'sw-resize'\n | 'ew-resize'\n | 'ns-resize'\n | 'nesw-resize'\n | 'nwse-resize'\n | 'zoom-in'\n | 'zoom-out';\n\nexport type ITransform = {\n x: number;\n y: number;\n z: number;\n dx: number;\n dy: number;\n dz: number;\n scrollX: number;\n scrollY: number;\n scaleX: number;\n scaleY: number;\n scaleZ: number;\n angle: number;\n alpha: number;\n beta: number;\n scaleCenter: [number | string, number | string];\n anchor: [number | string, number | string]; // 基于AABB的锚点位置,用于简单的定位某些path\n anchor3d: [number | string, number | string, number] | [number | string, number | string]; // 3d的锚点位置\n postMatrix: IMatrix;\n};\n\nexport type IFillType = boolean | string | IColor;\nexport type IFillStyle = {\n fillOpacity: number;\n shadowBlur: number;\n shadowColor: string;\n shadowOffsetX: number;\n shadowOffsetY: number;\n fill: IFillType;\n};\n\nexport type ILayout = {\n alignSelf: 'auto' | 'flex-start' | 'flex-end' | 'center';\n};\n\nexport type IBorderStyle = Omit<IStrokeStyle, 'outerBorder' | 'innerBorder'> & {\n distance: number | string;\n visible?: boolean;\n};\n\nexport type IStrokeType = boolean | string | IColor | null;\nexport type IStrokeStyle = {\n outerBorder: Partial<IBorderStyle>;\n innerBorder: Partial<IBorderStyle>;\n strokeOpacity: number;\n lineDash: number[];\n lineDashOffset: number;\n lineWidth: number;\n lineCap: CanvasLineCap;\n lineJoin: CanvasLineJoin;\n miterLimit: number;\n // 描边的boundsBuffer,用于控制bounds的buffer\n strokeBoundsBuffer: number;\n /**\n * stroke - true 全描边\n * stroke - false 不描边\n * stroke 为数值类型,适用于rect\\arc等图形,用于配置部分描边的场景,其中\n *\n * 0b00000 - 不描边\n * 0b000001 - top\n * 0b000010 - right\n * 0b000100 - bottom\n * 0b001000 - left\n * 相应的:\n * 0b000011 - top + right\n * 0b000111 - top + right + bottom\n * 0b001111 - 全描边\n *\n * stroke - boolean[],适用于rect\\arc等图形,用于配置部分描边的场景\n */\n stroke: IStrokeType[] | IStrokeType;\n};\n\ntype TextureType = 'circle' | 'diamond' | 'rect' | 'vertical-line' | 'horizontal-line' | 'bias-lr' | 'bias-rl' | 'grid';\n\nexport type IConnectedStyle = {\n // 连接,取零或者断开\n connectedType: 'connect' | 'zero' | 'none';\n connectedStyle: {\n stroke: IStrokeStyle['stroke'];\n strokeOpacity: IStrokeStyle['strokeOpacity'];\n lineDash: IStrokeStyle['lineDash'];\n lineDashOffset: IStrokeStyle['lineDashOffset'];\n lineCap: IStrokeStyle['lineCap'];\n lineJoin: IStrokeStyle['lineJoin'];\n lineWidth: IStrokeStyle['lineWidth'];\n fill: IFillStyle['fill'];\n fillOpacity: IFillStyle['fillOpacity'];\n };\n connectedX: number;\n connectedY: number;\n};\n\nexport type IBackgroundConfig = {\n stroke?: string | boolean;\n fill?: string | boolean;\n lineWidth?: number;\n cornerRadius?: number;\n expandX?: number;\n expandY?: number;\n};\n\ntype IBackgroundType = string | HTMLImageElement | HTMLCanvasElement | IBackgroundConfig;\n\nexport interface SimpleDomStyleOptions {\n width: number; // 容器的宽度\n height: number; // 容器的高度\n style?:\n | string\n | Record<string, any>\n | ((\n pos: { top: number; left: number; width: number; height: number },\n graphic: IGraphic,\n wrapContainer: HTMLElement\n ) => Record<string, any>); // 容器的样式\n}\n\nexport interface CommonDomOptions {\n id?: string;\n container: string | HTMLElement | null; // id或者dom\n visible?: boolean;\n pointerEvents?: boolean | string;\n // 可穿透的事件列表\n // @since 0.21.2\n penetrateEventList?: string[];\n anchorType?: 'position' | 'boundsLeftTop' | BoundsAnchorType;\n}\n\nexport type IGraphicStyle = ILayout &\n IFillStyle &\n IStrokeStyle &\n IPickStyle & {\n forceBoundsWidth: number | (() => number) | undefined;\n forceBoundsHeight: number | (() => number) | undefined;\n opacity: number;\n shadowGraphic?: IGraphic | undefined;\n backgroundMode: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat'; // 填充模式(与具体图元有关)\n backgroundFit: boolean; // 是否正好填充,只在repeat-x或者repeat-y以及no-repeat的时候生效\n // 背景图缩放,只在no-repeat的时候生效\n backgroundScale: number;\n // 背景图偏移,只在no-repeat的时候生效\n backgroundOffsetX: number;\n backgroundOffsetY: number;\n backgroundClip: boolean;\n backgroundCornerRadius: number | number[];\n backgroundOpacity: number;\n // 纹理是否自动做动画\n autoAnimateTexture: boolean;\n // 如果做动画的话,这里代表ratio\n textureRatio: number;\n textureOptions: any;\n background:\n | IBackgroundType\n | {\n background: IBackgroundType;\n dx?: number;\n dy?: number;\n width?: number;\n height?: number;\n x?: number;\n y?: number;\n }\n | null; // 背景,可以与fill同时存在\n texture: TextureType | string; // 纹理\n textureColor: string; // 纹理颜色\n textureSize: number; // 纹理大小\n texturePadding: number; // 纹理间隙\n blur: number;\n filter: string;\n cursor: Cursor | null; // 鼠标样式\n renderStyle?: 'default' | 'rough' | any;\n // HTML的dom或者string\n html:\n | ({\n dom: string | HTMLElement; // dom字符串或者dom\n } & SimpleDomStyleOptions &\n CommonDomOptions)\n | null;\n react:\n | ({\n element: any; // react场景节点\n } & SimpleDomStyleOptions &\n CommonDomOptions)\n | null;\n };\n\nexport type IPickStyle = {\n // 给stroke模式的pick额外加的buffer,用于外界控制stroke区域的pick范围\n pickStrokeBuffer: number;\n};\n\nexport type IDebugType = {\n _debug_bounds: boolean | ((c: any, g: any) => void);\n};\nexport type IGraphicAttribute = IDebugType &\n IGraphicStyle &\n ITransform & {\n /**\n * stroke百分比\n */\n strokeSeg: IStrokeSeg | null;\n // 包围盒的padding\n boundsPadding: number | number[];\n /**\n * 选择模式,精确模式,粗糙模式(包围盒模式),自定义模式\n */\n pickMode: 'accurate' | 'imprecise' | 'custom';\n boundsMode: 'accurate' | 'imprecise';\n customPickShape: () => boolean | null;\n /**\n * 是否支持事件拾取,默认为 true。\n * @default true\n */\n pickable: boolean;\n /**\n * 是否支持fill拾取,默认为 true。\n * @experimental\n * @default true\n */\n fillPickable: boolean;\n /**\n * 是否支持stroke拾取,默认为 true。\n * @experimental\n * @default true\n */\n strokePickable: boolean;\n /**\n * 对于 group 节点,是否支持其子元素的事件拾取,默认为 true。\n * 如果 group `pickable` 关闭,`childrenPickable` 开启,那么 group 的子节点仍参与事件拾取\n * @default true\n */\n childrenPickable: boolean;\n /**\n * 元素是否可见。\n * @default true\n */\n visible: boolean;\n zIndex: number;\n layout: any;\n /**\n * 是否隐藏元素(只是绘制的时候不绘制)\n */\n renderable: boolean;\n /**\n * 是否在3d中控制方向\n * false: 不控制方向\n * true: 始终控制方向朝摄像机\n */\n keepDirIn3d?: boolean;\n shadowRootIdx: number;\n shadowPickMode?: 'full' | 'graphic';\n globalZIndex: number;\n globalCompositeOperation: CanvasRenderingContext2D['globalCompositeOperation'] | '';\n // 完全支持滚动 | 完全不支持滚动 | 支持x方向的滚动 | 支持y方向的滚动\n overflow: 'scroll' | 'hidden' | 'scroll-x' | 'scroll-y';\n // 绘制fill和stroke的顺序,为0表示fill先绘制,1表示stroke先绘制\n fillStrokeOrder: number;\n // @since 0.20.15\n // 保持stroke的scale,默认为false,为true的话stroke显示的宽度会随着scale变化\n keepStrokeScale: boolean;\n };\n\nexport interface IGraphicJson<T extends Partial<IGraphicAttribute> = Partial<IGraphicAttribute>> {\n attribute: Partial<T>;\n _uid: number;\n type: string;\n name: string;\n children: IGraphicJson<T>[];\n}\n\n/** the context of setAttribute */\nexport type ISetAttributeContext = {\n /** type of setAttribute */\n type?: number;\n animationState?: {\n step?: IStep;\n isFirstFrameOfStep?: boolean;\n /** ratio of animation */\n ratio?: number;\n /** is animation end? */\n end?: boolean;\n };\n skipUpdateCallback?: boolean;\n};\n\nexport type IGraphicAnimateParams = {\n slience?: boolean;\n id?: number | string;\n timeline?: ITimeline;\n onStart?: () => void;\n onFrame?: (step: IStep, ratio: number) => void;\n onEnd?: () => void;\n onRemove?: () => void;\n interpolate?: (key: string, ratio: number, from: any, to: any, nextAttributes: any) => boolean;\n};\n\nexport interface IGraphic<T extends Partial<IGraphicAttribute> = Partial<IGraphicAttribute>>\n extends INode,\n IAnimateTarget {\n type?: GraphicType;\n numberType?: number;\n stage?: IStage;\n layer?: ILayer;\n shadowRoot?: IShadowRoot;\n glyphHost?: IGraphic<IGlyphGraphicAttribute>;\n backgroundImg?: boolean;\n attachedThemeGraphic?: IGraphic<any>;\n\n bindDom?: Map<\n string | HTMLElement,\n { container: HTMLElement | string; dom: HTMLElement | any; wrapGroup: HTMLDivElement | any; root?: any }\n >;\n\n valid: boolean;\n parent: IGroup | null;\n isContainer?: boolean;\n // 是否是3d模式(是否应用3d视角)\n in3dMode?: boolean;\n\n // 上次更新的stamp\n stamp?: number;\n animationBackUps?: {\n from: Record<string, any>;\n to: Record<string, any>;\n };\n\n attribute: Partial<T>;\n\n /** 用于实现morph动画场景,转换成bezier曲线渲染 */\n pathProxy?: ICustomPath2D | ((attrs: T) => ICustomPath2D);\n incremental?: number;\n incrementalAt?: number;\n\n /** 记录state对应的图形属性 */\n states?: Record<string, Partial<T>>;\n normalAttrs?: Partial<T>;\n stateProxy?: (stateName: string, targetStates?: string[]) => Partial<T>;\n findFace?: () => IFace3d;\n toggleState: (stateName: string, hasAnimation?: boolean) => void;\n removeState: (stateName: string, hasAnimation?: boolean) => void;\n clearStates: (hasAnimation?: boolean) => void;\n useStates: (states: string[], hasAnimation?: boolean) => void;\n addState: (stateName: string, keepCurrentStates?: boolean, hasAnimation?: boolean) => void;\n hasState: (stateName?: string) => boolean;\n getState: (stateName: string) => Partial<T>;\n onBeforeAttributeUpdate?: (\n val: any,\n attributes: Partial<T>,\n key: null | string | string[],\n context?: ISetAttributeContext\n ) => T | undefined;\n applyStateAttrs: (attrs: Partial<T>, stateNames: string[], hasAnimation?: boolean, isClear?: boolean) => void;\n updateNormalAttrs: (stateAttrs: Partial<T>) => void;\n\n // get\n readonly AABBBounds: IAABBBounds; // 用于获取当前节点的AABB包围盒\n readonly OBBBounds: IOBBBounds; // 获取OBB包围盒,旋转防重叠需要用\n readonly globalAABBBounds: IAABBBounds; // 全局AABB包围盒\n readonly transMatrix: IMatrix; // 变换矩阵,动态计算\n readonly globalTransMatrix: IMatrix; // 变换矩阵,动态计算\n\n getOffsetXY: (attr?: ITransform) => IPoint;\n\n // function\n containsPoint: (x: number, y: number, mode?: IContainPointMode, picker?: IPickerService) => boolean;\n\n setMode: (mode: '3d' | '2d') => void;\n isValid: () => boolean;\n\n // TODO: transform API\n // 基于当前transform的变换,普通用户尽量别用,拿捏不住的~\n translate: (x: number, y: number) => this;\n translateTo: (x: number, y: number) => this;\n scale: (scaleX: number, scaleY: number, scaleCenter?: IPointLike) => this;\n scaleTo: (scaleX: number, scaleY: number) => this;\n rotate: (angle: number, rotateCenter?: IPointLike) => this;\n rotateTo: (angle: number) => this;\n skewTo: (b: number, c: number) => this;\n addUpdateBoundTag: () => void;\n addUpdateShapeAndBoundsTag: () => void;\n addUpdateLayoutTag: () => void;\n\n update: (d?: { bounds: boolean; trans: boolean }) => void;\n\n // animate\n animate: (params?: IGraphicAnimateParams) => IAnimate;\n\n // 语法糖,可有可无,有的为了首屏性能考虑做成get方法,有的由外界直接托管,内部不赋值\n name?: string;\n\n // 供render处理shape缓存tag\n shouldUpdateShape: () => boolean;\n clearUpdateShapeTag: () => void;\n\n // // 供render缓存shape\n // cacheShape?: ICustomPath2D;\n // // 线段使用的path2D\n // cacheLine?: ISegPath2D | ISegPath2D[];\n // // 面积图使用的path2D\n // cacheArea?: IAreaCacheItem | IAreaCacheItem[];\n\n setAttributes: (params: Partial<T>, forceUpdateTag?: boolean, context?: ISetAttributeContext) => void;\n\n initAttributes: (params: Partial<T>) => void;\n\n setAttribute: (key: string, value: any, forceUpdateTag?: boolean, context?: ISetAttributeContext) => void;\n\n setStage: (stage?: IStage, layer?: ILayer) => void;\n onSetStage: (cb: (g: IGraphic, stage: IStage) => void) => void;\n\n shouldUpdateAABBBounds: () => boolean;\n shouldSelfChangeUpdateAABBBounds: () => boolean;\n shouldUpdateGlobalMatrix: () => boolean;\n\n addUpdatePositionTag: () => void;\n addUpdateGlobalPositionTag: () => void;\n\n attachShadow: () => IShadowRoot;\n detachShadow: () => void;\n\n toJson: () => IGraphicJson;\n\n /** 创建pathProxy */\n createPathProxy: (path?: string) => void;\n /** 将图形转换成CustomPath2D */\n toCustomPath?: () => ICustomPath2D;\n\n resources?: Map<\n string | HTMLImageElement | HTMLCanvasElement | IBackgroundConfig,\n { state: 'init' | 'loading' | 'success' | 'fail'; data?: HTMLImageElement | HTMLCanvasElement }\n >;\n imageLoadSuccess: (url: string, data: HTMLImageElement) => void;\n imageLoadFail: (url: string) => void;\n\n clone: () => IGraphic;\n stopAnimates: (stopChildren?: boolean) => void;\n getNoWorkAnimateAttr: () => Record<string, number>;\n getGraphicTheme: () => T;\n}\n\nexport interface IRoot extends IGraphic {\n pick: (x: number, y: number) => IGraphic;\n}\n\n/**\n * 动画配置\n */\nexport type IAnimateConfig = {\n duration?: number;\n easing?: EasingType;\n};\n\nexport type GraphicReleaseStatus = 'released' | 'willRelease';\n"]}
@@ -36,6 +36,9 @@ export interface ICurve<T> {
36
36
  getPointAt: (t: number) => IPointLike;
37
37
  getAngleAt: (t: number) => number;
38
38
  getLength: (direction?: IDirection) => number;
39
+ draw: (path: IPath2D, x: number, y: number, sx: number, sy: number, percent: number) => void;
40
+ getYAt: (x: number) => number;
41
+ includeX: (x: number) => boolean;
39
42
  }
40
43
  export interface ICubicBezierCurve extends ICurve<IPoint> {
41
44
  type: CurveTypeEnum.CubicBezierCurve;
@@ -96,5 +99,7 @@ export interface ICustomPath2D extends ICurvePath<IPoint>, IPath2D, Releaseable
96
99
  fromString: (pathStr: string, x?: number, y?: number, sX?: number, sY?: number) => ICustomPath2D;
97
100
  fromCustomPath2D: (path: ICustomPath2D, x?: number, y?: number, sX?: number, sY?: number) => ICustomPath2D;
98
101
  addCurve: (curve: ICurve<IPoint>) => void;
102
+ getYAt: (x: number) => number;
99
103
  clear: () => void;
104
+ drawWithClipRange: (ctx: IPath2D, size: number, x: number, y: number, clipRange: number) => void;
100
105
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/interface/path.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,KAAK;IACL,OAAO;IACP,eAAe;IACf,WAAW;IACX,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,kBAAkB;IAClB,MAAM;CACP,CAAC","file":"path.js","sourcesContent":["import type { IAABBBounds, IPoint, IPointLike } from '@visactor/vutils';\nimport type { Releaseable, IDirection } from './common';\nimport type { CurveTypeEnum } from '../common/enums';\n\nexport const strCommandMap = [\n 'arc',\n 'arcTo',\n 'bezierCurveTo',\n 'closePath',\n 'ellipse',\n 'lineTo',\n 'moveTo',\n 'quadraticCurveTo',\n 'rect'\n];\n\nexport type CommandType = [\n number,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?\n];\n\nexport type CommandStrType = [\n string,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?\n];\n\nexport interface ICurve<T> {\n type: number;\n defined: boolean;\n originP1?: IPointLike;\n originP2?: IPointLike;\n readonly p0: T;\n readonly p1?: T;\n readonly p2?: T;\n readonly p3?: T;\n getPointAt: (t: number) => IPointLike;\n getAngleAt: (t: number) => number;\n getLength: (direction?: IDirection) => number;\n}\n\nexport interface ICubicBezierCurve extends ICurve<IPoint> {\n type: CurveTypeEnum.CubicBezierCurve;\n // p0: IPoint;\n readonly p1: IPoint;\n readonly p2: IPoint;\n readonly p3: IPoint;\n}\n\nexport interface IQuadraticBezierCurve extends ICurve<IPoint> {\n type: CurveTypeEnum.QuadraticBezierCurve;\n // p0: IPoint;\n readonly p1: IPoint;\n readonly p2: IPoint;\n}\n\nexport interface IArcCurve extends ICurve<IPoint> {\n type: CurveTypeEnum.ArcCurve;\n // p0: IPoint;\n readonly p1: IPoint;\n radius: number;\n}\n\nexport interface ILineCurve extends ICurve<IPoint> {\n type: CurveTypeEnum.LineCurve;\n // p0: IPoint;\n readonly p1: IPoint;\n}\n\nexport interface IEllipseCurve extends ICurve<IPoint> {\n type: CurveTypeEnum.EllipseCurve;\n // p0: IPoint;\n radiusX: number;\n radiusY: number;\n rotation: number;\n startAngle: number;\n endAngle: number;\n anticlockwise?: boolean;\n}\n\nexport interface IMoveCurve extends ICurve<IPoint> {\n type: CurveTypeEnum.MoveCurve;\n // p0: IPoint;\n readonly p1: IPoint;\n}\n\nexport interface ICurvePath<T> {\n curves: ICurve<T>[];\n bounds?: IAABBBounds;\n getPointAt: (t: number) => IPointLike;\n getCurveLengths: () => number[];\n getLength: (direction?: IDirection) => number;\n getBounds?: () => IAABBBounds;\n}\n\nexport interface IPath2D {\n moveTo: (x: number, y: number, z?: number) => void;\n lineTo: (x: number, y: number, z?: number) => void;\n quadraticCurveTo: (aCPx: number, aCPy: number, aX: number, aY: number, z?: number) => void;\n bezierCurveTo: (\n aCP1x: number,\n aCP1y: number,\n aCP2x: number,\n aCP2y: number,\n aX: number,\n aY: number,\n z?: number\n ) => void;\n arcTo: (aX1: number, aY1: number, aX2: number, aY2: number, aRadius: number, z?: number) => void;\n ellipse: (\n aX: number,\n aY: number,\n xRadius: number,\n yRadius: number,\n aRotation: number,\n aStartAngle: number,\n aEndAngle: number,\n aClockwise: boolean\n ) => void;\n rect: (x: number, y: number, w: number, h: number, z?: number) => void;\n arc: (\n x: number,\n y: number,\n radius: number,\n startAngle: number,\n endAngle: number,\n counterclockwise?: boolean,\n z?: number\n ) => void;\n closePath: () => void;\n}\n\n// 用户可以直接操作path2D\nexport interface ICustomPath2D extends ICurvePath<IPoint>, IPath2D, Releaseable {\n commandList: CommandType[];\n\n toString: () => string;\n transform: (x: number, y: number, sx: number, sy: number) => void;\n fromString: (pathStr: string, x?: number, y?: number, sX?: number, sY?: number) => ICustomPath2D;\n fromCustomPath2D: (path: ICustomPath2D, x?: number, y?: number, sX?: number, sY?: number) => ICustomPath2D;\n addCurve: (curve: ICurve<IPoint>) => void;\n clear: () => void;\n}\n"]}
1
+ {"version":3,"sources":["../src/interface/path.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,KAAK;IACL,OAAO;IACP,eAAe;IACf,WAAW;IACX,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,kBAAkB;IAClB,MAAM;CACP,CAAC","file":"path.js","sourcesContent":["import type { IAABBBounds, IPoint, IPointLike } from '@visactor/vutils';\nimport type { Releaseable, IDirection } from './common';\nimport type { CurveTypeEnum } from '../common/enums';\n\nexport const strCommandMap = [\n 'arc',\n 'arcTo',\n 'bezierCurveTo',\n 'closePath',\n 'ellipse',\n 'lineTo',\n 'moveTo',\n 'quadraticCurveTo',\n 'rect'\n];\n\nexport type CommandType = [\n number,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?\n];\n\nexport type CommandStrType = [\n string,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?,\n (number | boolean)?\n];\n\nexport interface ICurve<T> {\n type: number;\n defined: boolean;\n originP1?: IPointLike;\n originP2?: IPointLike;\n readonly p0: T;\n readonly p1?: T;\n readonly p2?: T;\n readonly p3?: T;\n getPointAt: (t: number) => IPointLike;\n getAngleAt: (t: number) => number;\n getLength: (direction?: IDirection) => number;\n draw: (path: IPath2D, x: number, y: number, sx: number, sy: number, percent: number) => void;\n getYAt: (x: number) => number;\n includeX: (x: number) => boolean;\n}\n\nexport interface ICubicBezierCurve extends ICurve<IPoint> {\n type: CurveTypeEnum.CubicBezierCurve;\n // p0: IPoint;\n readonly p1: IPoint;\n readonly p2: IPoint;\n readonly p3: IPoint;\n}\n\nexport interface IQuadraticBezierCurve extends ICurve<IPoint> {\n type: CurveTypeEnum.QuadraticBezierCurve;\n // p0: IPoint;\n readonly p1: IPoint;\n readonly p2: IPoint;\n}\n\nexport interface IArcCurve extends ICurve<IPoint> {\n type: CurveTypeEnum.ArcCurve;\n // p0: IPoint;\n readonly p1: IPoint;\n radius: number;\n}\n\nexport interface ILineCurve extends ICurve<IPoint> {\n type: CurveTypeEnum.LineCurve;\n // p0: IPoint;\n readonly p1: IPoint;\n}\n\nexport interface IEllipseCurve extends ICurve<IPoint> {\n type: CurveTypeEnum.EllipseCurve;\n // p0: IPoint;\n radiusX: number;\n radiusY: number;\n rotation: number;\n startAngle: number;\n endAngle: number;\n anticlockwise?: boolean;\n}\n\nexport interface IMoveCurve extends ICurve<IPoint> {\n type: CurveTypeEnum.MoveCurve;\n // p0: IPoint;\n readonly p1: IPoint;\n}\n\nexport interface ICurvePath<T> {\n curves: ICurve<T>[];\n bounds?: IAABBBounds;\n getPointAt: (t: number) => IPointLike;\n getCurveLengths: () => number[];\n getLength: (direction?: IDirection) => number;\n getBounds?: () => IAABBBounds;\n}\n\nexport interface IPath2D {\n moveTo: (x: number, y: number, z?: number) => void;\n lineTo: (x: number, y: number, z?: number) => void;\n quadraticCurveTo: (aCPx: number, aCPy: number, aX: number, aY: number, z?: number) => void;\n bezierCurveTo: (\n aCP1x: number,\n aCP1y: number,\n aCP2x: number,\n aCP2y: number,\n aX: number,\n aY: number,\n z?: number\n ) => void;\n arcTo: (aX1: number, aY1: number, aX2: number, aY2: number, aRadius: number, z?: number) => void;\n ellipse: (\n aX: number,\n aY: number,\n xRadius: number,\n yRadius: number,\n aRotation: number,\n aStartAngle: number,\n aEndAngle: number,\n aClockwise: boolean\n ) => void;\n rect: (x: number, y: number, w: number, h: number, z?: number) => void;\n arc: (\n x: number,\n y: number,\n radius: number,\n startAngle: number,\n endAngle: number,\n counterclockwise?: boolean,\n z?: number\n ) => void;\n closePath: () => void;\n}\n\n// 用户可以直接操作path2D\nexport interface ICustomPath2D extends ICurvePath<IPoint>, IPath2D, Releaseable {\n commandList: CommandType[];\n\n toString: () => string;\n transform: (x: number, y: number, sx: number, sy: number) => void;\n fromString: (pathStr: string, x?: number, y?: number, sX?: number, sY?: number) => ICustomPath2D;\n fromCustomPath2D: (path: ICustomPath2D, x?: number, y?: number, sX?: number, sY?: number) => ICustomPath2D;\n addCurve: (curve: ICurve<IPoint>) => void;\n getYAt: (x: number) => number;\n clear: () => void;\n drawWithClipRange: (ctx: IPath2D, size: number, x: number, y: number, clipRange: number) => void;\n}\n"]}
@@ -57,6 +57,19 @@ export interface IPickItemInterceptorContribution {
57
57
  parentMatrix: IMatrix;
58
58
  }) => PickResult | null;
59
59
  }
60
+ export interface IPickServiceInterceptorContribution {
61
+ order: number;
62
+ beforePickItem?: (result: PickResult, pickerService: IPickerService, point: IPointLike, drawContext: {
63
+ in3dInterceptor?: boolean;
64
+ }, params?: {
65
+ parentMatrix: IMatrix;
66
+ }) => PickResult | null;
67
+ afterPickItem?: (result: PickResult, pickerService: IPickerService, point: IPointLike, drawContext: {
68
+ in3dInterceptor?: boolean;
69
+ }, params?: {
70
+ parentMatrix: IMatrix;
71
+ }) => PickResult | null;
72
+ }
60
73
  export interface IBoundsPicker {
61
74
  type: string;
62
75
  numberType?: number;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/interface/picker.ts"],"names":[],"mappings":"","file":"picker.js","sourcesContent":["import type { IBounds, IMatrix, IPoint, IPointLike } from '@visactor/vutils';\nimport type { IGraphic } from './graphic';\nimport type { IContext2d } from './context';\nimport type { EnvType, IGlobal } from './global';\nimport type { IGroup } from './graphic/group';\nimport type { IDrawContribution } from './render';\n\ntype ISubPickEventParams =\n | boolean\n | {\n graphic?: any;\n group?: any;\n params: ISubPickEventParams;\n };\n\nexport type IPickEventParams =\n | {\n shadowTarget?: IGraphic;\n }\n | ISubPickEventParams;\n\nexport type PickResult = {\n graphic?: IGraphic | null;\n group?: IGroup | null;\n params?:\n | {\n shadowTarget?: IGraphic;\n }\n | ISubPickEventParams;\n};\n\nexport interface IGraphicPicker {\n type: string;\n numberType: number;\n\n contains: (graphic: IGraphic, point: IPointLike, params?: IPickParams) => boolean | any;\n}\n\nexport interface IPickParams {\n group?: boolean;\n graphic?: boolean;\n bounds?: IBounds;\n pickContext?: IContext2d;\n pickerService?: IPickerService;\n // 内部设置\n in3dInterceptor?: boolean;\n hack_pieFace?: string;\n}\n\nexport interface IPickerService {\n type: string;\n\n pickContext?: IContext2d;\n pickerMap: Map<number, IGraphicPicker>;\n configure: (global: IGlobal, env: EnvType) => void;\n pick: (group: IGraphic[], point: IPoint, params?: IPickParams) => PickResult;\n pickGroup: (group: IGroup, point: IPointLike, parentMatrix: IMatrix, params: IPickParams) => PickResult;\n pickItem: (\n graphic: IGraphic,\n point: IPointLike,\n parentMatrix: IMatrix | null,\n params?: IPickParams\n ) => PickResult | null;\n containsPoint: (graphic: IGraphic, point: IPointLike, params?: IPickParams) => boolean;\n drawContribution?: IDrawContribution;\n}\n\nexport interface IPickItemInterceptorContribution {\n order: number;\n // null代表没匹配到,boolean代表是否pick中\n beforePickItem?: (\n graphic: IGraphic,\n pickerService: IPickerService,\n point: IPointLike,\n drawContext: {\n in3dInterceptor?: boolean;\n },\n params?: {\n parentMatrix: IMatrix;\n }\n ) => PickResult | null;\n\n afterPickItem?: (\n graphic: IGraphic,\n pickerService: IPickerService,\n point: IPointLike,\n drawContext: {\n in3dInterceptor?: boolean;\n },\n params?: {\n parentMatrix: IMatrix;\n }\n ) => PickResult | null;\n // afterPickItem?: (\n // graphic: IGraphic,\n // pickerService: IPickerService,\n // ) => boolean;\n}\n\nexport interface IBoundsPicker {\n type: string;\n numberType?: number;\n\n contains: (graphic: IGraphic, point: IPointLike, params?: IPickParams) => boolean;\n}\n"]}
1
+ {"version":3,"sources":["../src/interface/picker.ts"],"names":[],"mappings":"","file":"picker.js","sourcesContent":["import type { IBounds, IMatrix, IPoint, IPointLike } from '@visactor/vutils';\nimport type { IGraphic } from './graphic';\nimport type { IContext2d } from './context';\nimport type { EnvType, IGlobal } from './global';\nimport type { IGroup } from './graphic/group';\nimport type { IDrawContribution } from './render';\n\ntype ISubPickEventParams =\n | boolean\n | {\n graphic?: any;\n group?: any;\n params: ISubPickEventParams;\n };\n\nexport type IPickEventParams =\n | {\n shadowTarget?: IGraphic;\n }\n | ISubPickEventParams;\n\nexport type PickResult = {\n graphic?: IGraphic | null;\n group?: IGroup | null;\n params?:\n | {\n shadowTarget?: IGraphic;\n }\n | ISubPickEventParams;\n};\n\nexport interface IGraphicPicker {\n type: string;\n numberType: number;\n\n contains: (graphic: IGraphic, point: IPointLike, params?: IPickParams) => boolean | any;\n}\n\nexport interface IPickParams {\n group?: boolean;\n graphic?: boolean;\n bounds?: IBounds;\n pickContext?: IContext2d;\n pickerService?: IPickerService;\n // 内部设置\n in3dInterceptor?: boolean;\n hack_pieFace?: string;\n}\n\nexport interface IPickerService {\n type: string;\n\n pickContext?: IContext2d;\n pickerMap: Map<number, IGraphicPicker>;\n configure: (global: IGlobal, env: EnvType) => void;\n pick: (group: IGraphic[], point: IPoint, params?: IPickParams) => PickResult;\n pickGroup: (group: IGroup, point: IPointLike, parentMatrix: IMatrix, params: IPickParams) => PickResult;\n pickItem: (\n graphic: IGraphic,\n point: IPointLike,\n parentMatrix: IMatrix | null,\n params?: IPickParams\n ) => PickResult | null;\n containsPoint: (graphic: IGraphic, point: IPointLike, params?: IPickParams) => boolean;\n drawContribution?: IDrawContribution;\n}\n\nexport interface IPickItemInterceptorContribution {\n order: number;\n // null代表没匹配到,boolean代表是否pick中\n beforePickItem?: (\n graphic: IGraphic,\n pickerService: IPickerService,\n point: IPointLike,\n drawContext: {\n in3dInterceptor?: boolean;\n },\n params?: {\n parentMatrix: IMatrix;\n }\n ) => PickResult | null;\n\n afterPickItem?: (\n graphic: IGraphic,\n pickerService: IPickerService,\n point: IPointLike,\n drawContext: {\n in3dInterceptor?: boolean;\n },\n params?: {\n parentMatrix: IMatrix;\n }\n ) => PickResult | null;\n // afterPickItem?: (\n // graphic: IGraphic,\n // pickerService: IPickerService,\n // ) => boolean;\n}\nexport interface IPickServiceInterceptorContribution {\n order: number;\n // null代表没匹配到,boolean代表是否pick中\n beforePickItem?: (\n result: PickResult,\n pickerService: IPickerService,\n point: IPointLike,\n drawContext: {\n in3dInterceptor?: boolean;\n },\n params?: {\n parentMatrix: IMatrix;\n }\n ) => PickResult | null;\n\n afterPickItem?: (\n result: PickResult,\n pickerService: IPickerService,\n point: IPointLike,\n drawContext: {\n in3dInterceptor?: boolean;\n },\n params?: {\n parentMatrix: IMatrix;\n }\n ) => PickResult | null;\n // afterPickItem?: (\n // graphic: IGraphic,\n // pickerService: IPickerService,\n // ) => boolean;\n}\n\nexport interface IBoundsPicker {\n type: string;\n numberType?: number;\n\n contains: (graphic: IGraphic, point: IPointLike, params?: IPickParams) => boolean;\n}\n"]}
@@ -2,3 +2,5 @@ export declare const GraphicPicker: unique symbol;
2
2
  export declare const PickerService: unique symbol;
3
3
  export declare const BoundsPicker: unique symbol;
4
4
  export declare const GlobalPickerService: unique symbol;
5
+ export declare const PickItemInterceptor: unique symbol;
6
+ export declare const PickServiceInterceptor: unique symbol;
@@ -5,4 +5,8 @@ export const PickerService = Symbol.for("PickerService");
5
5
  export const BoundsPicker = Symbol.for("BoundsPicker");
6
6
 
7
7
  export const GlobalPickerService = Symbol.for("GlobalPickerService");
8
+
9
+ export const PickItemInterceptor = Symbol.for("PickItemInterceptor");
10
+
11
+ export const PickServiceInterceptor = Symbol.for("PickServiceInterceptor");
8
12
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/picker/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AACzD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAEzD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC","file":"constants.js","sourcesContent":["export const GraphicPicker = Symbol.for('GraphicPicker');\nexport const PickerService = Symbol.for('PickerService');\n\nexport const BoundsPicker = Symbol.for('BoundsPicker');\nexport const GlobalPickerService = Symbol.for('GlobalPickerService');\n"]}
1
+ {"version":3,"sources":["../src/picker/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AACzD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAEzD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;AAGrE,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;AAErE,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC","file":"constants.js","sourcesContent":["export const GraphicPicker = Symbol.for('GraphicPicker');\nexport const PickerService = Symbol.for('PickerService');\n\nexport const BoundsPicker = Symbol.for('BoundsPicker');\nexport const GlobalPickerService = Symbol.for('GlobalPickerService');\n\n// 拦截器\nexport const PickItemInterceptor = Symbol.for('PickItemInterceptor');\n// pickService的拦截器\nexport const PickServiceInterceptor = Symbol.for('PickServiceInterceptor');\n"]}
@@ -1,6 +1,11 @@
1
1
  import type { IMatrix, IPointLike } from '@visactor/vutils';
2
- import type { IContext2d, IGraphic, IPickItemInterceptorContribution, IPickParams, IPickerService, PickResult } from '../interface';
3
- export declare const PickItemInterceptor: unique symbol;
2
+ import type { IContext2d, IGraphic, IPickItemInterceptorContribution, IPickParams, IPickServiceInterceptorContribution, IPickerService, PickResult } from '../interface';
3
+ export declare class ShadowPickServiceInterceptorContribution implements IPickServiceInterceptorContribution {
4
+ order: number;
5
+ afterPickItem(result: PickResult, pickerService: IPickerService, point: IPointLike, pickParams: IPickParams, params?: {
6
+ parentMatrix: IMatrix;
7
+ }): null | PickResult;
8
+ }
4
9
  export declare class ShadowRootPickItemInterceptorContribution implements IPickItemInterceptorContribution {
5
10
  order: number;
6
11
  afterPickItem(graphic: IGraphic, pickerService: IPickerService, point: IPointLike, pickParams: IPickParams, params?: {
@@ -14,7 +14,25 @@ import { draw3dItem } from "../common/3d-interceptor";
14
14
 
15
15
  import { getTheme } from "../graphic";
16
16
 
17
- export const PickItemInterceptor = Symbol.for("PickItemInterceptor");
17
+ let ShadowPickServiceInterceptorContribution = class {
18
+ constructor() {
19
+ this.order = 1;
20
+ }
21
+ afterPickItem(result, pickerService, point, pickParams, params) {
22
+ if (result.graphic) {
23
+ let g = result.graphic;
24
+ for (;g.parent; ) g = g.parent;
25
+ g.shadowHost && (result.params = {
26
+ shadowTarget: result.graphic
27
+ }, result.graphic = g.shadowHost);
28
+ }
29
+ return result;
30
+ }
31
+ };
32
+
33
+ ShadowPickServiceInterceptorContribution = __decorate([ injectable() ], ShadowPickServiceInterceptorContribution);
34
+
35
+ export { ShadowPickServiceInterceptorContribution };
18
36
 
19
37
  let ShadowRootPickItemInterceptorContribution = class {
20
38
  constructor() {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/picker/pick-interceptor.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAUtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,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I,KAAK,CAAC,EAAE;YACvB,OAAO,IAAI,CAAC;SACb;QACD,UAAU,CAAC,eAAe,GAAG,IAAI,CAAC;QAGlC,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC5B,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAG9B,IAAI,OAAO,CAAC,WAAW,EAAE;YACvB,MAAM,MAAM,GAAG,UAAU,CACvB,OAAO,EACP,OAAO,EACP,GAAG,EAAE;gBACH,OAAO,aAAa,CAAC,SAAS,CAAC,OAAiB,EAAE,KAAK,EAAE,MAAM,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;YAC5F,CAAC,EACD,UAAU,CACX,CAAC;YAEF,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;YAEtB,UAAU,CAAC,eAAe,GAAG,KAAK,CAAC;YACnC,OAAO,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO,MAAM,CAAC;SACf;QACD,OAAO,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa,CAAC,OAAmB;QAC/B,OAAO,CAAC,sBAAsB,EAAE,CAAC;IACnC,CAAC;CACF,CAAA;AArDY,2BAA2B;IADvC,UAAU,EAAE;GACA,2BAA2B,CAqDvC;SArDY,2BAA2B","file":"pick-interceptor.js","sourcesContent":["import type { IMatrix, IPointLike } from '@visactor/vutils';\nimport { Point } from '@visactor/vutils';\nimport { injectable } from '../common/inversify-lite';\nimport type {\n IContext2d,\n IGraphic,\n IGroup,\n IPickItemInterceptorContribution,\n IPickParams,\n IPickerService,\n PickResult\n} from '../interface';\nimport { matrixAllocate } from '../allocator/matrix-allocate';\nimport { draw3dItem } from '../common/3d-interceptor';\nimport { getTheme } from '../graphic';\n\n// 拦截器\nexport const PickItemInterceptor = Symbol.for('PickItemInterceptor');\n\n/**\n * 影子节点拦截器,用于渲染影子节点\n */\n@injectable()\nexport class ShadowRootPickItemInterceptorContribution implements IPickItemInterceptorContribution {\n order: number = 1;\n afterPickItem(\n graphic: IGraphic,\n pickerService: IPickerService,\n point: IPointLike,\n pickParams: IPickParams,\n params?: {\n parentMatrix: IMatrix;\n }\n ): null | PickResult {\n if (graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx) {\n return this._pickItem(graphic, pickerService, point, pickParams, params);\n }\n return null;\n }\n\n beforePickItem(\n graphic: IGraphic,\n pickerService: IPickerService,\n point: IPointLike,\n pickParams: IPickParams,\n params?: {\n parentMatrix: IMatrix;\n }\n ): null | PickResult {\n if (graphic.attribute.shadowRootIdx < 0) {\n return this._pickItem(graphic, pickerService, point, pickParams, params);\n }\n return null;\n }\n\n protected _pickItem(\n graphic: IGraphic,\n pickerService: IPickerService,\n point: IPointLike,\n pickParams: IPickParams,\n params?: {\n parentMatrix: IMatrix;\n }\n ): PickResult | null {\n if (!graphic.shadowRoot) {\n return null;\n }\n const { parentMatrix } = params || {};\n if (!parentMatrix) {\n return null;\n }\n\n const context = pickerService.pickContext;\n context.highPerformanceSave();\n\n const theme = (getTheme(graphic) as any)?.[graphic.type];\n const { shadowPickMode = theme?.shadowPickMode } = graphic.attribute;\n const g = graphic.shadowRoot;\n const currentGroupMatrix = matrixAllocate.allocateByObj(parentMatrix);\n const newPoint = new Point(\n currentGroupMatrix.a * point.x + currentGroupMatrix.c * point.y + currentGroupMatrix.e,\n currentGroupMatrix.b * point.x + currentGroupMatrix.d * point.y + currentGroupMatrix.f\n );\n // const transMatrix = graphic.transMatrix;\n // currentGroupMatrix.multiply(\n // transMatrix.a,\n // transMatrix.b,\n // transMatrix.c,\n // transMatrix.d,\n // transMatrix.e,\n // transMatrix.f\n // );\n\n // currentGroupMatrix.transformPoint(newPoint, newPoint);\n const result = pickerService.pickGroup(g, newPoint, currentGroupMatrix, pickParams);\n\n context.highPerformanceRestore();\n\n // 影子节点pick到group也算pick到graphic\n if (!result.graphic && result.group && shadowPickMode === 'full') {\n result.graphic = result.group;\n }\n\n return result;\n }\n}\n\n@injectable()\nexport class InteractivePickItemInterceptorContribution implements IPickItemInterceptorContribution {\n order: number = 1;\n\n beforePickItem(\n graphic: IGraphic,\n pickerService: IPickerService,\n point: IPointLike,\n pickParams: IPickParams,\n params?: {\n parentMatrix: IMatrix;\n }\n ): null | PickResult {\n const originGraphic = graphic.baseGraphic;\n if (originGraphic && originGraphic.parent) {\n const newPoint = new Point(point.x, point.y);\n const context = pickerService.pickContext;\n context.highPerformanceSave();\n const parentMatrix = originGraphic.parent.globalTransMatrix;\n parentMatrix.transformPoint(newPoint, newPoint);\n\n const result = originGraphic.isContainer\n ? pickerService.pickGroup(originGraphic, newPoint.clone(), parentMatrix, pickParams)\n : pickerService.pickItem(originGraphic, newPoint.clone(), parentMatrix, pickParams);\n context.highPerformanceRestore();\n return result;\n }\n return null;\n }\n}\n\n/**\n * 3d拦截器,用于渲染3d视角\n */\n@injectable()\nexport class Canvas3DPickItemInterceptor implements IPickItemInterceptorContribution {\n // canvas?: ICanvas;\n order: number = 1;\n\n beforePickItem(\n graphic: IGraphic,\n pickerService: IPickerService,\n point: IPointLike,\n pickParams: IPickParams,\n params?: {\n parentMatrix: IMatrix;\n }\n ) {\n if (!graphic.in3dMode || pickParams.in3dInterceptor) {\n return null;\n }\n\n const context = pickerService.pickContext;\n const stage = graphic.stage;\n if (!(context && stage)) {\n return null;\n }\n pickParams.in3dInterceptor = true;\n\n // 使用3d模式渲染\n context.save();\n this.initCanvasCtx(context);\n context.camera = stage.camera;\n\n // 设置context的transform到上一个节点\n if (graphic.isContainer) {\n const result = draw3dItem(\n context,\n graphic,\n () => {\n return pickerService.pickGroup(graphic as IGroup, point, params.parentMatrix, pickParams);\n },\n pickParams\n );\n\n context.camera = null;\n\n pickParams.in3dInterceptor = false;\n context.restore();\n return result;\n }\n context.restore();\n return null;\n }\n\n initCanvasCtx(context: IContext2d) {\n context.setTransformForCurrent();\n }\n}\n"]}
1
+ {"version":3,"sources":["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ACX,CAAC;YAEF,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;YAEtB,UAAU,CAAC,eAAe,GAAG,KAAK,CAAC;YACnC,OAAO,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO,MAAM,CAAC;SACf;QACD,OAAO,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa,CAAC,OAAmB;QAC/B,OAAO,CAAC,sBAAsB,EAAE,CAAC;IACnC,CAAC;CACF,CAAA;AArDY,2BAA2B;IADvC,UAAU,EAAE;GACA,2BAA2B,CAqDvC;SArDY,2BAA2B","file":"pick-interceptor.js","sourcesContent":["import type { IMatrix, IPointLike } from '@visactor/vutils';\nimport { Point } from '@visactor/vutils';\nimport { injectable } from '../common/inversify-lite';\nimport type {\n IContext2d,\n IGraphic,\n IGroup,\n IPickItemInterceptorContribution,\n IPickParams,\n IPickServiceInterceptorContribution,\n IPickerService,\n PickResult\n} from '../interface';\nimport { matrixAllocate } from '../allocator/matrix-allocate';\nimport { draw3dItem } from '../common/3d-interceptor';\nimport { getTheme } from '../graphic';\n\n@injectable()\nexport class ShadowPickServiceInterceptorContribution implements IPickServiceInterceptorContribution {\n order: number = 1;\n afterPickItem(\n result: PickResult,\n pickerService: IPickerService,\n point: IPointLike,\n pickParams: IPickParams,\n params?: {\n parentMatrix: IMatrix;\n }\n ): null | PickResult {\n if (result.graphic) {\n let g = result.graphic;\n while (g.parent) {\n g = g.parent;\n }\n if (g.shadowHost) {\n result.params = {\n shadowTarget: result.graphic\n };\n result.graphic = g.shadowHost;\n }\n }\n return result;\n }\n}\n\n/**\n * 影子节点拦截器,用于渲染影子节点\n */\n@injectable()\nexport class ShadowRootPickItemInterceptorContribution implements IPickItemInterceptorContribution {\n order: number = 1;\n afterPickItem(\n graphic: IGraphic,\n pickerService: IPickerService,\n point: IPointLike,\n pickParams: IPickParams,\n params?: {\n parentMatrix: IMatrix;\n }\n ): null | PickResult {\n if (graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx) {\n return this._pickItem(graphic, pickerService, point, pickParams, params);\n }\n return null;\n }\n\n beforePickItem(\n graphic: IGraphic,\n pickerService: IPickerService,\n point: IPointLike,\n pickParams: IPickParams,\n params?: {\n parentMatrix: IMatrix;\n }\n ): null | PickResult {\n if (graphic.attribute.shadowRootIdx < 0) {\n return this._pickItem(graphic, pickerService, point, pickParams, params);\n }\n return null;\n }\n\n protected _pickItem(\n graphic: IGraphic,\n pickerService: IPickerService,\n point: IPointLike,\n pickParams: IPickParams,\n params?: {\n parentMatrix: IMatrix;\n }\n ): PickResult | null {\n if (!graphic.shadowRoot) {\n return null;\n }\n const { parentMatrix } = params || {};\n if (!parentMatrix) {\n return null;\n }\n\n const context = pickerService.pickContext;\n context.highPerformanceSave();\n\n const theme = (getTheme(graphic) as any)?.[graphic.type];\n const { shadowPickMode = theme?.shadowPickMode } = graphic.attribute;\n const g = graphic.shadowRoot;\n const currentGroupMatrix = matrixAllocate.allocateByObj(parentMatrix);\n const newPoint = new Point(\n currentGroupMatrix.a * point.x + currentGroupMatrix.c * point.y + currentGroupMatrix.e,\n currentGroupMatrix.b * point.x + currentGroupMatrix.d * point.y + currentGroupMatrix.f\n );\n // const transMatrix = graphic.transMatrix;\n // currentGroupMatrix.multiply(\n // transMatrix.a,\n // transMatrix.b,\n // transMatrix.c,\n // transMatrix.d,\n // transMatrix.e,\n // transMatrix.f\n // );\n\n // currentGroupMatrix.transformPoint(newPoint, newPoint);\n const result = pickerService.pickGroup(g, newPoint, currentGroupMatrix, pickParams);\n\n context.highPerformanceRestore();\n\n // 影子节点pick到group也算pick到graphic\n if (!result.graphic && result.group && shadowPickMode === 'full') {\n result.graphic = result.group;\n }\n\n return result;\n }\n}\n\n@injectable()\nexport class InteractivePickItemInterceptorContribution implements IPickItemInterceptorContribution {\n order: number = 1;\n\n beforePickItem(\n graphic: IGraphic,\n pickerService: IPickerService,\n point: IPointLike,\n pickParams: IPickParams,\n params?: {\n parentMatrix: IMatrix;\n }\n ): null | PickResult {\n const originGraphic = graphic.baseGraphic;\n if (originGraphic && originGraphic.parent) {\n const newPoint = new Point(point.x, point.y);\n const context = pickerService.pickContext;\n context.highPerformanceSave();\n const parentMatrix = originGraphic.parent.globalTransMatrix;\n parentMatrix.transformPoint(newPoint, newPoint);\n\n const result = originGraphic.isContainer\n ? pickerService.pickGroup(originGraphic, newPoint.clone(), parentMatrix, pickParams)\n : pickerService.pickItem(originGraphic, newPoint.clone(), parentMatrix, pickParams);\n context.highPerformanceRestore();\n return result;\n }\n return null;\n }\n}\n\n/**\n * 3d拦截器,用于渲染3d视角\n */\n@injectable()\nexport class Canvas3DPickItemInterceptor implements IPickItemInterceptorContribution {\n // canvas?: ICanvas;\n order: number = 1;\n\n beforePickItem(\n graphic: IGraphic,\n pickerService: IPickerService,\n point: IPointLike,\n pickParams: IPickParams,\n params?: {\n parentMatrix: IMatrix;\n }\n ) {\n if (!graphic.in3dMode || pickParams.in3dInterceptor) {\n return null;\n }\n\n const context = pickerService.pickContext;\n const stage = graphic.stage;\n if (!(context && stage)) {\n return null;\n }\n pickParams.in3dInterceptor = true;\n\n // 使用3d模式渲染\n context.save();\n this.initCanvasCtx(context);\n context.camera = stage.camera;\n\n // 设置context的transform到上一个节点\n if (graphic.isContainer) {\n const result = draw3dItem(\n context,\n graphic,\n () => {\n return pickerService.pickGroup(graphic as IGroup, point, params.parentMatrix, pickParams);\n },\n pickParams\n );\n\n context.camera = null;\n\n pickParams.in3dInterceptor = false;\n context.restore();\n return result;\n }\n context.restore();\n return null;\n }\n\n initCanvasCtx(context: IContext2d) {\n context.setTransformForCurrent();\n }\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  import { ContainerModule } from "../common/inversify-lite";
2
2
 
3
- import { PickerService, GlobalPickerService } from "./constants";
3
+ import { PickerService, GlobalPickerService, PickItemInterceptor, PickServiceInterceptor } from "./constants";
4
4
 
5
- import { Canvas3DPickItemInterceptor, InteractivePickItemInterceptorContribution, PickItemInterceptor, ShadowRootPickItemInterceptorContribution } from "./pick-interceptor";
5
+ import { Canvas3DPickItemInterceptor, InteractivePickItemInterceptorContribution, ShadowPickServiceInterceptorContribution, ShadowRootPickItemInterceptorContribution } from "./pick-interceptor";
6
6
 
7
7
  import { bindContributionProvider } from "../common/contribution-provider";
8
8
 
@@ -11,6 +11,8 @@ export default new ContainerModule(((bind, unbind, isBound) => {
11
11
  bind(Canvas3DPickItemInterceptor).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(Canvas3DPickItemInterceptor),
12
12
  bind(ShadowRootPickItemInterceptorContribution).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(ShadowRootPickItemInterceptorContribution),
13
13
  bind(InteractivePickItemInterceptorContribution).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(InteractivePickItemInterceptorContribution),
14
- bindContributionProvider(bind, PickItemInterceptor);
14
+ bindContributionProvider(bind, PickItemInterceptor), bind(ShadowPickServiceInterceptorContribution).toSelf().inSingletonScope(),
15
+ bind(PickServiceInterceptor).toService(ShadowPickServiceInterceptorContribution),
16
+ bindContributionProvider(bind, PickServiceInterceptor);
15
17
  }));
16
18
  //# sourceMappingURL=pick-modules.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/picker/pick-modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIjE,OAAO,EACL,2BAA2B,EAC3B,0CAA0C,EAC1C,mBAAmB,EACnB,yCAAyC,EAC1C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,eAAe,IAAI,eAAe,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;IAC3D,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QAC3B,IAAI,CAAC,mBAAmB,CAAC,CAAC,MAAM,EAAE,CAAC;QACnC,IAAI,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;KACpD;IAOD,IAAI,CAAC,2BAA2B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC9D,IAAI,CAAC,mBAAmB,CAAC,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;IAGjE,IAAI,CAAC,yCAAyC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC5E,IAAI,CAAC,mBAAmB,CAAC,CAAC,SAAS,CAAC,yCAAyC,CAAC,CAAC;IAG/E,IAAI,CAAC,0CAA0C,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC7E,IAAI,CAAC,mBAAmB,CAAC,CAAC,SAAS,CAAC,0CAA0C,CAAC,CAAC;IAChF,wBAAwB,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;AACtD,CAAC,CAAC,CAAC","file":"pick-modules.js","sourcesContent":["import { ContainerModule } from '../common/inversify-lite';\nimport { PickerService, GlobalPickerService } from './constants';\nimport { DefaultGlobalPickerService } from './global-picker-service';\n// import { DefaultCanvasPickerService } from './canvas-picker-service';\n// import { DefaultMathPickerService } from './math-picker-service';\nimport {\n Canvas3DPickItemInterceptor,\n InteractivePickItemInterceptorContribution,\n PickItemInterceptor,\n ShadowRootPickItemInterceptorContribution\n} from './pick-interceptor';\nimport { bindContributionProvider } from '../common/contribution-provider';\n\nexport default new ContainerModule((bind, unbind, isBound) => {\n if (!isBound(PickerService)) {\n bind(GlobalPickerService).toSelf();\n bind(PickerService).toService(GlobalPickerService);\n }\n // bind(PickerService).toService(GlobalPickerService);\n\n // bind(DefaultGlobalPickerService).toSelf().inSingletonScope();\n // bind(GlobalPickerService).toService(DefaultGlobalPickerService);\n\n // interceptor\n bind(Canvas3DPickItemInterceptor).toSelf().inSingletonScope();\n bind(PickItemInterceptor).toService(Canvas3DPickItemInterceptor);\n\n // shadow root\n bind(ShadowRootPickItemInterceptorContribution).toSelf().inSingletonScope();\n bind(PickItemInterceptor).toService(ShadowRootPickItemInterceptorContribution);\n\n // interactive\n bind(InteractivePickItemInterceptorContribution).toSelf().inSingletonScope();\n bind(PickItemInterceptor).toService(InteractivePickItemInterceptorContribution);\n bindContributionProvider(bind, PickItemInterceptor);\n});\n"]}
1
+ {"version":3,"sources":["../src/picker/pick-modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAI9G,OAAO,EACL,2BAA2B,EAC3B,0CAA0C,EAC1C,wCAAwC,EACxC,yCAAyC,EAC1C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,eAAe,IAAI,eAAe,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;IAC3D,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QAC3B,IAAI,CAAC,mBAAmB,CAAC,CAAC,MAAM,EAAE,CAAC;QACnC,IAAI,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;KACpD;IAOD,IAAI,CAAC,2BAA2B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC9D,IAAI,CAAC,mBAAmB,CAAC,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;IAGjE,IAAI,CAAC,yCAAyC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC5E,IAAI,CAAC,mBAAmB,CAAC,CAAC,SAAS,CAAC,yCAAyC,CAAC,CAAC;IAG/E,IAAI,CAAC,0CAA0C,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC7E,IAAI,CAAC,mBAAmB,CAAC,CAAC,SAAS,CAAC,0CAA0C,CAAC,CAAC;IAChF,wBAAwB,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IAEpD,IAAI,CAAC,wCAAwC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC3E,IAAI,CAAC,sBAAsB,CAAC,CAAC,SAAS,CAAC,wCAAwC,CAAC,CAAC;IAEjF,wBAAwB,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;AACzD,CAAC,CAAC,CAAC","file":"pick-modules.js","sourcesContent":["import { ContainerModule } from '../common/inversify-lite';\nimport { PickerService, GlobalPickerService, PickItemInterceptor, PickServiceInterceptor } from './constants';\nimport { DefaultGlobalPickerService } from './global-picker-service';\n// import { DefaultCanvasPickerService } from './canvas-picker-service';\n// import { DefaultMathPickerService } from './math-picker-service';\nimport {\n Canvas3DPickItemInterceptor,\n InteractivePickItemInterceptorContribution,\n ShadowPickServiceInterceptorContribution,\n ShadowRootPickItemInterceptorContribution\n} from './pick-interceptor';\nimport { bindContributionProvider } from '../common/contribution-provider';\n\nexport default new ContainerModule((bind, unbind, isBound) => {\n if (!isBound(PickerService)) {\n bind(GlobalPickerService).toSelf();\n bind(PickerService).toService(GlobalPickerService);\n }\n // bind(PickerService).toService(GlobalPickerService);\n\n // bind(DefaultGlobalPickerService).toSelf().inSingletonScope();\n // bind(GlobalPickerService).toService(DefaultGlobalPickerService);\n\n // interceptor\n bind(Canvas3DPickItemInterceptor).toSelf().inSingletonScope();\n bind(PickItemInterceptor).toService(Canvas3DPickItemInterceptor);\n\n // shadow root\n bind(ShadowRootPickItemInterceptorContribution).toSelf().inSingletonScope();\n bind(PickItemInterceptor).toService(ShadowRootPickItemInterceptorContribution);\n\n // interactive\n bind(InteractivePickItemInterceptorContribution).toSelf().inSingletonScope();\n bind(PickItemInterceptor).toService(InteractivePickItemInterceptorContribution);\n bindContributionProvider(bind, PickItemInterceptor);\n\n bind(ShadowPickServiceInterceptorContribution).toSelf().inSingletonScope();\n bind(PickServiceInterceptor).toService(ShadowPickServiceInterceptorContribution);\n\n bindContributionProvider(bind, PickServiceInterceptor);\n});\n"]}
@@ -1,13 +1,15 @@
1
1
  import type { IMatrix, IPoint, IPointLike } from '@visactor/vutils';
2
- import type { IContext2d, IGraphic, IGroup, EnvType, IGlobal, IPickerService, IGraphicPicker, IPickParams, PickResult, IPickItemInterceptorContribution, IContributionProvider } from '../interface';
2
+ import type { IContext2d, IGraphic, IGroup, EnvType, IGlobal, IPickerService, IGraphicPicker, IPickParams, PickResult, IPickItemInterceptorContribution, IContributionProvider, IPickServiceInterceptorContribution } from '../interface';
3
3
  export declare abstract class DefaultPickService implements IPickerService {
4
4
  protected readonly pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>;
5
+ protected readonly pickServiceInterceptorContributions: IContributionProvider<IPickServiceInterceptorContribution>;
5
6
  type: string;
6
7
  pickerMap: Map<number, IGraphicPicker>;
7
8
  pickContext?: IContext2d;
8
9
  InterceptorContributions: IPickItemInterceptorContribution[];
10
+ pickerServiceInterceptorContributions: IPickServiceInterceptorContribution[];
9
11
  global: IGlobal;
10
- constructor(pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>);
12
+ constructor(pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>, pickServiceInterceptorContributions: IContributionProvider<IPickServiceInterceptorContribution>);
11
13
  protected _init(): void;
12
14
  abstract configure(global: IGlobal, env: EnvType): void;
13
15
  pick(graphics: IGraphic[], point: IPoint, params: IPickParams): PickResult;
@@ -26,17 +26,18 @@ import { mat3Tomat4, multiplyMat4Mat4 } from "../common/matrix";
26
26
 
27
27
  import { mat4Allocate, matrixAllocate } from "../allocator/matrix-allocate";
28
28
 
29
- import { PickItemInterceptor } from "./pick-interceptor";
30
-
31
29
  import { application } from "../application";
32
30
 
31
+ import { PickItemInterceptor, PickServiceInterceptor } from "./constants";
32
+
33
33
  let DefaultPickService = class {
34
- constructor(pickItemInterceptorContributions) {
35
- this.pickItemInterceptorContributions = pickItemInterceptorContributions, this.type = "default",
36
- this.global = application.global;
34
+ constructor(pickItemInterceptorContributions, pickServiceInterceptorContributions) {
35
+ this.pickItemInterceptorContributions = pickItemInterceptorContributions, this.pickServiceInterceptorContributions = pickServiceInterceptorContributions,
36
+ this.type = "default", this.global = application.global;
37
37
  }
38
38
  _init() {
39
- this.InterceptorContributions = this.pickItemInterceptorContributions.getContributions().sort(((a, b) => a.order - b.order));
39
+ this.InterceptorContributions = this.pickItemInterceptorContributions.getContributions().sort(((a, b) => a.order - b.order)),
40
+ this.pickerServiceInterceptorContributions = this.pickServiceInterceptorContributions.getContributions().sort(((a, b) => a.order - b.order));
40
41
  }
41
42
  pick(graphics, point, params) {
42
43
  let result = {
@@ -53,12 +54,11 @@ let DefaultPickService = class {
53
54
  for (let i = graphics.length - 1; i >= 0 && (result = graphics[i].isContainer ? this.pickGroup(graphics[i], point, parentMatrix, params) : this.pickItem(graphics[i], point, parentMatrix, params),
54
55
  !result.graphic); i--) group || (group = result.group);
55
56
  if (result.graphic || (result.group = group), this.pickContext && (this.pickContext.inuse = !1),
56
- result.graphic) {
57
- let g = result.graphic;
58
- for (;g.parent; ) g = g.parent;
59
- g.shadowHost && (result.params = {
60
- shadowTarget: result.graphic
61
- }, result.graphic = g.shadowHost);
57
+ this.pickerServiceInterceptorContributions.length) for (let i = 0; i < this.pickerServiceInterceptorContributions.length; i++) {
58
+ const drawContribution = this.pickerServiceInterceptorContributions[i];
59
+ drawContribution.afterPickItem && (result = drawContribution.afterPickItem(result, this, point, params, {
60
+ parentMatrix: parentMatrix
61
+ }));
62
62
  }
63
63
  return result;
64
64
  }
@@ -126,7 +126,7 @@ let DefaultPickService = class {
126
126
  }
127
127
  };
128
128
 
129
- DefaultPickService = __decorate([ injectable(), __param(0, inject(ContributionProvider)), __param(0, named(PickItemInterceptor)), __metadata("design:paramtypes", [ Object ]) ], DefaultPickService);
129
+ DefaultPickService = __decorate([ injectable(), __param(0, inject(ContributionProvider)), __param(0, named(PickItemInterceptor)), __param(1, inject(ContributionProvider)), __param(1, named(PickServiceInterceptor)), __metadata("design:paramtypes", [ Object, Object ]) ], DefaultPickService);
130
130
 
131
131
  export { DefaultPickService };
132
132
  //# sourceMappingURL=picker-service.js.map