@visactor/vrender-core 1.0.0-alpha.2 → 1.0.0-alpha.20

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 (468) hide show
  1. package/cjs/animate/config.d.ts +1 -2
  2. package/cjs/animate/config.js +1 -5
  3. package/cjs/animate/config.js.map +1 -1
  4. package/cjs/application.d.ts +2 -1
  5. package/cjs/application.js.map +1 -1
  6. package/cjs/color-string/interpolate.js +5 -2
  7. package/cjs/color-string/interpolate.js.map +1 -1
  8. package/cjs/common/canvas-utils.js +6 -3
  9. package/cjs/common/canvas-utils.js.map +1 -1
  10. package/cjs/common/contribution-provider.d.ts +16 -0
  11. package/cjs/common/contribution-provider.js +21 -2
  12. package/cjs/common/contribution-provider.js.map +1 -1
  13. package/cjs/common/custom-path2d.js +2 -2
  14. package/cjs/common/custom-path2d.js.map +1 -1
  15. package/cjs/common/event-listener-manager.d.ts +14 -0
  16. package/cjs/common/event-listener-manager.js +52 -0
  17. package/cjs/common/event-listener-manager.js.map +1 -0
  18. package/cjs/common/event-transformer.d.ts +12 -0
  19. package/cjs/common/event-transformer.js +91 -0
  20. package/cjs/common/event-transformer.js.map +1 -0
  21. package/cjs/common/morphing-utils.js +32 -124
  22. package/cjs/common/morphing-utils.js.map +1 -1
  23. package/cjs/common/performance-raf.js +4 -4
  24. package/cjs/common/performance-raf.js.map +1 -1
  25. package/cjs/common/polygon.js +4 -2
  26. package/cjs/common/polygon.js.map +1 -1
  27. package/cjs/common/segment/curve/cubic-bezier.d.ts +1 -2
  28. package/cjs/common/segment/curve/cubic-bezier.js +3 -8
  29. package/cjs/common/segment/curve/cubic-bezier.js.map +1 -1
  30. package/cjs/common/segment/curve/quadratic-bezier.d.ts +1 -0
  31. package/cjs/common/segment/curve/quadratic-bezier.js +10 -3
  32. package/cjs/common/segment/curve/quadratic-bezier.js.map +1 -1
  33. package/cjs/common/segment/index.d.ts +1 -0
  34. package/cjs/common/segment/index.js +4 -1
  35. package/cjs/common/segment/index.js.map +1 -1
  36. package/cjs/common/segment/step.d.ts +6 -0
  37. package/cjs/common/segment/step.js +19 -2
  38. package/cjs/common/segment/step.js.map +1 -1
  39. package/cjs/common/shape/arc.d.ts +1 -1
  40. package/cjs/common/shape/arc.js +7 -3
  41. package/cjs/common/shape/arc.js.map +1 -1
  42. package/cjs/common/simplify.js +1 -2
  43. package/cjs/common/split-path.js +3 -2
  44. package/cjs/common/split-path.js.map +1 -1
  45. package/cjs/common/utils.d.ts +0 -2
  46. package/cjs/common/utils.js +4 -8
  47. package/cjs/common/utils.js.map +1 -1
  48. package/cjs/core/constants.js +1 -1
  49. package/cjs/core/core-modules.js +1 -1
  50. package/cjs/core/global.d.ts +7 -5
  51. package/cjs/core/global.js +14 -13
  52. package/cjs/core/global.js.map +1 -1
  53. package/cjs/core/stage.d.ts +6 -2
  54. package/cjs/core/stage.js +22 -10
  55. package/cjs/core/stage.js.map +1 -1
  56. package/cjs/core/window.d.ts +5 -4
  57. package/cjs/core/window.js +14 -13
  58. package/cjs/core/window.js.map +1 -1
  59. package/cjs/event/event-system.js +11 -10
  60. package/cjs/event/event-system.js.map +1 -1
  61. package/cjs/graphic/arc.d.ts +1 -2
  62. package/cjs/graphic/arc.js +4 -3
  63. package/cjs/graphic/arc.js.map +1 -1
  64. package/cjs/graphic/area.d.ts +1 -2
  65. package/cjs/graphic/area.js +5 -2
  66. package/cjs/graphic/area.js.map +1 -1
  67. package/cjs/graphic/circle.d.ts +1 -2
  68. package/cjs/graphic/circle.js +7 -3
  69. package/cjs/graphic/circle.js.map +1 -1
  70. package/cjs/graphic/config.d.ts +2 -1
  71. package/cjs/graphic/config.js +10 -3
  72. package/cjs/graphic/config.js.map +1 -1
  73. package/cjs/graphic/constants.d.ts +1 -0
  74. package/cjs/graphic/constants.js +4 -3
  75. package/cjs/graphic/constants.js.map +1 -1
  76. package/cjs/graphic/graphic-service/graphic-module.js +1 -2
  77. package/cjs/graphic/graphic-service/graphic-module.js.map +1 -1
  78. package/cjs/graphic/graphic-service/graphic-service.js +2 -3
  79. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  80. package/cjs/graphic/graphic.d.ts +8 -1
  81. package/cjs/graphic/graphic.js +32 -20
  82. package/cjs/graphic/graphic.js.map +1 -1
  83. package/cjs/graphic/group.js +8 -8
  84. package/cjs/graphic/group.js.map +1 -1
  85. package/cjs/graphic/image.js +2 -1
  86. package/cjs/graphic/image.js.map +1 -1
  87. package/cjs/graphic/index.d.ts +1 -0
  88. package/cjs/graphic/index.js +8 -8
  89. package/cjs/graphic/index.js.map +1 -1
  90. package/cjs/graphic/line.d.ts +1 -2
  91. package/cjs/graphic/line.js +7 -2
  92. package/cjs/graphic/line.js.map +1 -1
  93. package/cjs/graphic/path.js +2 -1
  94. package/cjs/graphic/path.js.map +1 -1
  95. package/cjs/graphic/polygon.js +2 -1
  96. package/cjs/graphic/polygon.js.map +1 -1
  97. package/cjs/graphic/rect.js +7 -3
  98. package/cjs/graphic/rect.js.map +1 -1
  99. package/cjs/graphic/richtext/icon.d.ts +1 -1
  100. package/cjs/graphic/richtext/icon.js.map +1 -1
  101. package/cjs/graphic/richtext.js +3 -2
  102. package/cjs/graphic/richtext.js.map +1 -1
  103. package/cjs/graphic/star.d.ts +52 -0
  104. package/cjs/graphic/star.js +78 -0
  105. package/cjs/graphic/star.js.map +1 -0
  106. package/cjs/graphic/symbol.js +3 -1
  107. package/cjs/graphic/symbol.js.map +1 -1
  108. package/cjs/graphic/text.js +1 -0
  109. package/cjs/graphic/text.js.map +1 -1
  110. package/cjs/graphic/theme.js +2 -0
  111. package/cjs/graphic/theme.js.map +1 -1
  112. package/cjs/index.d.ts +4 -0
  113. package/cjs/index.js +10 -9
  114. package/cjs/index.js.map +1 -1
  115. package/cjs/interface/animation/animate.d.ts +17 -0
  116. package/cjs/interface/animation/animate.js.map +1 -1
  117. package/cjs/interface/animation/ticker.d.ts +2 -0
  118. package/cjs/interface/animation/ticker.js.map +1 -1
  119. package/cjs/interface/common.d.ts +1 -1
  120. package/cjs/interface/common.js.map +1 -1
  121. package/cjs/interface/contribution.d.ts +2 -0
  122. package/cjs/interface/contribution.js.map +1 -1
  123. package/cjs/interface/event-listener-manager.d.ts +7 -0
  124. package/cjs/interface/event-listener-manager.js +6 -0
  125. package/cjs/interface/event-listener-manager.js.map +1 -0
  126. package/cjs/interface/global.d.ts +2 -1
  127. package/cjs/interface/global.js.map +1 -1
  128. package/cjs/interface/graphic/index.d.ts +1 -0
  129. package/cjs/interface/graphic/index.js +3 -2
  130. package/cjs/interface/graphic/index.js.map +1 -1
  131. package/cjs/interface/graphic/star.d.ts +12 -0
  132. package/cjs/interface/graphic/star.js +6 -0
  133. package/cjs/interface/graphic/star.js.map +1 -0
  134. package/cjs/interface/graphic/theme.d.ts +3 -0
  135. package/cjs/interface/graphic/theme.js.map +1 -1
  136. package/cjs/interface/graphic.d.ts +12 -1
  137. package/cjs/interface/graphic.js.map +1 -1
  138. package/cjs/interface/picker.d.ts +1 -0
  139. package/cjs/interface/picker.js.map +1 -1
  140. package/cjs/interface/render.d.ts +4 -0
  141. package/cjs/interface/render.js.map +1 -1
  142. package/cjs/interface/stage.d.ts +2 -0
  143. package/cjs/interface/stage.js.map +1 -1
  144. package/cjs/interface/window.d.ts +1 -0
  145. package/cjs/interface/window.js.map +1 -1
  146. package/cjs/modules.d.ts +2 -1
  147. package/cjs/modules.js +4 -3
  148. package/cjs/modules.js.map +1 -1
  149. package/cjs/picker/global-picker-service.d.ts +1 -0
  150. package/cjs/picker/global-picker-service.js +1 -0
  151. package/cjs/picker/global-picker-service.js.map +1 -1
  152. package/cjs/picker/picker-service.d.ts +1 -0
  153. package/cjs/picker/picker-service.js +3 -0
  154. package/cjs/picker/picker-service.js.map +1 -1
  155. package/cjs/plugins/builtin-plugin/auto-render-plugin.js +9 -8
  156. package/cjs/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
  157. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +14 -11
  158. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  159. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +13 -10
  160. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  161. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +0 -1
  162. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  163. package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js +8 -5
  164. package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js.map +1 -1
  165. package/cjs/register/register-star.d.ts +1 -0
  166. package/cjs/register/register-star.js +14 -0
  167. package/cjs/register/register-star.js.map +1 -0
  168. package/cjs/render/contributions/render/arc-render.d.ts +2 -2
  169. package/cjs/render/contributions/render/arc-render.js +7 -7
  170. package/cjs/render/contributions/render/arc-render.js.map +1 -1
  171. package/cjs/render/contributions/render/area-render.d.ts +2 -2
  172. package/cjs/render/contributions/render/area-render.js +5 -5
  173. package/cjs/render/contributions/render/area-render.js.map +1 -1
  174. package/cjs/render/contributions/render/base-render.d.ts +2 -0
  175. package/cjs/render/contributions/render/base-render.js +3 -0
  176. package/cjs/render/contributions/render/base-render.js.map +1 -1
  177. package/cjs/render/contributions/render/circle-render.d.ts +2 -2
  178. package/cjs/render/contributions/render/circle-render.js +3 -3
  179. package/cjs/render/contributions/render/circle-render.js.map +1 -1
  180. package/cjs/render/contributions/render/contributions/constants.d.ts +1 -0
  181. package/cjs/render/contributions/render/contributions/constants.js +3 -2
  182. package/cjs/render/contributions/render/contributions/constants.js.map +1 -1
  183. package/cjs/render/contributions/render/contributions/index.d.ts +1 -0
  184. package/cjs/render/contributions/render/contributions/index.js +2 -2
  185. package/cjs/render/contributions/render/contributions/index.js.map +1 -1
  186. package/cjs/render/contributions/render/contributions/star-contribution-render.d.ts +2 -0
  187. package/cjs/render/contributions/render/contributions/star-contribution-render.js +11 -0
  188. package/cjs/render/contributions/render/contributions/star-contribution-render.js.map +1 -0
  189. package/cjs/render/contributions/render/draw-contribution.d.ts +1 -0
  190. package/cjs/render/contributions/render/draw-contribution.js +6 -1
  191. package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
  192. package/cjs/render/contributions/render/draw-interceptor.js +2 -2
  193. package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
  194. package/cjs/render/contributions/render/glyph-render.d.ts +1 -0
  195. package/cjs/render/contributions/render/glyph-render.js +1 -0
  196. package/cjs/render/contributions/render/glyph-render.js.map +1 -1
  197. package/cjs/render/contributions/render/graphic-render.d.ts +1 -0
  198. package/cjs/render/contributions/render/graphic-render.js.map +1 -1
  199. package/cjs/render/contributions/render/group-render.d.ts +1 -0
  200. package/cjs/render/contributions/render/group-render.js +8 -4
  201. package/cjs/render/contributions/render/group-render.js.map +1 -1
  202. package/cjs/render/contributions/render/image-render.d.ts +2 -2
  203. package/cjs/render/contributions/render/image-render.js +3 -3
  204. package/cjs/render/contributions/render/image-render.js.map +1 -1
  205. package/cjs/render/contributions/render/line-render.js +1 -1
  206. package/cjs/render/contributions/render/line-render.js.map +1 -1
  207. package/cjs/render/contributions/render/path-render.d.ts +2 -2
  208. package/cjs/render/contributions/render/path-render.js +3 -3
  209. package/cjs/render/contributions/render/path-render.js.map +1 -1
  210. package/cjs/render/contributions/render/polygon-render.d.ts +2 -2
  211. package/cjs/render/contributions/render/polygon-render.js +3 -3
  212. package/cjs/render/contributions/render/polygon-render.js.map +1 -1
  213. package/cjs/render/contributions/render/rect-render.d.ts +2 -2
  214. package/cjs/render/contributions/render/rect-render.js +3 -3
  215. package/cjs/render/contributions/render/rect-render.js.map +1 -1
  216. package/cjs/render/contributions/render/star-module.d.ts +2 -0
  217. package/cjs/render/contributions/render/star-module.js +15 -0
  218. package/cjs/render/contributions/render/star-module.js.map +1 -0
  219. package/cjs/render/contributions/render/star-render.d.ts +10 -0
  220. package/cjs/render/contributions/render/star-render.js +54 -0
  221. package/cjs/render/contributions/render/star-render.js.map +1 -0
  222. package/cjs/render/contributions/render/symbol-render.d.ts +2 -2
  223. package/cjs/render/contributions/render/symbol-render.js +3 -3
  224. package/cjs/render/contributions/render/symbol-render.js.map +1 -1
  225. package/cjs/render/contributions/render/symbol.d.ts +1 -0
  226. package/cjs/render/contributions/render/symbol.js +2 -2
  227. package/cjs/render/contributions/render/symbol.js.map +1 -1
  228. package/cjs/render/contributions/render/text-render.d.ts +2 -2
  229. package/cjs/render/contributions/render/text-render.js +3 -3
  230. package/cjs/render/contributions/render/text-render.js.map +1 -1
  231. package/cjs/render/render-service.d.ts +2 -1
  232. package/cjs/render/render-service.js +3 -0
  233. package/cjs/render/render-service.js.map +1 -1
  234. package/dist/index.es.js +12652 -12222
  235. package/es/animate/config.d.ts +1 -2
  236. package/es/animate/config.js +0 -5
  237. package/es/animate/config.js.map +1 -1
  238. package/es/application.d.ts +2 -1
  239. package/es/application.js.map +1 -1
  240. package/es/color-string/interpolate.js +4 -1
  241. package/es/color-string/interpolate.js.map +1 -1
  242. package/es/common/canvas-utils.js +6 -3
  243. package/es/common/canvas-utils.js.map +1 -1
  244. package/es/common/contribution-provider.d.ts +16 -0
  245. package/es/common/contribution-provider.js +20 -1
  246. package/es/common/contribution-provider.js.map +1 -1
  247. package/es/common/custom-path2d.js +2 -2
  248. package/es/common/custom-path2d.js.map +1 -1
  249. package/es/common/event-listener-manager.d.ts +14 -0
  250. package/es/common/event-listener-manager.js +44 -0
  251. package/es/common/event-listener-manager.js.map +1 -0
  252. package/es/common/event-transformer.d.ts +12 -0
  253. package/es/common/event-transformer.js +81 -0
  254. package/es/common/event-transformer.js.map +1 -0
  255. package/es/common/morphing-utils.js +29 -124
  256. package/es/common/morphing-utils.js.map +1 -1
  257. package/es/common/performance-raf.js +4 -4
  258. package/es/common/performance-raf.js.map +1 -1
  259. package/es/common/polygon.js +4 -2
  260. package/es/common/polygon.js.map +1 -1
  261. package/es/common/segment/curve/cubic-bezier.d.ts +1 -2
  262. package/es/common/segment/curve/cubic-bezier.js +1 -8
  263. package/es/common/segment/curve/cubic-bezier.js.map +1 -1
  264. package/es/common/segment/curve/quadratic-bezier.d.ts +1 -0
  265. package/es/common/segment/curve/quadratic-bezier.js +5 -2
  266. package/es/common/segment/curve/quadratic-bezier.js.map +1 -1
  267. package/es/common/segment/index.d.ts +1 -0
  268. package/es/common/segment/index.js +6 -1
  269. package/es/common/segment/index.js.map +1 -1
  270. package/es/common/segment/step.d.ts +6 -0
  271. package/es/common/segment/step.js +13 -0
  272. package/es/common/segment/step.js.map +1 -1
  273. package/es/common/shape/arc.d.ts +1 -1
  274. package/es/common/shape/arc.js +7 -3
  275. package/es/common/shape/arc.js.map +1 -1
  276. package/es/common/simplify.js +1 -2
  277. package/es/common/split-path.js +3 -2
  278. package/es/common/split-path.js.map +1 -1
  279. package/es/common/utils.d.ts +0 -2
  280. package/es/common/utils.js +0 -4
  281. package/es/common/utils.js.map +1 -1
  282. package/es/core/constants.js +1 -1
  283. package/es/core/core-modules.js +1 -1
  284. package/es/core/global.d.ts +7 -5
  285. package/es/core/global.js +15 -12
  286. package/es/core/global.js.map +1 -1
  287. package/es/core/stage.d.ts +6 -2
  288. package/es/core/stage.js +23 -9
  289. package/es/core/stage.js.map +1 -1
  290. package/es/core/window.d.ts +5 -4
  291. package/es/core/window.js +15 -12
  292. package/es/core/window.js.map +1 -1
  293. package/es/event/event-system.js +11 -10
  294. package/es/event/event-system.js.map +1 -1
  295. package/es/graphic/arc.d.ts +1 -2
  296. package/es/graphic/arc.js +4 -3
  297. package/es/graphic/arc.js.map +1 -1
  298. package/es/graphic/area.d.ts +1 -2
  299. package/es/graphic/area.js +5 -2
  300. package/es/graphic/area.js.map +1 -1
  301. package/es/graphic/circle.d.ts +1 -2
  302. package/es/graphic/circle.js +6 -3
  303. package/es/graphic/circle.js.map +1 -1
  304. package/es/graphic/config.d.ts +2 -1
  305. package/es/graphic/config.js +11 -2
  306. package/es/graphic/config.js.map +1 -1
  307. package/es/graphic/constants.d.ts +1 -0
  308. package/es/graphic/constants.js +2 -0
  309. package/es/graphic/constants.js.map +1 -1
  310. package/es/graphic/graphic-service/graphic-module.js +1 -1
  311. package/es/graphic/graphic-service/graphic-module.js.map +1 -1
  312. package/es/graphic/graphic-service/graphic-service.js +1 -4
  313. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  314. package/es/graphic/graphic.d.ts +8 -1
  315. package/es/graphic/graphic.js +33 -19
  316. package/es/graphic/graphic.js.map +1 -1
  317. package/es/graphic/group.js +7 -7
  318. package/es/graphic/group.js.map +1 -1
  319. package/es/graphic/image.js +2 -1
  320. package/es/graphic/image.js.map +1 -1
  321. package/es/graphic/index.d.ts +1 -0
  322. package/es/graphic/index.js +2 -0
  323. package/es/graphic/index.js.map +1 -1
  324. package/es/graphic/line.d.ts +1 -2
  325. package/es/graphic/line.js +7 -2
  326. package/es/graphic/line.js.map +1 -1
  327. package/es/graphic/path.js +2 -1
  328. package/es/graphic/path.js.map +1 -1
  329. package/es/graphic/polygon.js +2 -1
  330. package/es/graphic/polygon.js.map +1 -1
  331. package/es/graphic/rect.js +7 -3
  332. package/es/graphic/rect.js.map +1 -1
  333. package/es/graphic/richtext/icon.d.ts +1 -1
  334. package/es/graphic/richtext/icon.js.map +1 -1
  335. package/es/graphic/richtext.js +3 -2
  336. package/es/graphic/richtext.js.map +1 -1
  337. package/es/graphic/star.d.ts +52 -0
  338. package/es/graphic/star.js +82 -0
  339. package/es/graphic/star.js.map +1 -0
  340. package/es/graphic/symbol.js +3 -1
  341. package/es/graphic/symbol.js.map +1 -1
  342. package/es/graphic/text.js +1 -0
  343. package/es/graphic/text.js.map +1 -1
  344. package/es/graphic/theme.js +3 -1
  345. package/es/graphic/theme.js.map +1 -1
  346. package/es/index.d.ts +4 -0
  347. package/es/index.js +8 -0
  348. package/es/index.js.map +1 -1
  349. package/es/interface/animation/animate.d.ts +17 -0
  350. package/es/interface/animation/animate.js.map +1 -1
  351. package/es/interface/animation/ticker.d.ts +2 -0
  352. package/es/interface/animation/ticker.js.map +1 -1
  353. package/es/interface/common.d.ts +1 -1
  354. package/es/interface/common.js.map +1 -1
  355. package/es/interface/contribution.d.ts +2 -0
  356. package/es/interface/contribution.js.map +1 -1
  357. package/es/interface/event-listener-manager.d.ts +7 -0
  358. package/es/interface/event-listener-manager.js +2 -0
  359. package/es/interface/event-listener-manager.js.map +1 -0
  360. package/es/interface/global.d.ts +2 -1
  361. package/es/interface/global.js.map +1 -1
  362. package/es/interface/graphic/index.d.ts +1 -0
  363. package/es/interface/graphic/index.js +2 -0
  364. package/es/interface/graphic/index.js.map +1 -1
  365. package/es/interface/graphic/star.d.ts +12 -0
  366. package/es/interface/graphic/star.js +2 -0
  367. package/es/interface/graphic/star.js.map +1 -0
  368. package/es/interface/graphic/theme.d.ts +3 -0
  369. package/es/interface/graphic/theme.js.map +1 -1
  370. package/es/interface/graphic.d.ts +12 -1
  371. package/es/interface/graphic.js.map +1 -1
  372. package/es/interface/picker.d.ts +1 -0
  373. package/es/interface/picker.js.map +1 -1
  374. package/es/interface/render.d.ts +4 -0
  375. package/es/interface/render.js.map +1 -1
  376. package/es/interface/stage.d.ts +2 -0
  377. package/es/interface/stage.js.map +1 -1
  378. package/es/interface/window.d.ts +1 -0
  379. package/es/interface/window.js.map +1 -1
  380. package/es/modules.d.ts +2 -1
  381. package/es/modules.js +6 -0
  382. package/es/modules.js.map +1 -1
  383. package/es/picker/global-picker-service.d.ts +1 -0
  384. package/es/picker/global-picker-service.js +1 -0
  385. package/es/picker/global-picker-service.js.map +1 -1
  386. package/es/picker/picker-service.d.ts +1 -0
  387. package/es/picker/picker-service.js +3 -0
  388. package/es/picker/picker-service.js.map +1 -1
  389. package/es/plugins/builtin-plugin/auto-render-plugin.js +8 -8
  390. package/es/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
  391. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +13 -12
  392. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  393. package/es/plugins/builtin-plugin/flex-layout-plugin.js +12 -11
  394. package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  395. package/es/plugins/builtin-plugin/html-attribute-plugin.js +0 -1
  396. package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  397. package/es/plugins/builtin-plugin/incremental-auto-render-plugin.js +8 -5
  398. package/es/plugins/builtin-plugin/incremental-auto-render-plugin.js.map +1 -1
  399. package/es/register/register-star.d.ts +1 -0
  400. package/es/register/register-star.js +8 -0
  401. package/es/register/register-star.js.map +1 -0
  402. package/es/render/contributions/render/arc-render.d.ts +2 -2
  403. package/es/render/contributions/render/arc-render.js +7 -7
  404. package/es/render/contributions/render/arc-render.js.map +1 -1
  405. package/es/render/contributions/render/area-render.d.ts +2 -2
  406. package/es/render/contributions/render/area-render.js +5 -5
  407. package/es/render/contributions/render/area-render.js.map +1 -1
  408. package/es/render/contributions/render/base-render.d.ts +2 -0
  409. package/es/render/contributions/render/base-render.js +3 -0
  410. package/es/render/contributions/render/base-render.js.map +1 -1
  411. package/es/render/contributions/render/circle-render.d.ts +2 -2
  412. package/es/render/contributions/render/circle-render.js +3 -3
  413. package/es/render/contributions/render/circle-render.js.map +1 -1
  414. package/es/render/contributions/render/contributions/constants.d.ts +1 -0
  415. package/es/render/contributions/render/contributions/constants.js +2 -0
  416. package/es/render/contributions/render/contributions/constants.js.map +1 -1
  417. package/es/render/contributions/render/contributions/index.d.ts +1 -0
  418. package/es/render/contributions/render/contributions/index.js +2 -0
  419. package/es/render/contributions/render/contributions/index.js.map +1 -1
  420. package/es/render/contributions/render/contributions/star-contribution-render.d.ts +2 -0
  421. package/es/render/contributions/render/contributions/star-contribution-render.js +8 -0
  422. package/es/render/contributions/render/contributions/star-contribution-render.js.map +1 -0
  423. package/es/render/contributions/render/draw-contribution.d.ts +1 -0
  424. package/es/render/contributions/render/draw-contribution.js +6 -1
  425. package/es/render/contributions/render/draw-contribution.js.map +1 -1
  426. package/es/render/contributions/render/draw-interceptor.js +2 -2
  427. package/es/render/contributions/render/draw-interceptor.js.map +1 -1
  428. package/es/render/contributions/render/glyph-render.d.ts +1 -0
  429. package/es/render/contributions/render/glyph-render.js +1 -0
  430. package/es/render/contributions/render/glyph-render.js.map +1 -1
  431. package/es/render/contributions/render/graphic-render.d.ts +1 -0
  432. package/es/render/contributions/render/graphic-render.js.map +1 -1
  433. package/es/render/contributions/render/group-render.d.ts +1 -0
  434. package/es/render/contributions/render/group-render.js +8 -4
  435. package/es/render/contributions/render/group-render.js.map +1 -1
  436. package/es/render/contributions/render/image-render.d.ts +2 -2
  437. package/es/render/contributions/render/image-render.js +3 -3
  438. package/es/render/contributions/render/image-render.js.map +1 -1
  439. package/es/render/contributions/render/line-render.js +1 -1
  440. package/es/render/contributions/render/line-render.js.map +1 -1
  441. package/es/render/contributions/render/path-render.d.ts +2 -2
  442. package/es/render/contributions/render/path-render.js +3 -3
  443. package/es/render/contributions/render/path-render.js.map +1 -1
  444. package/es/render/contributions/render/polygon-render.d.ts +2 -2
  445. package/es/render/contributions/render/polygon-render.js +3 -3
  446. package/es/render/contributions/render/polygon-render.js.map +1 -1
  447. package/es/render/contributions/render/rect-render.d.ts +2 -2
  448. package/es/render/contributions/render/rect-render.js +3 -3
  449. package/es/render/contributions/render/rect-render.js.map +1 -1
  450. package/es/render/contributions/render/star-module.d.ts +2 -0
  451. package/es/render/contributions/render/star-module.js +13 -0
  452. package/es/render/contributions/render/star-module.js.map +1 -0
  453. package/es/render/contributions/render/star-render.d.ts +10 -0
  454. package/es/render/contributions/render/star-render.js +59 -0
  455. package/es/render/contributions/render/star-render.js.map +1 -0
  456. package/es/render/contributions/render/symbol-render.d.ts +2 -2
  457. package/es/render/contributions/render/symbol-render.js +3 -3
  458. package/es/render/contributions/render/symbol-render.js.map +1 -1
  459. package/es/render/contributions/render/symbol.d.ts +1 -0
  460. package/es/render/contributions/render/symbol.js +2 -0
  461. package/es/render/contributions/render/symbol.js.map +1 -1
  462. package/es/render/contributions/render/text-render.d.ts +2 -2
  463. package/es/render/contributions/render/text-render.js +3 -3
  464. package/es/render/contributions/render/text-render.js.map +1 -1
  465. package/es/render/render-service.d.ts +2 -1
  466. package/es/render/render-service.js +3 -0
  467. package/es/render/render-service.js.map +1 -1
  468. package/package.json +4 -4
@@ -18,6 +18,7 @@ let DefaultGlobalPickerService = class {
18
18
  this.configure(global, env);
19
19
  })), this.configure(this.global, this.global.env);
20
20
  }
21
+ reInit() {}
21
22
  configure(global, env) {}
22
23
  pick(graphics, point, params) {
23
24
  let result = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/picker/global-picker-service.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAU,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAW9D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKtC,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAMrC;QACE,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,uBAAuB,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE;YAC/E,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC/C,CAAC;IAED,SAAS,CAAC,MAAe,EAAE,GAAY;IAKvC,CAAC;IAID,IAAI,CAAC,QAAoB,EAAE,KAAiB,EAAE,MAAoB;QAChE,IAAI,MAAM,GAAe;YACvB,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,IAAI;SACZ,CAAC;QACF,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAA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AE,YAAY,EAAE,MAAM,CAAC,CAAC;iBACzE;qBAAM;oBACL,MAAM,QAAQ,GAAW,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;oBACrD,YAAY,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBAChD,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;oBACpE,IAAI,IAAI,EAAE;wBACR,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;wBAC9B,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;qBAC7B;iBACF;gBACD,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YAC5C,CAAC,CAAC,CAAC;SACJ;QAED,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,WAAW,EAAE;YACnD,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;SACtB;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAGD,QAAQ,CACN,OAAiB,EACjB,KAAiB,EACjB,YAA4B,EAC5B,MAAoB;QAEpB,IAAI,OAAO,CAAC,SAAS,CAAC,QAAQ,KAAK,KAAK,EAAE;YACxC,OAAO,IAAI,CAAC;SACb;QACD,IAAI,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;YAC3C,OAAO;gBACL,OAAO,EAAE,OAAO;aACjB,CAAC;SACH;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAtIY,0BAA0B;IADtC,UAAU,EAAE;;GACA,0BAA0B,CAsItC;SAtIY,0BAA0B","file":"global-picker-service.js","sourcesContent":["import type { IMatrix, IPoint, IPointLike } from '@visactor/vutils';\nimport { Matrix, Point } from '@visactor/vutils';\nimport { inject, injectable } from '../common/inversify-lite';\nimport type {\n IGraphic,\n IGroup,\n EnvType,\n IGlobal,\n IPickerService,\n IGraphicPicker,\n IPickParams,\n PickResult\n} from '../interface';\nimport { application } from '../application';\n\n// 默认的pick-service,提供基本的最优选中策略,尽量不需要用户自己实现contribution\n// 用户可以写plugin\n@injectable()\nexport class DefaultGlobalPickerService implements IPickerService {\n type: 'global';\n\n declare pickerMap: Map<number, IGraphicPicker>;\n declare global: IGlobal;\n\n constructor() {\n this.global = application.global;\n this.global.hooks.onSetEnv.tap('global-picker-service', (lastEnv, env, global) => {\n this.configure(global, env);\n });\n this.configure(this.global, this.global.env);\n }\n\n configure(global: IGlobal, env: EnvType) {\n // if (!this.global.env) return;\n // this.contributions.getContributions().forEach(handlerContribution => {\n // handlerContribution.configure(this, this.global);\n // });\n }\n\n // todo: params支持\n // todo: 性能优化\n pick(graphics: IGraphic[], point: IPointLike, params?: IPickParams): PickResult {\n let result: PickResult = {\n graphic: null,\n group: null\n };\n const parentMatrix = new Matrix(1, 0, 0, 1, 0, 0);\n let group: IGroup;\n for (let i = 0; i < graphics.length; i++) {\n if (graphics[i].isContainer) {\n result = this.pickGroup(graphics[i] as IGroup, point, parentMatrix, params);\n } else {\n const data = this.pickItem(graphics[i], point, parentMatrix, params);\n if (data) {\n result.graphic = data.graphic;\n result.params = data.params;\n }\n }\n if (result.graphic) {\n break;\n }\n if (!group) {\n group = result.group;\n }\n }\n if (!result.graphic) {\n result.group = group;\n }\n // 判断是否有shadow-dom\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 containsPoint(graphic: IGraphic, point: IPointLike, params?: IPickParams): boolean {\n return !!this.pickItem(graphic, point, null, params);\n }\n\n pickGroup(group: IGroup, point: IPointLike, parentMatrix: IMatrix, params?: IPickParams): PickResult {\n let result: PickResult = {\n group: null,\n graphic: null\n };\n if (group.attribute.visibleAll === false) {\n return result;\n }\n // 转换坐标空间\n const transMatrix = group.transMatrix;\n\n const newPoint: IPoint = new Point(point.x, point.y);\n parentMatrix.transformPoint(newPoint, newPoint);\n const insideGroup = group.AABBBounds.containsPoint(newPoint);\n // 如果group没有被选中,直接跳过\n if (!insideGroup) {\n return result;\n }\n // todo: 支持带有path的group的选中\n const groupPicked = group.attribute.pickable !== false && insideGroup;\n\n parentMatrix.multiply(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f);\n\n if (group.attribute.childrenPickable !== false) {\n group.forEachChildren((graphic: IGraphic) => {\n if (graphic.isContainer) {\n result = this.pickGroup(graphic as IGroup, point, parentMatrix, params);\n } else {\n const newPoint: IPoint = new Point(point.x, point.y);\n parentMatrix.transformPoint(newPoint, newPoint);\n const data = this.pickItem(graphic, newPoint, parentMatrix, params);\n if (data) {\n result.graphic = data.graphic;\n result.params = data.params;\n }\n }\n return !!result.graphic || !!result.group;\n });\n }\n\n if (!result.graphic && !result.group && groupPicked) {\n result.group = group;\n }\n\n return result;\n }\n\n // todo: switch统一改为数字map\n pickItem(\n graphic: IGraphic,\n point: IPointLike,\n parentMatrix: IMatrix | null,\n params?: IPickParams\n ): PickResult | null {\n if (graphic.attribute.pickable === false) {\n return null;\n }\n if (graphic.AABBBounds.containsPoint(point)) {\n return {\n graphic: graphic\n };\n }\n return null;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/picker/global-picker-service.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAU,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAW9D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKtC,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAMrC;QACE,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;QACjC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IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,WAAW,EAAE;YACnD,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;SACtB;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAGD,QAAQ,CACN,OAAiB,EACjB,KAAiB,EACjB,YAA4B,EAC5B,MAAoB;QAEpB,IAAI,OAAO,CAAC,SAAS,CAAC,QAAQ,KAAK,KAAK,EAAE;YACxC,OAAO,IAAI,CAAC;SACb;QACD,IAAI,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;YAC3C,OAAO;gBACL,OAAO,EAAE,OAAO;aACjB,CAAC;SACH;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AA1IY,0BAA0B;IADtC,UAAU,EAAE;;GACA,0BAA0B,CA0ItC;SA1IY,0BAA0B","file":"global-picker-service.js","sourcesContent":["import type { IMatrix, IPoint, IPointLike } from '@visactor/vutils';\nimport { Matrix, Point } from '@visactor/vutils';\nimport { inject, injectable } from '../common/inversify-lite';\nimport type {\n IGraphic,\n IGroup,\n EnvType,\n IGlobal,\n IPickerService,\n IGraphicPicker,\n IPickParams,\n PickResult\n} from '../interface';\nimport { application } from '../application';\n\n// 默认的pick-service,提供基本的最优选中策略,尽量不需要用户自己实现contribution\n// 用户可以写plugin\n@injectable()\nexport class DefaultGlobalPickerService implements IPickerService {\n type: 'global';\n\n declare pickerMap: Map<number, IGraphicPicker>;\n declare global: IGlobal;\n\n constructor() {\n this.global = application.global;\n this.global.hooks.onSetEnv.tap('global-picker-service', (lastEnv, env, global) => {\n this.configure(global, env);\n });\n this.configure(this.global, this.global.env);\n }\n\n reInit() {\n return;\n }\n\n configure(global: IGlobal, env: EnvType) {\n // if (!this.global.env) return;\n // this.contributions.getContributions().forEach(handlerContribution => {\n // handlerContribution.configure(this, this.global);\n // });\n }\n\n // todo: params支持\n // todo: 性能优化\n pick(graphics: IGraphic[], point: IPointLike, params?: IPickParams): PickResult {\n let result: PickResult = {\n graphic: null,\n group: null\n };\n const parentMatrix = new Matrix(1, 0, 0, 1, 0, 0);\n let group: IGroup;\n for (let i = 0; i < graphics.length; i++) {\n if (graphics[i].isContainer) {\n result = this.pickGroup(graphics[i] as IGroup, point, parentMatrix, params);\n } else {\n const data = this.pickItem(graphics[i], point, parentMatrix, params);\n if (data) {\n result.graphic = data.graphic;\n result.params = data.params;\n }\n }\n if (result.graphic) {\n break;\n }\n if (!group) {\n group = result.group;\n }\n }\n if (!result.graphic) {\n result.group = group;\n }\n // 判断是否有shadow-dom\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 containsPoint(graphic: IGraphic, point: IPointLike, params?: IPickParams): boolean {\n return !!this.pickItem(graphic, point, null, params);\n }\n\n pickGroup(group: IGroup, point: IPointLike, parentMatrix: IMatrix, params?: IPickParams): PickResult {\n let result: PickResult = {\n group: null,\n graphic: null\n };\n if (group.attribute.visibleAll === false) {\n return result;\n }\n // 转换坐标空间\n const transMatrix = group.transMatrix;\n\n const newPoint: IPoint = new Point(point.x, point.y);\n parentMatrix.transformPoint(newPoint, newPoint);\n const insideGroup = group.AABBBounds.containsPoint(newPoint);\n // 如果group没有被选中,直接跳过\n if (!insideGroup) {\n return result;\n }\n // todo: 支持带有path的group的选中\n const groupPicked = group.attribute.pickable !== false && insideGroup;\n\n parentMatrix.multiply(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f);\n\n if (group.attribute.childrenPickable !== false) {\n group.forEachChildren((graphic: IGraphic) => {\n if (graphic.isContainer) {\n result = this.pickGroup(graphic as IGroup, point, parentMatrix, params);\n } else {\n const newPoint: IPoint = new Point(point.x, point.y);\n parentMatrix.transformPoint(newPoint, newPoint);\n const data = this.pickItem(graphic, newPoint, parentMatrix, params);\n if (data) {\n result.graphic = data.graphic;\n result.params = data.params;\n }\n }\n return !!result.graphic || !!result.group;\n });\n }\n\n if (!result.graphic && !result.group && groupPicked) {\n result.group = group;\n }\n\n return result;\n }\n\n // todo: switch统一改为数字map\n pickItem(\n graphic: IGraphic,\n point: IPointLike,\n parentMatrix: IMatrix | null,\n params?: IPickParams\n ): PickResult | null {\n if (graphic.attribute.pickable === false) {\n return null;\n }\n if (graphic.AABBBounds.containsPoint(point)) {\n return {\n graphic: graphic\n };\n }\n return null;\n }\n}\n"]}
@@ -10,6 +10,7 @@ export declare abstract class DefaultPickService implements IPickerService {
10
10
  pickerServiceInterceptorContributions: IPickServiceInterceptorContribution[];
11
11
  global: IGlobal;
12
12
  constructor(pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>, pickServiceInterceptorContributions: IContributionProvider<IPickServiceInterceptorContribution>);
13
+ reInit(): void;
13
14
  protected _init(): void;
14
15
  abstract configure(global: IGlobal, env: EnvType): void;
15
16
  pick(graphics: IGraphic[], point: IPoint, params: IPickParams): PickResult;
@@ -35,6 +35,9 @@ let DefaultPickService = class {
35
35
  this.pickItemInterceptorContributions = pickItemInterceptorContributions, this.pickServiceInterceptorContributions = pickServiceInterceptorContributions,
36
36
  this.type = "default", this.global = application.global;
37
37
  }
38
+ reInit() {
39
+ this._init();
40
+ }
38
41
  _init() {
39
42
  this.InterceptorContributions = this.pickItemInterceptorContributions.getContributions().sort(((a, b) => a.order - b.order)),
40
43
  this.pickerServiceInterceptorContributions = this.pickServiceInterceptorContributions.getContributions().sort(((a, b) => a.order - b.order));
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/picker/picker-service.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE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AM,CAAC;qBACnC;iBACF;gBACD,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YAC5C,CAAC,EACD,IAAI,EACJ,CAAC,CAAC,OAAO,CAAC,MAAM,CACjB,CAAC;SACH;QACD,IAAI,OAAO,CAAC,WAAW,KAAK,UAAU,EAAE;YACtC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACxC;QACD,OAAO,CAAC,WAAW,GAAG,UAAU,CAAC;QAEjC,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,WAAW,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE;YAC1E,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;SACtB;QACD,cAAc,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACxC,OAAO,MAAM,CAAC;IAChB,CAAC;IAUS,YAAY,CAAC,OAAiB;QACtC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,IAAI,CAAC;SACb;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AA7OqB,kBAAkB;IADvC,UAAU,EAAE;IAYR,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAG1B,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,sBAAsB,CAAC,CAAA;;GAhBZ,kBAAkB,CA6OvC;SA7OqB,kBAAkB","file":"picker-service.js","sourcesContent":["import type { IMatrix, IPoint, IPointLike } from '@visactor/vutils';\nimport { AABBBounds, Matrix, Point } from '@visactor/vutils';\nimport { inject, injectable, named } from '../common/inversify-lite';\nimport { foreach } from '../common/sort';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../common/contribution-provider';\nimport type {\n IContext2d,\n IGraphic,\n IGroup,\n EnvType,\n IGlobal,\n IPickerService,\n IGraphicPicker,\n IPickParams,\n PickResult,\n IPickItemInterceptorContribution,\n IContributionProvider,\n IPickServiceInterceptorContribution\n} from '../interface';\nimport { getTheme } from '../graphic/theme';\nimport { DefaultAttribute } from '../graphic/config';\nimport { mat3Tomat4, multiplyMat4Mat4 } from '../common/matrix';\nimport { mat4Allocate, matrixAllocate } from '../allocator/matrix-allocate';\nimport { application } from '../application';\nimport { PickItemInterceptor, PickServiceInterceptor } from './constants';\n\n@injectable()\nexport abstract class DefaultPickService implements IPickerService {\n type: string = 'default';\n declare pickerMap: Map<number, IGraphicPicker>;\n declare pickContext?: IContext2d;\n declare InterceptorContributions: IPickItemInterceptorContribution[];\n declare pickerServiceInterceptorContributions: IPickServiceInterceptorContribution[];\n declare global: IGlobal;\n\n constructor(\n // 拦截器\n // @ts-ignore\n @inject(ContributionProvider)\n @named(PickItemInterceptor)\n protected readonly pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>,\n // @ts-ignore\n @inject(ContributionProvider)\n @named(PickServiceInterceptor)\n protected readonly pickServiceInterceptorContributions: IContributionProvider<IPickServiceInterceptorContribution>\n ) {\n this.global = application.global;\n }\n\n protected _init() {\n this.InterceptorContributions = this.pickItemInterceptorContributions\n .getContributions()\n .sort((a, b) => a.order - b.order);\n this.pickerServiceInterceptorContributions = this.pickServiceInterceptorContributions\n .getContributions()\n .sort((a, b) => a.order - b.order);\n }\n\n abstract configure(global: IGlobal, env: EnvType): void;\n\n // todo: params支持\n // todo: 性能优化\n pick(graphics: IGraphic[], point: IPoint, params: IPickParams): PickResult {\n let result: PickResult = {\n graphic: null,\n group: null\n };\n // point变换\n params.pickerService = this;\n\n const w = params.bounds.width();\n const h = params.bounds.height();\n if (!new AABBBounds().setValue(0, 0, w, h).containsPoint(point)) {\n return result;\n }\n if (this.pickContext) {\n this.pickContext.inuse = true;\n }\n params.pickContext = this.pickContext;\n this.pickContext && this.pickContext.clearMatrix(true, 1);\n\n const parentMatrix = new Matrix(1, 0, 0, 1, 0, 0);\n let group: IGroup;\n for (let i = graphics.length - 1; i >= 0; i--) {\n if (graphics[i].isContainer) {\n result = this.pickGroup(graphics[i] as IGroup, point, parentMatrix, params);\n } else {\n result = this.pickItem(graphics[i], point, parentMatrix, params);\n }\n if (result.graphic) {\n break;\n }\n if (!group) {\n group = result.group;\n }\n }\n if (!result.graphic) {\n result.group = group;\n }\n if (this.pickContext) {\n this.pickContext.inuse = false;\n }\n\n if (this.pickerServiceInterceptorContributions.length) {\n for (let i = 0; i < this.pickerServiceInterceptorContributions.length; i++) {\n const drawContribution = this.pickerServiceInterceptorContributions[i];\n if (drawContribution.afterPickItem) {\n result = drawContribution.afterPickItem(result, this, point, params, { parentMatrix });\n }\n }\n }\n // // 判断是否有shadow-dom\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\n return result;\n }\n\n containsPoint(graphic: IGraphic, point: IPointLike, params: IPickParams): boolean {\n return !!this.pickItem(graphic, point, null, params ?? { pickContext: this.pickContext, pickerService: this })\n ?.graphic;\n }\n\n // TODO: 支持3d模式的拾取和自定义path的拾取\n pickGroup(group: IGroup, point: IPointLike, parentMatrix: IMatrix, params: IPickParams): PickResult {\n let result: PickResult = {\n group: null,\n graphic: null\n };\n if (group.attribute.visibleAll === false) {\n return result;\n }\n const context = params.pickContext;\n const lastMatrix = context.modelMatrix;\n // 如果是3d,那么需要生成modelMatrix\n if (context.camera) {\n const m = group.transMatrix;\n const matrix = mat4Allocate.allocate();\n mat3Tomat4(matrix, m);\n if (lastMatrix) {\n if (matrix) {\n const m = mat4Allocate.allocate();\n context.modelMatrix = multiplyMat4Mat4(m, lastMatrix, matrix);\n mat4Allocate.free(matrix);\n }\n } else {\n // 转化context的matrix为lastMatrix\n mat3Tomat4(matrix, group.globalTransMatrix);\n context.modelMatrix = matrix;\n }\n }\n // 添加拦截器\n if (this.InterceptorContributions.length) {\n for (let i = 0; i < this.InterceptorContributions.length; i++) {\n const drawContribution = this.InterceptorContributions[i];\n if (drawContribution.beforePickItem) {\n const result = drawContribution.beforePickItem(group, this, point, params, { parentMatrix });\n if (result) {\n if (context.modelMatrix !== lastMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastMatrix;\n return result;\n }\n }\n }\n }\n // 转换坐标空间\n const transMatrix = group.transMatrix;\n const currentGroupMatrix = matrixAllocate.allocateByObj(parentMatrix);\n const newPoint: IPoint = new Point(point.x, point.y);\n currentGroupMatrix.transformPoint(newPoint, newPoint);\n // todo: 支持带有path的group的选中\n const insideGroup = group.AABBBounds.containsPoint(newPoint);\n // 如果group没有被选中,直接跳过(如果是3d模式,那么继续)\n if (!insideGroup && !group.stage.camera) {\n return result;\n }\n // pickGroup,Group目前只支持拦截模式(用于shadow节点)\n const pickedItem = this.pickItem(group, newPoint.clone(), parentMatrix, params);\n if (pickedItem && pickedItem.graphic) {\n result.graphic = pickedItem.graphic;\n result.params = pickedItem.params;\n }\n const groupPicked = group.attribute.pickable !== false && insideGroup;\n\n currentGroupMatrix.multiply(\n transMatrix.a,\n transMatrix.b,\n transMatrix.c,\n transMatrix.d,\n transMatrix.e,\n transMatrix.f\n );\n if (group.attribute.childrenPickable !== false && !(pickedItem && pickedItem.graphic)) {\n foreach(\n group,\n DefaultAttribute.zIndex,\n (graphic: IGraphic) => {\n if (graphic.isContainer) {\n // 偏移scrollX和scrollY\n const newPoint: IPoint = new Point(point.x, point.y);\n const theme = getTheme(group).group;\n const { scrollX = theme.scrollX, scrollY = theme.scrollY } = group.attribute;\n newPoint.x -= scrollX;\n newPoint.y -= scrollY;\n result = this.pickGroup(graphic as IGroup, newPoint, currentGroupMatrix, params);\n } else {\n const newPoint: IPoint = new Point(point.x, point.y);\n currentGroupMatrix.transformPoint(newPoint, newPoint);\n // 偏移scrollX和scrollY\n const theme = getTheme(group).group;\n const { scrollX = theme.scrollX, scrollY = theme.scrollY } = group.attribute;\n newPoint.x -= scrollX;\n newPoint.y -= scrollY;\n const pickedItem = this.pickItem(graphic, newPoint, parentMatrix, params);\n if (pickedItem && pickedItem.graphic) {\n result.graphic = pickedItem.graphic;\n result.params = pickedItem.params;\n }\n }\n return !!result.graphic || !!result.group;\n },\n true,\n !!context.camera\n );\n }\n if (context.modelMatrix !== lastMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastMatrix;\n\n if (!result.graphic && !result.group && groupPicked && !group.stage.camera) {\n result.group = group;\n }\n matrixAllocate.free(currentGroupMatrix);\n return result;\n }\n\n // todo: switch统一改为数字map\n abstract pickItem(\n graphic: IGraphic,\n point: IPointLike,\n parentMatrix: IMatrix | null,\n params: IPickParams\n ): PickResult | null;\n\n protected selectPicker(graphic: IGraphic): IGraphicPicker | null {\n const picker = this.pickerMap.get(graphic.numberType);\n if (!picker) {\n return null;\n }\n return picker;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/picker/picker-service.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAevE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,Y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;QACD,IAAI,OAAO,CAAC,WAAW,KAAK,UAAU,EAAE;YACtC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACxC;QACD,OAAO,CAAC,WAAW,GAAG,UAAU,CAAC;QAEjC,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,WAAW,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE;YAC1E,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;SACtB;QACD,cAAc,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACxC,OAAO,MAAM,CAAC;IAChB,CAAC;IAUS,YAAY,CAAC,OAAiB;QACtC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,IAAI,CAAC;SACb;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AAjPqB,kBAAkB;IADvC,UAAU,EAAE;IAYR,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAG1B,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,sBAAsB,CAAC,CAAA;;GAhBZ,kBAAkB,CAiPvC;SAjPqB,kBAAkB","file":"picker-service.js","sourcesContent":["import type { IMatrix, IPoint, IPointLike } from '@visactor/vutils';\nimport { AABBBounds, Matrix, Point } from '@visactor/vutils';\nimport { inject, injectable, named } from '../common/inversify-lite';\nimport { foreach } from '../common/sort';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../common/contribution-provider';\nimport type {\n IContext2d,\n IGraphic,\n IGroup,\n EnvType,\n IGlobal,\n IPickerService,\n IGraphicPicker,\n IPickParams,\n PickResult,\n IPickItemInterceptorContribution,\n IContributionProvider,\n IPickServiceInterceptorContribution\n} from '../interface';\nimport { getTheme } from '../graphic/theme';\nimport { DefaultAttribute } from '../graphic/config';\nimport { mat3Tomat4, multiplyMat4Mat4 } from '../common/matrix';\nimport { mat4Allocate, matrixAllocate } from '../allocator/matrix-allocate';\nimport { application } from '../application';\nimport { PickItemInterceptor, PickServiceInterceptor } from './constants';\n\n@injectable()\nexport abstract class DefaultPickService implements IPickerService {\n type: string = 'default';\n declare pickerMap: Map<number, IGraphicPicker>;\n declare pickContext?: IContext2d;\n declare InterceptorContributions: IPickItemInterceptorContribution[];\n declare pickerServiceInterceptorContributions: IPickServiceInterceptorContribution[];\n declare global: IGlobal;\n\n constructor(\n // 拦截器\n // @ts-ignore\n @inject(ContributionProvider)\n @named(PickItemInterceptor)\n protected readonly pickItemInterceptorContributions: IContributionProvider<IPickItemInterceptorContribution>,\n // @ts-ignore\n @inject(ContributionProvider)\n @named(PickServiceInterceptor)\n protected readonly pickServiceInterceptorContributions: IContributionProvider<IPickServiceInterceptorContribution>\n ) {\n this.global = application.global;\n }\n\n reInit() {\n this._init();\n }\n\n protected _init() {\n this.InterceptorContributions = this.pickItemInterceptorContributions\n .getContributions()\n .sort((a, b) => a.order - b.order);\n this.pickerServiceInterceptorContributions = this.pickServiceInterceptorContributions\n .getContributions()\n .sort((a, b) => a.order - b.order);\n }\n\n abstract configure(global: IGlobal, env: EnvType): void;\n\n // todo: params支持\n // todo: 性能优化\n pick(graphics: IGraphic[], point: IPoint, params: IPickParams): PickResult {\n let result: PickResult = {\n graphic: null,\n group: null\n };\n // point变换\n params.pickerService = this;\n\n const w = params.bounds.width();\n const h = params.bounds.height();\n if (!new AABBBounds().setValue(0, 0, w, h).containsPoint(point)) {\n return result;\n }\n if (this.pickContext) {\n this.pickContext.inuse = true;\n }\n params.pickContext = this.pickContext;\n this.pickContext && this.pickContext.clearMatrix(true, 1);\n\n const parentMatrix = new Matrix(1, 0, 0, 1, 0, 0);\n let group: IGroup;\n for (let i = graphics.length - 1; i >= 0; i--) {\n if (graphics[i].isContainer) {\n result = this.pickGroup(graphics[i] as IGroup, point, parentMatrix, params);\n } else {\n result = this.pickItem(graphics[i], point, parentMatrix, params);\n }\n if (result.graphic) {\n break;\n }\n if (!group) {\n group = result.group;\n }\n }\n if (!result.graphic) {\n result.group = group;\n }\n if (this.pickContext) {\n this.pickContext.inuse = false;\n }\n\n if (this.pickerServiceInterceptorContributions.length) {\n for (let i = 0; i < this.pickerServiceInterceptorContributions.length; i++) {\n const drawContribution = this.pickerServiceInterceptorContributions[i];\n if (drawContribution.afterPickItem) {\n result = drawContribution.afterPickItem(result, this, point, params, { parentMatrix });\n }\n }\n }\n // // 判断是否有shadow-dom\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\n return result;\n }\n\n containsPoint(graphic: IGraphic, point: IPointLike, params: IPickParams): boolean {\n return !!this.pickItem(graphic, point, null, params ?? { pickContext: this.pickContext, pickerService: this })\n ?.graphic;\n }\n\n // TODO: 支持3d模式的拾取和自定义path的拾取\n pickGroup(group: IGroup, point: IPointLike, parentMatrix: IMatrix, params: IPickParams): PickResult {\n let result: PickResult = {\n group: null,\n graphic: null\n };\n if (group.attribute.visibleAll === false) {\n return result;\n }\n const context = params.pickContext;\n const lastMatrix = context.modelMatrix;\n // 如果是3d,那么需要生成modelMatrix\n if (context.camera) {\n const m = group.transMatrix;\n const matrix = mat4Allocate.allocate();\n mat3Tomat4(matrix, m);\n if (lastMatrix) {\n if (matrix) {\n const m = mat4Allocate.allocate();\n context.modelMatrix = multiplyMat4Mat4(m, lastMatrix, matrix);\n mat4Allocate.free(matrix);\n }\n } else {\n // 转化context的matrix为lastMatrix\n mat3Tomat4(matrix, group.globalTransMatrix);\n context.modelMatrix = matrix;\n }\n }\n // 添加拦截器\n if (this.InterceptorContributions.length) {\n for (let i = 0; i < this.InterceptorContributions.length; i++) {\n const drawContribution = this.InterceptorContributions[i];\n if (drawContribution.beforePickItem) {\n const result = drawContribution.beforePickItem(group, this, point, params, { parentMatrix });\n if (result) {\n if (context.modelMatrix !== lastMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastMatrix;\n return result;\n }\n }\n }\n }\n // 转换坐标空间\n const transMatrix = group.transMatrix;\n const currentGroupMatrix = matrixAllocate.allocateByObj(parentMatrix);\n const newPoint: IPoint = new Point(point.x, point.y);\n currentGroupMatrix.transformPoint(newPoint, newPoint);\n // todo: 支持带有path的group的选中\n const insideGroup = group.AABBBounds.containsPoint(newPoint);\n // 如果group没有被选中,直接跳过(如果是3d模式,那么继续)\n if (!insideGroup && !group.stage.camera) {\n return result;\n }\n // pickGroup,Group目前只支持拦截模式(用于shadow节点)\n const pickedItem = this.pickItem(group, newPoint.clone(), parentMatrix, params);\n if (pickedItem && pickedItem.graphic) {\n result.graphic = pickedItem.graphic;\n result.params = pickedItem.params;\n }\n const groupPicked = group.attribute.pickable !== false && insideGroup;\n\n currentGroupMatrix.multiply(\n transMatrix.a,\n transMatrix.b,\n transMatrix.c,\n transMatrix.d,\n transMatrix.e,\n transMatrix.f\n );\n if (group.attribute.childrenPickable !== false && !(pickedItem && pickedItem.graphic)) {\n foreach(\n group,\n DefaultAttribute.zIndex,\n (graphic: IGraphic) => {\n if (graphic.isContainer) {\n // 偏移scrollX和scrollY\n const newPoint: IPoint = new Point(point.x, point.y);\n const theme = getTheme(group).group;\n const { scrollX = theme.scrollX, scrollY = theme.scrollY } = group.attribute;\n newPoint.x -= scrollX;\n newPoint.y -= scrollY;\n result = this.pickGroup(graphic as IGroup, newPoint, currentGroupMatrix, params);\n } else {\n const newPoint: IPoint = new Point(point.x, point.y);\n currentGroupMatrix.transformPoint(newPoint, newPoint);\n // 偏移scrollX和scrollY\n const theme = getTheme(group).group;\n const { scrollX = theme.scrollX, scrollY = theme.scrollY } = group.attribute;\n newPoint.x -= scrollX;\n newPoint.y -= scrollY;\n const pickedItem = this.pickItem(graphic, newPoint, parentMatrix, params);\n if (pickedItem && pickedItem.graphic) {\n result.graphic = pickedItem.graphic;\n result.params = pickedItem.params;\n }\n }\n return !!result.graphic || !!result.group;\n },\n true,\n !!context.camera\n );\n }\n if (context.modelMatrix !== lastMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastMatrix;\n\n if (!result.graphic && !result.group && groupPicked && !group.stage.camera) {\n result.group = group;\n }\n matrixAllocate.free(currentGroupMatrix);\n return result;\n }\n\n // todo: switch统一改为数字map\n abstract pickItem(\n graphic: IGraphic,\n point: IPointLike,\n parentMatrix: IMatrix | null,\n params: IPickParams\n ): PickResult | null;\n\n protected selectPicker(graphic: IGraphic): IGraphicPicker | null {\n const picker = this.pickerMap.get(graphic.numberType);\n if (!picker) {\n return null;\n }\n return picker;\n }\n}\n"]}
@@ -1,7 +1,5 @@
1
1
  import { Generator } from "../../common/generator";
2
2
 
3
- import { application } from "../../application";
4
-
5
3
  export class AutoRenderPlugin {
6
4
  constructor() {
7
5
  this.name = "AutoRenderPlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(),
@@ -10,14 +8,16 @@ export class AutoRenderPlugin {
10
8
  };
11
9
  }
12
10
  activate(context) {
13
- this.pluginService = context, application.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handleChange),
14
- application.graphicService.hooks.onSetStage.tap(this.key, this.handleChange), application.graphicService.hooks.onRemove.tap(this.key, this.handleChange);
11
+ this.pluginService = context;
12
+ const stage = this.pluginService.stage;
13
+ stage && (stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handleChange),
14
+ stage.graphicService.hooks.onSetStage.tap(this.key, this.handleChange), stage.graphicService.hooks.onRemove.tap(this.key, this.handleChange));
15
15
  }
16
16
  deactivate(context) {
17
- const filterByName = taps => taps.filter((item => item.name !== this.key));
18
- application.graphicService.hooks.onAttributeUpdate.taps = filterByName(application.graphicService.hooks.onAttributeUpdate.taps),
19
- application.graphicService.hooks.onSetStage.taps = filterByName(application.graphicService.hooks.onSetStage.taps),
20
- application.graphicService.hooks.onRemove.taps = filterByName(application.graphicService.hooks.onRemove.taps);
17
+ const filterByName = taps => taps.filter((item => item.name !== this.key)), stage = this.pluginService.stage;
18
+ stage && (stage.graphicService.hooks.onAttributeUpdate.taps = filterByName(stage.graphicService.hooks.onAttributeUpdate.taps),
19
+ stage.graphicService.hooks.onSetStage.taps = filterByName(stage.graphicService.hooks.onSetStage.taps),
20
+ stage.graphicService.hooks.onRemove.taps = filterByName(stage.graphicService.hooks.onRemove.taps));
21
21
  }
22
22
  }
23
23
  //# sourceMappingURL=auto-render-plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugins/builtin-plugin/auto-render-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,MAAM,OAAO,gBAAgB;IAA7B;QACE,SAAI,GAAuB,kBAAkB,CAAC;QAC9C,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SAAI,GAAW,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAC9C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEpC,iBAAY,GAAG,CAAC,OAAiB,EAAE,EAAE;YACnC,IAAI,OAAO,CAAC,SAAS,EAAE;gBACrB,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;aAC7B;YACD,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,aAAa,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,IAAI,IAAI,EAAE;gBACvE,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;aACjC;QACH,CAAC,CAAC;IAqBJ,CAAC;IAnBC,QAAQ,CAAC,OAAuB;QAC9B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;QAC7B,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACpF,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC7E,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC7E,CAAC;IACD,UAAU,CAAC,OAAuB;QAChC,MAAM,YAAY,GAAG,CAAC,IAAe,EAAE,EAAE;YACvC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;gBACxB,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,iBAAiB,CAAC,IAAI,GAAG,YAAY,CACpE,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,iBAAiB,CAAC,IAAI,CACxD,CAAC;QACF,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,YAAY,CAAC,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAClH,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,GAAG,YAAY,CAAC,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAChH,CAAC;CACF","file":"auto-render-plugin.js","sourcesContent":["import { Generator } from '../../common/generator';\nimport { application } from '../../application';\nimport type { FullTap, IGraphic, IPlugin, IPluginService } from '../../interface';\n\nexport class AutoRenderPlugin implements IPlugin {\n name: 'AutoRenderPlugin' = 'AutoRenderPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n\n handleChange = (graphic: IGraphic) => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (graphic.stage === this.pluginService.stage && graphic.stage != null) {\n graphic.stage.renderNextFrame();\n }\n };\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n application.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handleChange);\n application.graphicService.hooks.onSetStage.tap(this.key, this.handleChange);\n application.graphicService.hooks.onRemove.tap(this.key, this.handleChange);\n }\n deactivate(context: IPluginService): void {\n const filterByName = (taps: FullTap[]) => {\n return taps.filter(item => {\n return item.name !== this.key;\n });\n };\n\n application.graphicService.hooks.onAttributeUpdate.taps = filterByName(\n application.graphicService.hooks.onAttributeUpdate.taps\n );\n application.graphicService.hooks.onSetStage.taps = filterByName(application.graphicService.hooks.onSetStage.taps);\n application.graphicService.hooks.onRemove.taps = filterByName(application.graphicService.hooks.onRemove.taps);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/plugins/builtin-plugin/auto-render-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAInD,MAAM,OAAO,gBAAgB;IAA7B;QACE,SAAI,GAAuB,kBAAkB,CAAC;QAC9C,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SAAI,GAAW,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAC9C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEpC,iBAAY,GAAG,CAAC,OAAiB,EAAE,EAAE;YACnC,IAAI,OAAO,CAAC,SAAS,EAAE;gBACrB,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;aAC7B;YACD,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,aAAa,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,IAAI,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AAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACpG,CAAC;CACF","file":"auto-render-plugin.js","sourcesContent":["import { Generator } from '../../common/generator';\nimport { application } from '../../application';\nimport type { FullTap, IGraphic, IPlugin, IPluginService } from '../../interface';\n\nexport class AutoRenderPlugin implements IPlugin {\n name: 'AutoRenderPlugin' = 'AutoRenderPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n\n handleChange = (graphic: IGraphic) => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (graphic.stage === this.pluginService.stage && graphic.stage != null) {\n graphic.stage.renderNextFrame();\n }\n };\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n const stage = this.pluginService.stage;\n if (!stage) {\n return;\n }\n stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handleChange);\n stage.graphicService.hooks.onSetStage.tap(this.key, this.handleChange);\n stage.graphicService.hooks.onRemove.tap(this.key, this.handleChange);\n }\n deactivate(context: IPluginService): void {\n const filterByName = (taps: FullTap[]) => {\n return taps.filter(item => {\n return item.name !== this.key;\n });\n };\n const stage = this.pluginService.stage;\n if (!stage) {\n return;\n }\n\n stage.graphicService.hooks.onAttributeUpdate.taps = filterByName(stage.graphicService.hooks.onAttributeUpdate.taps);\n stage.graphicService.hooks.onSetStage.taps = filterByName(stage.graphicService.hooks.onSetStage.taps);\n stage.graphicService.hooks.onRemove.taps = filterByName(stage.graphicService.hooks.onRemove.taps);\n }\n}\n"]}
@@ -2,8 +2,6 @@ import { AABBBounds } from "@visactor/vutils";
2
2
 
3
3
  import { Generator } from "../../common/generator";
4
4
 
5
- import { application } from "../../application";
6
-
7
5
  const globalBounds = new AABBBounds;
8
6
 
9
7
  export class DirtyBoundsPlugin {
@@ -14,24 +12,27 @@ export class DirtyBoundsPlugin {
14
12
  activate(context) {
15
13
  this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, (stage => {
16
14
  stage && stage === this.pluginService.stage && stage.dirtyBounds.clear();
17
- })), application.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, ((graphic, stage, willUpdate, bounds) => {
15
+ }));
16
+ const stage = this.pluginService.stage;
17
+ stage && (stage.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, ((graphic, stage, willUpdate, bounds) => {
18
18
  graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === this.pluginService.stage && stage.renderCount && (graphic.isContainer && !graphic.shouldSelfChangeUpdateAABBBounds() || willUpdate && (globalBounds.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2),
19
19
  stage.dirty(globalBounds, graphic.parent && graphic.parent.globalTransMatrix)));
20
- })), application.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, ((graphic, stage, bounds, params, selfChange) => {
20
+ })), stage.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, ((graphic, stage, bounds, params, selfChange) => {
21
21
  stage && stage === this.pluginService.stage && stage.renderCount && (graphic.isContainer && !selfChange || stage.dirty(params.globalAABBBounds));
22
- })), application.graphicService.hooks.clearAABBBounds.tap(this.key, ((graphic, stage, bounds) => {
22
+ })), stage.graphicService.hooks.clearAABBBounds.tap(this.key, ((graphic, stage, bounds) => {
23
23
  stage && stage === this.pluginService.stage && stage.renderCount && stage && stage.dirty(bounds);
24
- })), application.graphicService.hooks.onRemove.tap(this.key, (graphic => {
24
+ })), stage.graphicService.hooks.onRemove.tap(this.key, (graphic => {
25
25
  const stage = graphic.stage;
26
26
  stage && stage === this.pluginService.stage && stage.renderCount && stage && stage.dirty(graphic.globalAABBBounds);
27
- }));
27
+ })));
28
28
  }
29
29
  deactivate(context) {
30
- application.graphicService.hooks.beforeUpdateAABBBounds.taps = application.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((item => item.name !== this.key)),
31
- application.graphicService.hooks.afterUpdateAABBBounds.taps = application.graphicService.hooks.afterUpdateAABBBounds.taps.filter((item => item.name !== this.key)),
32
- application.graphicService.hooks.clearAABBBounds.taps = application.graphicService.hooks.clearAABBBounds.taps.filter((item => item.name !== this.key)),
33
- context.stage.hooks.afterRender.taps = context.stage.hooks.afterRender.taps.filter((item => item.name !== this.key)),
34
- application.graphicService.hooks.onRemove.taps = application.graphicService.hooks.onRemove.taps.filter((item => item.name !== this.key));
30
+ const stage = this.pluginService.stage;
31
+ stage && (stage.graphicService.hooks.beforeUpdateAABBBounds.taps = stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((item => item.name !== this.key)),
32
+ stage.graphicService.hooks.afterUpdateAABBBounds.taps = stage.graphicService.hooks.afterUpdateAABBBounds.taps.filter((item => item.name !== this.key)),
33
+ stage.graphicService.hooks.clearAABBBounds.taps = stage.graphicService.hooks.clearAABBBounds.taps.filter((item => item.name !== this.key)),
34
+ stage.hooks.afterRender.taps = stage.hooks.afterRender.taps.filter((item => item.name !== this.key)),
35
+ stage.graphicService.hooks.onRemove.taps = stage.graphicService.hooks.onRemove.taps.filter((item => item.name !== this.key)));
35
36
  }
36
37
  }
37
38
  //# sourceMappingURL=dirty-bounds-plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugins/builtin-plugin/dirty-bounds-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,YAAY,GAAG,IAAI,UAAU,EAAE,CAAC;AAEtC,MAAM,OAAO,iBAAiB;IAA9B;QACE,SAAI,GAAwB,mBAAmB,CAAC;QAChD,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SA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AAG,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC;CACF","file":"dirty-bounds-plugin.js","sourcesContent":["import type { IAABBBounds } from '@visactor/vutils';\nimport { AABBBounds } from '@visactor/vutils';\nimport { Generator } from '../../common/generator';\nimport type { IGraphic, IStage, IPlugin, IPluginService } from '../../interface';\nimport { application } from '../../application';\n\nconst globalBounds = new AABBBounds();\n\nexport class DirtyBoundsPlugin implements IPlugin {\n name: 'DirtyBoundsPlugin' = 'DirtyBoundsPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n context.stage.hooks.afterRender.tap(this.key, stage => {\n if (!(stage && stage === this.pluginService.stage)) {\n return;\n }\n stage.dirtyBounds.clear();\n });\n application.graphicService.hooks.beforeUpdateAABBBounds.tap(\n this.key,\n (graphic: IGraphic, stage: IStage, willUpdate: boolean, bounds: IAABBBounds) => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n // group的子元素导致的bounds更新不用做dirtyBounds\n if (graphic.isContainer && !graphic.shouldSelfChangeUpdateAABBBounds()) {\n return;\n }\n if (willUpdate) {\n globalBounds.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2);\n stage.dirty(globalBounds, graphic.parent && graphic.parent.globalTransMatrix);\n }\n }\n );\n application.graphicService.hooks.afterUpdateAABBBounds.tap(\n this.key,\n (\n graphic: IGraphic,\n stage: IStage,\n bounds: IAABBBounds,\n params: { globalAABBBounds: IAABBBounds },\n selfChange: boolean\n ) => {\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n // group的子元素导致的bounds更新不用做dirtyBounds\n if (graphic.isContainer && !selfChange) {\n return;\n }\n stage.dirty(params.globalAABBBounds);\n }\n );\n application.graphicService.hooks.clearAABBBounds.tap(\n this.key,\n (graphic: IGraphic, stage: IStage, bounds: IAABBBounds) => {\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n if (stage) {\n stage.dirty(bounds);\n }\n }\n );\n application.graphicService.hooks.onRemove.tap(this.key, (graphic: IGraphic) => {\n const stage = graphic.stage;\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n if (stage) {\n stage.dirty(graphic.globalAABBBounds);\n }\n });\n }\n deactivate(context: IPluginService): void {\n application.graphicService.hooks.beforeUpdateAABBBounds.taps =\n application.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n application.graphicService.hooks.afterUpdateAABBBounds.taps =\n application.graphicService.hooks.afterUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n application.graphicService.hooks.clearAABBBounds.taps =\n application.graphicService.hooks.clearAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n context.stage.hooks.afterRender.taps = context.stage.hooks.afterRender.taps.filter(item => {\n return item.name !== this.key;\n });\n application.graphicService.hooks.onRemove.taps = application.graphicService.hooks.onRemove.taps.filter(item => {\n return item.name !== this.key;\n });\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/plugins/builtin-plugin/dirty-bounds-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAInD,MAAM,YAAY,GAAG,IAAI,UAAU,EAAE,CAAC;AAEtC,MAAM,OAAO,iBAAiB;IAA9B;QACE,SAAI,GAAwB,mBAAmB,CAAC;QAChD,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SAAI,GAAW,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAC9C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;IAgGtC,CAAC;IA9FC,QAAQ,CAAC,OAAuB;QAC9B,IAAI,CAAC,a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AI,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC;CACF","file":"dirty-bounds-plugin.js","sourcesContent":["import type { IAABBBounds } from '@visactor/vutils';\nimport { AABBBounds } from '@visactor/vutils';\nimport { Generator } from '../../common/generator';\nimport type { IGraphic, IStage, IPlugin, IPluginService } from '../../interface';\nimport { application } from '../../application';\n\nconst globalBounds = new AABBBounds();\n\nexport class DirtyBoundsPlugin implements IPlugin {\n name: 'DirtyBoundsPlugin' = 'DirtyBoundsPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n context.stage.hooks.afterRender.tap(this.key, stage => {\n if (!(stage && stage === this.pluginService.stage)) {\n return;\n }\n stage.dirtyBounds.clear();\n });\n const stage = this.pluginService.stage;\n if (!stage) {\n return;\n }\n stage.graphicService.hooks.beforeUpdateAABBBounds.tap(\n this.key,\n (graphic: IGraphic, stage: IStage, willUpdate: boolean, bounds: IAABBBounds) => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n // group的子元素导致的bounds更新不用做dirtyBounds\n if (graphic.isContainer && !graphic.shouldSelfChangeUpdateAABBBounds()) {\n return;\n }\n if (willUpdate) {\n globalBounds.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2);\n stage.dirty(globalBounds, graphic.parent && graphic.parent.globalTransMatrix);\n }\n }\n );\n stage.graphicService.hooks.afterUpdateAABBBounds.tap(\n this.key,\n (\n graphic: IGraphic,\n stage: IStage,\n bounds: IAABBBounds,\n params: { globalAABBBounds: IAABBBounds },\n selfChange: boolean\n ) => {\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n // group的子元素导致的bounds更新不用做dirtyBounds\n if (graphic.isContainer && !selfChange) {\n return;\n }\n stage.dirty(params.globalAABBBounds);\n }\n );\n stage.graphicService.hooks.clearAABBBounds.tap(\n this.key,\n (graphic: IGraphic, stage: IStage, bounds: IAABBBounds) => {\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n if (stage) {\n stage.dirty(bounds);\n }\n }\n );\n stage.graphicService.hooks.onRemove.tap(this.key, (graphic: IGraphic) => {\n const stage = graphic.stage;\n if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {\n return;\n }\n if (stage) {\n stage.dirty(graphic.globalAABBBounds);\n }\n });\n }\n deactivate(context: IPluginService): void {\n const stage = this.pluginService.stage;\n if (!stage) {\n return;\n }\n stage.graphicService.hooks.beforeUpdateAABBBounds.taps =\n stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.graphicService.hooks.afterUpdateAABBBounds.taps =\n stage.graphicService.hooks.afterUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.graphicService.hooks.clearAABBBounds.taps = stage.graphicService.hooks.clearAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.hooks.afterRender.taps = stage.hooks.afterRender.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.graphicService.hooks.onRemove.taps = stage.graphicService.hooks.onRemove.taps.filter(item => {\n return item.name !== this.key;\n });\n }\n}\n"]}
@@ -4,8 +4,6 @@ import { Generator } from "../../common/generator";
4
4
 
5
5
  import { AABBBounds } from "@visactor/vutils";
6
6
 
7
- import { application } from "../../application";
8
-
9
7
  import { Factory } from "../../factory";
10
8
 
11
9
  const _tempBounds = new AABBBounds;
@@ -230,21 +228,24 @@ export class FlexLayoutPlugin {
230
228
  }
231
229
  }
232
230
  activate(context) {
233
- this.pluginService = context, application.graphicService.hooks.onAttributeUpdate.tap(this.key, (graphic => {
231
+ this.pluginService = context;
232
+ const stage = this.pluginService.stage;
233
+ stage && (stage.graphicService.hooks.onAttributeUpdate.tap(this.key, (graphic => {
234
234
  graphic.glyphHost && (graphic = graphic.glyphHost), graphic.stage && graphic.stage === this.pluginService.stage && this.tryLayout(graphic, !1);
235
- })), application.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, ((graphic, stage, willUpdate, bounds) => {
235
+ })), stage.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, ((graphic, stage, willUpdate, bounds) => {
236
236
  graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === this.pluginService.stage && graphic.isContainer && !this.skipBoundsTrigger && _tempBounds.copy(bounds);
237
- })), application.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, ((graphic, stage, bounds, params, selfChange) => {
237
+ })), stage.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, ((graphic, stage, bounds, params, selfChange) => {
238
238
  stage && stage === this.pluginService.stage && graphic.isContainer && !this.skipBoundsTrigger && (_tempBounds.equals(bounds) || this.tryLayout(graphic, !1));
239
- })), application.graphicService.hooks.onSetStage.tap(this.key, (graphic => {
239
+ })), stage.graphicService.hooks.onSetStage.tap(this.key, (graphic => {
240
240
  graphic.glyphHost && (graphic = graphic.glyphHost), this.tryLayout(graphic, !1);
241
- }));
241
+ })));
242
242
  }
243
243
  deactivate(context) {
244
- application.graphicService.hooks.onAttributeUpdate.taps = application.graphicService.hooks.onAttributeUpdate.taps.filter((item => item.name !== this.key)),
245
- application.graphicService.hooks.beforeUpdateAABBBounds.taps = application.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((item => item.name !== this.key)),
246
- application.graphicService.hooks.afterUpdateAABBBounds.taps = application.graphicService.hooks.afterUpdateAABBBounds.taps.filter((item => item.name !== this.key)),
247
- application.graphicService.hooks.onSetStage.taps = application.graphicService.hooks.onSetStage.taps.filter((item => item.name !== this.key));
244
+ const stage = this.pluginService.stage;
245
+ stage && (stage.graphicService.hooks.onAttributeUpdate.taps = stage.graphicService.hooks.onAttributeUpdate.taps.filter((item => item.name !== this.key)),
246
+ stage.graphicService.hooks.beforeUpdateAABBBounds.taps = stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((item => item.name !== this.key)),
247
+ stage.graphicService.hooks.afterUpdateAABBBounds.taps = stage.graphicService.hooks.afterUpdateAABBBounds.taps.filter((item => item.name !== this.key)),
248
+ stage.graphicService.hooks.onSetStage.taps = stage.graphicService.hooks.onSetStage.taps.filter((item => item.name !== this.key)));
248
249
  }
249
250
  }
250
251
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugins/builtin-plugin/flex-layout-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,WAAW,GAAG,IAAI,UAAU,EAAE,CAAC;AAQrC,MAAM,OAAO,gBAAgB;IAA7B;QACE,SAAI,GAAuB,kBAAkB,CAAC;QAC9C,gBAAW,GAAiB,YAAY,CAAC;QAEzC,OAAE,GAAW,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAC5C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;QAClC,eAAU,GAAe,IAAI,UAAU,EAAE,CAAC;IA0f5C,CAAC;IAtfC,WAAW,CAAC,CAAU;QACpB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACjB,CAAC;IAED,iBAAiB,CAAC,OAAiB;QACjC,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAsB,CAAC,CAAC;SAChD;IACH,CAAC;IAED,SAAS,CAAC,OAAiB,EAAE,QAAiB,IAAI;QAChD,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,OAAO;SACR;QACD,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM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,qBAAqB,CAAC,IAAI;YACzD,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;gBACxE,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YAChH,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,SAAS,UAAU,CAAC,OAAiB,EAAE,KAAa;IAclD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,OAAO,CAAC,cAAc,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;AAC/D,CAAC,CAAC","file":"flex-layout-plugin.js","sourcesContent":["import type { IGraphic, IGroup, IGroupAttribute, IStage } from '../../interface';\nimport { getTheme } from '../../graphic/theme';\nimport type { IPlugin, IPluginService } from '../../interface';\nimport { Generator } from '../../common/generator';\nimport type { IAABBBounds } from '@visactor/vutils';\nimport { AABBBounds } from '@visactor/vutils';\nimport { application } from '../../application';\nimport { Factory } from '../../factory';\n\nconst _tempBounds = new AABBBounds();\n\ntype IAnchorPosMap = {\n 'flex-start': number;\n 'flex-end': number;\n center: number;\n};\n\nexport class FlexLayoutPlugin implements IPlugin {\n name: 'FlexLayoutPlugin' = 'FlexLayoutPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n id: number = Generator.GenAutoIncrementId();\n key: string = this.name + this.id;\n tempBounds: AABBBounds = new AABBBounds();\n pause: boolean;\n skipBoundsTrigger: boolean;\n\n pauseLayout(p: boolean) {\n this.pause = p;\n }\n\n tryLayoutChildren(graphic: IGraphic) {\n if (graphic.firstChild) {\n this.tryLayout(graphic.firstChild as IGraphic);\n }\n }\n\n tryLayout(graphic: IGraphic, force: boolean = true) {\n if (this.pause) {\n return;\n }\n const p = graphic.parent;\n if (!(force || (p && graphic.needUpdateLayout()))) {\n return;\n }\n const theme = getTheme(p).group;\n const { display = theme.display } = p.attribute;\n if (display !== 'flex') {\n return;\n }\n const {\n // width,\n // height,\n flexDirection = theme.flexDirection,\n flexWrap = theme.flexWrap,\n alignItems = theme.alignItems,\n clip = theme.clip\n } = p.attribute;\n const { alignContent = alignItems ?? theme.alignContent } = p.attribute;\n // if (!(width && height)) {\n // return;\n // }\n\n let { width, height, justifyContent = theme.justifyContent } = p.attribute;\n const children = p.getChildren() as IGraphic[];\n if (width == null || height == null) {\n // 计算子节点flex排列后的宽高\n let childrenWidth = 0;\n let childrenHeight = 0;\n let boundsLegal = 0;\n children.forEach((child: IGraphic) => {\n const bounds = this.getAABBBounds(child);\n if (bounds.empty()) {\n return;\n }\n if (flexDirection === 'column' || flexDirection === 'column-reverse') {\n childrenHeight += bounds.height();\n childrenWidth = Math.max(childrenWidth, bounds.width());\n } else {\n childrenWidth += bounds.width();\n childrenHeight = Math.max(childrenHeight, bounds.height());\n }\n boundsLegal += bounds.x1;\n boundsLegal += bounds.y1;\n boundsLegal += bounds.x2;\n boundsLegal += bounds.y2;\n });\n // judgement children bounds legal\n if (!isFinite(boundsLegal)) {\n return;\n }\n width = childrenWidth;\n height = childrenHeight;\n }\n\n if (p.attribute.width == null) {\n p.attribute.width = width;\n } else {\n width = p.attribute.width;\n }\n if (p.attribute.height == null) {\n p.attribute.height = height;\n } else {\n height = p.attribute.height;\n }\n\n // 这里使用p._AABBBounds可能会将非布局造成的bounds更新也会触发重新布局\n // TODO: 增加layout前预处理,在非递归布局前将子节点及其全部父节点_AABBBounds更新\n this.tempBounds.copy(p._AABBBounds);\n const result = {\n main: { len: width, field: 'x' },\n cross: { len: height, field: 'y' }\n };\n const main = result.main;\n const cross = result.cross;\n if (flexDirection === 'column' || flexDirection === 'column-reverse') {\n main.len = height;\n cross.len = width;\n main.field = 'y';\n cross.field = 'x';\n }\n if (flexDirection === 'row-reverse' || flexDirection === 'column-reverse') {\n if (justifyContent === 'flex-start') {\n justifyContent = 'flex-end';\n } else if (justifyContent === 'flex-end') {\n justifyContent = 'flex-start';\n } else {\n children.reverse();\n }\n }\n\n // 计算宽度\n let mainLen = 0;\n let crossLen = 0;\n const mianLenArray: { mainLen: number; crossLen: number }[] = [];\n children.forEach((c: IGraphic) => {\n const b = this.getAABBBounds(c);\n if (b.empty()) {\n return;\n }\n const ml = main.field === 'x' ? b.width() : b.height();\n const cl = cross.field === 'x' ? b.width() : b.height();\n mianLenArray.push({ mainLen: ml, crossLen: cl });\n mainLen += ml;\n crossLen = Math.max(crossLen, cl);\n });\n // 解析main\n const mainList: { idx: number; mainLen: number; crossLen: number }[] = [];\n if (mainLen > main.len && flexWrap === 'wrap') {\n let tempMainL = 0;\n let tempCrossL = 0;\n mianLenArray.forEach(({ mainLen, crossLen }, i) => {\n if (tempMainL + mainLen > main.len) {\n if (tempMainL === 0) {\n mainList.push({ idx: i, mainLen: tempMainL + mainLen, crossLen });\n tempMainL = 0;\n tempCrossL = 0;\n } else {\n mainList.push({ idx: i - 1, mainLen: tempMainL, crossLen: tempCrossL });\n tempMainL = mainLen;\n tempCrossL = crossLen;\n }\n } else {\n tempMainL += mainLen;\n tempCrossL = Math.max(tempCrossL, crossLen);\n }\n });\n mainList.push({ idx: mianLenArray.length - 1, mainLen: tempMainL, crossLen: tempCrossL });\n } else {\n mainList.push({ idx: mianLenArray.length - 1, mainLen: mainLen, crossLen });\n }\n\n // 布局main\n let lastIdx: number = 0;\n mainList.forEach(s => {\n this.layoutMain(p, children, justifyContent, main, mianLenArray, lastIdx, s);\n lastIdx = s.idx + 1;\n });\n\n crossLen = mainList.reduce((a, b) => a + b.crossLen, 0);\n\n // 布局cross\n\n if (mainList.length === 1) {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': 0,\n 'flex-end': cross.len,\n center: cross.len / 2\n };\n this.layoutCross(children, alignItems, cross, anchorPosMap, mianLenArray, mainList[0], 0);\n } else {\n if (alignContent === 'flex-start') {\n lastIdx = 0;\n let anchorPos = 0;\n mainList.forEach((s, i) => {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': anchorPos,\n 'flex-end': anchorPos + s.crossLen,\n center: anchorPos + s.crossLen / 2\n };\n this.layoutCross(children, 'flex-start', cross, anchorPosMap, mianLenArray, mainList[i], lastIdx);\n lastIdx = s.idx + 1;\n anchorPos += s.crossLen;\n });\n } else if (alignContent === 'center') {\n lastIdx = 0;\n const padding = Math.max(0, (cross.len - crossLen) / 2);\n let anchorPos = padding;\n mainList.forEach((s, i) => {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': anchorPos,\n 'flex-end': anchorPos + s.crossLen,\n center: anchorPos + s.crossLen / 2\n };\n this.layoutCross(children, 'center', cross, anchorPosMap, mianLenArray, mainList[i], lastIdx);\n lastIdx = s.idx + 1;\n anchorPos += s.crossLen;\n });\n } else if (alignContent === 'space-around') {\n lastIdx = 0;\n const padding = Math.max(0, (cross.len - crossLen) / mainList.length / 2);\n let anchorPos = padding;\n mainList.forEach((s, i) => {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': anchorPos,\n 'flex-end': anchorPos + s.crossLen,\n center: anchorPos + s.crossLen / 2\n };\n this.layoutCross(children, 'flex-start', cross, anchorPosMap, mianLenArray, mainList[i], lastIdx);\n lastIdx = s.idx + 1;\n anchorPos += s.crossLen + padding * 2;\n });\n } else if (alignContent === 'space-between') {\n lastIdx = 0;\n const padding = Math.max(0, (cross.len - crossLen) / (mainList.length * 2 - 2));\n let anchorPos = 0;\n mainList.forEach((s, i) => {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': anchorPos,\n 'flex-end': anchorPos + s.crossLen,\n center: anchorPos + s.crossLen / 2\n };\n this.layoutCross(children, 'flex-start', cross, anchorPosMap, mianLenArray, mainList[i], lastIdx);\n lastIdx = s.idx + 1;\n anchorPos += s.crossLen + padding * 2;\n });\n }\n }\n\n // update children\n children.forEach((child, idx) => {\n child.addUpdateBoundTag();\n child.addUpdatePositionTag();\n child.clearUpdateLayoutTag();\n });\n\n p.addUpdateLayoutTag();\n // 更新父级元素的layout,直到存在clip\n const b = this.getAABBBounds(p);\n if (!clip && !this.tempBounds.equals(b)) {\n // 判断父元素包围盒是否发生变化\n this.tryLayout(p, false);\n }\n }\n\n // 避免获取bounds的时候递归进行布局\n getAABBBounds(graphic: IGraphic) {\n this.skipBoundsTrigger = true;\n const b = graphic.AABBBounds;\n this.skipBoundsTrigger = false;\n return b;\n }\n\n // 锚点并不一定总在左上角,根据位置和bounds的偏移进行定位\n private updateChildPos(posBaseLeftTop: number, lastP: number | undefined, lastBP: number): number {\n return posBaseLeftTop + (lastP ?? 0) - lastBP;\n }\n\n layoutMain(\n p: IGroup,\n children: IGraphic[],\n justifyContent: IGroupAttribute['justifyContent'],\n main: { len: number; field: string },\n mianLenArray: { mainLen: number; crossLen: number }[],\n lastIdx: number,\n currSeg: { idx: number; mainLen: number; crossLen: number }\n ) {\n if (justifyContent === 'flex-start') {\n let pos = 0;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen;\n }\n } else if (justifyContent === 'flex-end') {\n let pos = main.len;\n for (let i = currSeg.idx; i >= lastIdx; i--) {\n pos -= mianLenArray[i].mainLen;\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n }\n } else if (justifyContent === 'space-around') {\n if (currSeg.mainLen >= main.len) {\n let pos = 0;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen;\n }\n } else {\n const size = currSeg.idx - lastIdx + 1;\n const padding = (main.len - currSeg.mainLen) / size / 2;\n let pos = padding;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen + padding * 2;\n }\n }\n } else if (justifyContent === 'space-between') {\n if (currSeg.mainLen >= main.len) {\n let pos = 0;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen;\n }\n } else {\n const size = currSeg.idx - lastIdx + 1;\n const padding = (main.len - currSeg.mainLen) / (size * 2 - 2);\n let pos = 0;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen + padding * 2;\n }\n }\n } else if (justifyContent === 'center') {\n let pos = (main.len - currSeg.mainLen) / 2;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen;\n }\n }\n }\n\n layoutCross(\n children: IGraphic[],\n alignItem: IGroupAttribute['alignItems'],\n cross: { len: number; field: string },\n anchorPosMap: IAnchorPosMap,\n lenArray: { mainLen: number; crossLen: number }[],\n currSeg: { idx: number; mainLen: number; crossLen: number },\n lastIdx: number\n ) {\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const child = children[i];\n let { alignSelf } = child.attribute;\n if (!alignSelf || alignSelf === 'auto') {\n alignSelf = alignItem;\n }\n const b = this.getAABBBounds(child);\n const anchorPos = anchorPosMap[alignSelf] ?? anchorPosMap['flex-start'];\n if (alignSelf === 'flex-end') {\n !b.empty() &&\n (child.attribute[cross.field] = this.updateChildPos(\n anchorPos - lenArray[i].crossLen + getPadding(child, cross.field),\n child.attribute[cross.field],\n b[`${cross.field}1`]\n ));\n } else if (alignSelf === 'center') {\n !b.empty() &&\n (child.attribute[cross.field] = this.updateChildPos(\n anchorPos - lenArray[i].crossLen / 2 + getPadding(child, cross.field),\n child.attribute[cross.field],\n b[`${cross.field}1`]\n ));\n } else {\n !b.empty() &&\n (child.attribute[cross.field] = this.updateChildPos(\n anchorPos + getPadding(child, cross.field),\n child.attribute[cross.field],\n b[`${cross.field}1`]\n ));\n }\n }\n // if (alignItem === 'flex-end') {\n // for (let i = lastIdx; i <= currSeg.idx; i++) {\n // children[i].attribute[cross.field] = this.updateChildPos(\n // anchorPos - lenArray[i].crossLen + getPadding(children[i], cross.field),\n // children[i].attribute[cross.field],\n // children[i].AABBBounds[`${cross.field}1`]\n // );\n // }\n // } else if (alignItem === 'center') {\n // for (let i = lastIdx; i <= currSeg.idx; i++) {\n // children[i].attribute[cross.field] = this.updateChildPos(\n // anchorPos - lenArray[i].crossLen / 2 + getPadding(children[i], cross.field),\n // children[i].attribute[cross.field],\n // children[i].AABBBounds[`${cross.field}1`]\n // );\n // }\n // } else {\n // for (let i = lastIdx; i <= currSeg.idx; i++) {\n // children[i].attribute[cross.field] = this.updateChildPos(\n // anchorPos + getPadding(children[i], cross.field),\n // children[i].attribute[cross.field],\n // children[i].AABBBounds[`${cross.field}1`]\n // );\n // }\n // }\n }\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n // 属性更新\n application.graphicService.hooks.onAttributeUpdate.tap(this.key, graphic => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (!(graphic.stage && graphic.stage === this.pluginService.stage)) {\n return;\n }\n this.tryLayout(graphic, false);\n });\n // 包围盒更新(如果包围盒发生变化,就重新布局\n application.graphicService.hooks.beforeUpdateAABBBounds.tap(\n this.key,\n (graphic: IGraphic, stage: IStage, willUpdate: boolean, bounds: IAABBBounds) => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (!(stage && stage === this.pluginService.stage)) {\n return;\n }\n if (!graphic.isContainer || this.skipBoundsTrigger) {\n return;\n }\n _tempBounds.copy(bounds);\n }\n );\n application.graphicService.hooks.afterUpdateAABBBounds.tap(\n this.key,\n (\n graphic: IGraphic,\n stage: IStage,\n bounds: IAABBBounds,\n params: { globalAABBBounds: IAABBBounds },\n selfChange: boolean\n ) => {\n if (!(stage && stage === this.pluginService.stage)) {\n return;\n }\n if (!graphic.isContainer || this.skipBoundsTrigger) {\n return;\n }\n if (!_tempBounds.equals(bounds)) {\n this.tryLayout(graphic, false);\n }\n }\n );\n // 添加到场景树\n application.graphicService.hooks.onSetStage.tap(this.key, graphic => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n this.tryLayout(graphic, false);\n });\n }\n deactivate(context: IPluginService): void {\n application.graphicService.hooks.onAttributeUpdate.taps =\n application.graphicService.hooks.onAttributeUpdate.taps.filter(item => {\n return item.name !== this.key;\n });\n application.graphicService.hooks.beforeUpdateAABBBounds.taps =\n application.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n application.graphicService.hooks.afterUpdateAABBBounds.taps =\n application.graphicService.hooks.afterUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n application.graphicService.hooks.onSetStage.taps = application.graphicService.hooks.onSetStage.taps.filter(item => {\n return item.name !== this.key;\n });\n }\n}\n\nfunction getPadding(graphic: IGraphic, field: string): number {\n // if (!graphic.attribute.boundsPadding) {\n // return 0;\n // } else if (isNumber(graphic.attribute.boundsPadding)) {\n // return graphic.attribute.boundsPadding as number;\n // } else if (isArray(graphic.attribute.boundsPadding) && graphic.attribute.boundsPadding.length === 1) {\n // return graphic.attribute.boundsPadding[0];\n // }\n // const paddingArray = parsePadding(graphic.attribute.boundsPadding);\n // if (field === 'x') {\n // return paddingArray[3];\n // } else if (field === 'y') {\n // return paddingArray[0];\n // }\n return 0;\n}\n\nexport const registerFlexLayoutPlugin = () => {\n Factory.registerPlugin('FlexLayoutPlugin', FlexLayoutPlugin);\n};\n"]}
1
+ {"version":3,"sources":["../src/plugins/builtin-plugin/flex-layout-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,WAAW,GAAG,IAAI,UAAU,EAAE,CAAC;AAQrC,MAAM,OAAO,gBAAgB;IAA7B;QACE,SAAI,GAAuB,kBAAkB,CAAC;QAC9C,gBAAW,GAAiB,YAAY,CAAC;QAEzC,OAAE,GAAW,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAC5C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;QA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AC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;AAC/D,CAAC,CAAC","file":"flex-layout-plugin.js","sourcesContent":["import type { IGraphic, IGroup, IGroupAttribute, IStage } from '../../interface';\nimport { getTheme } from '../../graphic/theme';\nimport type { IPlugin, IPluginService } from '../../interface';\nimport { Generator } from '../../common/generator';\nimport type { IAABBBounds } from '@visactor/vutils';\nimport { AABBBounds } from '@visactor/vutils';\nimport { application } from '../../application';\nimport { Factory } from '../../factory';\n\nconst _tempBounds = new AABBBounds();\n\ntype IAnchorPosMap = {\n 'flex-start': number;\n 'flex-end': number;\n center: number;\n};\n\nexport class FlexLayoutPlugin implements IPlugin {\n name: 'FlexLayoutPlugin' = 'FlexLayoutPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n id: number = Generator.GenAutoIncrementId();\n key: string = this.name + this.id;\n tempBounds: AABBBounds = new AABBBounds();\n pause: boolean;\n skipBoundsTrigger: boolean;\n\n pauseLayout(p: boolean) {\n this.pause = p;\n }\n\n tryLayoutChildren(graphic: IGraphic) {\n if (graphic.firstChild) {\n this.tryLayout(graphic.firstChild as IGraphic);\n }\n }\n\n tryLayout(graphic: IGraphic, force: boolean = true) {\n if (this.pause) {\n return;\n }\n const p = graphic.parent;\n if (!(force || (p && graphic.needUpdateLayout()))) {\n return;\n }\n const theme = getTheme(p).group;\n const { display = theme.display } = p.attribute;\n if (display !== 'flex') {\n return;\n }\n const {\n // width,\n // height,\n flexDirection = theme.flexDirection,\n flexWrap = theme.flexWrap,\n alignItems = theme.alignItems,\n clip = theme.clip\n } = p.attribute;\n const { alignContent = alignItems ?? theme.alignContent } = p.attribute;\n // if (!(width && height)) {\n // return;\n // }\n\n let { width, height, justifyContent = theme.justifyContent } = p.attribute;\n const children = p.getChildren() as IGraphic[];\n if (width == null || height == null) {\n // 计算子节点flex排列后的宽高\n let childrenWidth = 0;\n let childrenHeight = 0;\n let boundsLegal = 0;\n children.forEach((child: IGraphic) => {\n const bounds = this.getAABBBounds(child);\n if (bounds.empty()) {\n return;\n }\n if (flexDirection === 'column' || flexDirection === 'column-reverse') {\n childrenHeight += bounds.height();\n childrenWidth = Math.max(childrenWidth, bounds.width());\n } else {\n childrenWidth += bounds.width();\n childrenHeight = Math.max(childrenHeight, bounds.height());\n }\n boundsLegal += bounds.x1;\n boundsLegal += bounds.y1;\n boundsLegal += bounds.x2;\n boundsLegal += bounds.y2;\n });\n // judgement children bounds legal\n if (!isFinite(boundsLegal)) {\n return;\n }\n width = childrenWidth;\n height = childrenHeight;\n }\n\n if (p.attribute.width == null) {\n p.attribute.width = width;\n } else {\n width = p.attribute.width;\n }\n if (p.attribute.height == null) {\n p.attribute.height = height;\n } else {\n height = p.attribute.height;\n }\n\n // 这里使用p._AABBBounds可能会将非布局造成的bounds更新也会触发重新布局\n // TODO: 增加layout前预处理,在非递归布局前将子节点及其全部父节点_AABBBounds更新\n this.tempBounds.copy(p._AABBBounds);\n const result = {\n main: { len: width, field: 'x' },\n cross: { len: height, field: 'y' }\n };\n const main = result.main;\n const cross = result.cross;\n if (flexDirection === 'column' || flexDirection === 'column-reverse') {\n main.len = height;\n cross.len = width;\n main.field = 'y';\n cross.field = 'x';\n }\n if (flexDirection === 'row-reverse' || flexDirection === 'column-reverse') {\n if (justifyContent === 'flex-start') {\n justifyContent = 'flex-end';\n } else if (justifyContent === 'flex-end') {\n justifyContent = 'flex-start';\n } else {\n children.reverse();\n }\n }\n\n // 计算宽度\n let mainLen = 0;\n let crossLen = 0;\n const mianLenArray: { mainLen: number; crossLen: number }[] = [];\n children.forEach((c: IGraphic) => {\n const b = this.getAABBBounds(c);\n if (b.empty()) {\n return;\n }\n const ml = main.field === 'x' ? b.width() : b.height();\n const cl = cross.field === 'x' ? b.width() : b.height();\n mianLenArray.push({ mainLen: ml, crossLen: cl });\n mainLen += ml;\n crossLen = Math.max(crossLen, cl);\n });\n // 解析main\n const mainList: { idx: number; mainLen: number; crossLen: number }[] = [];\n if (mainLen > main.len && flexWrap === 'wrap') {\n let tempMainL = 0;\n let tempCrossL = 0;\n mianLenArray.forEach(({ mainLen, crossLen }, i) => {\n if (tempMainL + mainLen > main.len) {\n if (tempMainL === 0) {\n mainList.push({ idx: i, mainLen: tempMainL + mainLen, crossLen });\n tempMainL = 0;\n tempCrossL = 0;\n } else {\n mainList.push({ idx: i - 1, mainLen: tempMainL, crossLen: tempCrossL });\n tempMainL = mainLen;\n tempCrossL = crossLen;\n }\n } else {\n tempMainL += mainLen;\n tempCrossL = Math.max(tempCrossL, crossLen);\n }\n });\n mainList.push({ idx: mianLenArray.length - 1, mainLen: tempMainL, crossLen: tempCrossL });\n } else {\n mainList.push({ idx: mianLenArray.length - 1, mainLen: mainLen, crossLen });\n }\n\n // 布局main\n let lastIdx: number = 0;\n mainList.forEach(s => {\n this.layoutMain(p, children, justifyContent, main, mianLenArray, lastIdx, s);\n lastIdx = s.idx + 1;\n });\n\n crossLen = mainList.reduce((a, b) => a + b.crossLen, 0);\n\n // 布局cross\n\n if (mainList.length === 1) {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': 0,\n 'flex-end': cross.len,\n center: cross.len / 2\n };\n this.layoutCross(children, alignItems, cross, anchorPosMap, mianLenArray, mainList[0], 0);\n } else {\n if (alignContent === 'flex-start') {\n lastIdx = 0;\n let anchorPos = 0;\n mainList.forEach((s, i) => {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': anchorPos,\n 'flex-end': anchorPos + s.crossLen,\n center: anchorPos + s.crossLen / 2\n };\n this.layoutCross(children, 'flex-start', cross, anchorPosMap, mianLenArray, mainList[i], lastIdx);\n lastIdx = s.idx + 1;\n anchorPos += s.crossLen;\n });\n } else if (alignContent === 'center') {\n lastIdx = 0;\n const padding = Math.max(0, (cross.len - crossLen) / 2);\n let anchorPos = padding;\n mainList.forEach((s, i) => {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': anchorPos,\n 'flex-end': anchorPos + s.crossLen,\n center: anchorPos + s.crossLen / 2\n };\n this.layoutCross(children, 'center', cross, anchorPosMap, mianLenArray, mainList[i], lastIdx);\n lastIdx = s.idx + 1;\n anchorPos += s.crossLen;\n });\n } else if (alignContent === 'space-around') {\n lastIdx = 0;\n const padding = Math.max(0, (cross.len - crossLen) / mainList.length / 2);\n let anchorPos = padding;\n mainList.forEach((s, i) => {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': anchorPos,\n 'flex-end': anchorPos + s.crossLen,\n center: anchorPos + s.crossLen / 2\n };\n this.layoutCross(children, 'flex-start', cross, anchorPosMap, mianLenArray, mainList[i], lastIdx);\n lastIdx = s.idx + 1;\n anchorPos += s.crossLen + padding * 2;\n });\n } else if (alignContent === 'space-between') {\n lastIdx = 0;\n const padding = Math.max(0, (cross.len - crossLen) / (mainList.length * 2 - 2));\n let anchorPos = 0;\n mainList.forEach((s, i) => {\n const anchorPosMap: IAnchorPosMap = {\n 'flex-start': anchorPos,\n 'flex-end': anchorPos + s.crossLen,\n center: anchorPos + s.crossLen / 2\n };\n this.layoutCross(children, 'flex-start', cross, anchorPosMap, mianLenArray, mainList[i], lastIdx);\n lastIdx = s.idx + 1;\n anchorPos += s.crossLen + padding * 2;\n });\n }\n }\n\n // update children\n children.forEach((child, idx) => {\n child.addUpdateBoundTag();\n child.addUpdatePositionTag();\n child.clearUpdateLayoutTag();\n });\n\n p.addUpdateLayoutTag();\n // 更新父级元素的layout,直到存在clip\n const b = this.getAABBBounds(p);\n if (!clip && !this.tempBounds.equals(b)) {\n // 判断父元素包围盒是否发生变化\n this.tryLayout(p, false);\n }\n }\n\n // 避免获取bounds的时候递归进行布局\n getAABBBounds(graphic: IGraphic) {\n this.skipBoundsTrigger = true;\n const b = graphic.AABBBounds;\n this.skipBoundsTrigger = false;\n return b;\n }\n\n // 锚点并不一定总在左上角,根据位置和bounds的偏移进行定位\n private updateChildPos(posBaseLeftTop: number, lastP: number | undefined, lastBP: number): number {\n return posBaseLeftTop + (lastP ?? 0) - lastBP;\n }\n\n layoutMain(\n p: IGroup,\n children: IGraphic[],\n justifyContent: IGroupAttribute['justifyContent'],\n main: { len: number; field: string },\n mianLenArray: { mainLen: number; crossLen: number }[],\n lastIdx: number,\n currSeg: { idx: number; mainLen: number; crossLen: number }\n ) {\n if (justifyContent === 'flex-start') {\n let pos = 0;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen;\n }\n } else if (justifyContent === 'flex-end') {\n let pos = main.len;\n for (let i = currSeg.idx; i >= lastIdx; i--) {\n pos -= mianLenArray[i].mainLen;\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n }\n } else if (justifyContent === 'space-around') {\n if (currSeg.mainLen >= main.len) {\n let pos = 0;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen;\n }\n } else {\n const size = currSeg.idx - lastIdx + 1;\n const padding = (main.len - currSeg.mainLen) / size / 2;\n let pos = padding;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen + padding * 2;\n }\n }\n } else if (justifyContent === 'space-between') {\n if (currSeg.mainLen >= main.len) {\n let pos = 0;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen;\n }\n } else {\n const size = currSeg.idx - lastIdx + 1;\n const padding = (main.len - currSeg.mainLen) / (size * 2 - 2);\n let pos = 0;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen + padding * 2;\n }\n }\n } else if (justifyContent === 'center') {\n let pos = (main.len - currSeg.mainLen) / 2;\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const posBaseLeftTop = pos + getPadding(children[i], main.field);\n const b = this.getAABBBounds(children[i]);\n !b.empty() &&\n (children[i].attribute[main.field] = this.updateChildPos(\n posBaseLeftTop,\n children[i].attribute[main.field],\n b[`${main.field}1`]\n ));\n pos += mianLenArray[i].mainLen;\n }\n }\n }\n\n layoutCross(\n children: IGraphic[],\n alignItem: IGroupAttribute['alignItems'],\n cross: { len: number; field: string },\n anchorPosMap: IAnchorPosMap,\n lenArray: { mainLen: number; crossLen: number }[],\n currSeg: { idx: number; mainLen: number; crossLen: number },\n lastIdx: number\n ) {\n for (let i = lastIdx; i <= currSeg.idx; i++) {\n const child = children[i];\n let { alignSelf } = child.attribute;\n if (!alignSelf || alignSelf === 'auto') {\n alignSelf = alignItem;\n }\n const b = this.getAABBBounds(child);\n const anchorPos = anchorPosMap[alignSelf] ?? anchorPosMap['flex-start'];\n if (alignSelf === 'flex-end') {\n !b.empty() &&\n (child.attribute[cross.field] = this.updateChildPos(\n anchorPos - lenArray[i].crossLen + getPadding(child, cross.field),\n child.attribute[cross.field],\n b[`${cross.field}1`]\n ));\n } else if (alignSelf === 'center') {\n !b.empty() &&\n (child.attribute[cross.field] = this.updateChildPos(\n anchorPos - lenArray[i].crossLen / 2 + getPadding(child, cross.field),\n child.attribute[cross.field],\n b[`${cross.field}1`]\n ));\n } else {\n !b.empty() &&\n (child.attribute[cross.field] = this.updateChildPos(\n anchorPos + getPadding(child, cross.field),\n child.attribute[cross.field],\n b[`${cross.field}1`]\n ));\n }\n }\n // if (alignItem === 'flex-end') {\n // for (let i = lastIdx; i <= currSeg.idx; i++) {\n // children[i].attribute[cross.field] = this.updateChildPos(\n // anchorPos - lenArray[i].crossLen + getPadding(children[i], cross.field),\n // children[i].attribute[cross.field],\n // children[i].AABBBounds[`${cross.field}1`]\n // );\n // }\n // } else if (alignItem === 'center') {\n // for (let i = lastIdx; i <= currSeg.idx; i++) {\n // children[i].attribute[cross.field] = this.updateChildPos(\n // anchorPos - lenArray[i].crossLen / 2 + getPadding(children[i], cross.field),\n // children[i].attribute[cross.field],\n // children[i].AABBBounds[`${cross.field}1`]\n // );\n // }\n // } else {\n // for (let i = lastIdx; i <= currSeg.idx; i++) {\n // children[i].attribute[cross.field] = this.updateChildPos(\n // anchorPos + getPadding(children[i], cross.field),\n // children[i].attribute[cross.field],\n // children[i].AABBBounds[`${cross.field}1`]\n // );\n // }\n // }\n }\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n const stage = this.pluginService.stage;\n if (!stage) {\n return;\n }\n // 属性更新\n stage.graphicService.hooks.onAttributeUpdate.tap(this.key, graphic => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (!(graphic.stage && graphic.stage === this.pluginService.stage)) {\n return;\n }\n this.tryLayout(graphic, false);\n });\n // 包围盒更新(如果包围盒发生变化,就重新布局\n stage.graphicService.hooks.beforeUpdateAABBBounds.tap(\n this.key,\n (graphic: IGraphic, stage: IStage, willUpdate: boolean, bounds: IAABBBounds) => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (!(stage && stage === this.pluginService.stage)) {\n return;\n }\n if (!graphic.isContainer || this.skipBoundsTrigger) {\n return;\n }\n _tempBounds.copy(bounds);\n }\n );\n stage.graphicService.hooks.afterUpdateAABBBounds.tap(\n this.key,\n (\n graphic: IGraphic,\n stage: IStage,\n bounds: IAABBBounds,\n params: { globalAABBBounds: IAABBBounds },\n selfChange: boolean\n ) => {\n if (!(stage && stage === this.pluginService.stage)) {\n return;\n }\n if (!graphic.isContainer || this.skipBoundsTrigger) {\n return;\n }\n if (!_tempBounds.equals(bounds)) {\n this.tryLayout(graphic, false);\n }\n }\n );\n // 添加到场景树\n stage.graphicService.hooks.onSetStage.tap(this.key, graphic => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n this.tryLayout(graphic, false);\n });\n }\n deactivate(context: IPluginService): void {\n const stage = this.pluginService.stage;\n if (!stage) {\n return;\n }\n stage.graphicService.hooks.onAttributeUpdate.taps = stage.graphicService.hooks.onAttributeUpdate.taps.filter(\n item => {\n return item.name !== this.key;\n }\n );\n stage.graphicService.hooks.beforeUpdateAABBBounds.taps =\n stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.graphicService.hooks.afterUpdateAABBBounds.taps =\n stage.graphicService.hooks.afterUpdateAABBBounds.taps.filter(item => {\n return item.name !== this.key;\n });\n stage.graphicService.hooks.onSetStage.taps = stage.graphicService.hooks.onSetStage.taps.filter(item => {\n return item.name !== this.key;\n });\n }\n}\n\nfunction getPadding(graphic: IGraphic, field: string): number {\n // if (!graphic.attribute.boundsPadding) {\n // return 0;\n // } else if (isNumber(graphic.attribute.boundsPadding)) {\n // return graphic.attribute.boundsPadding as number;\n // } else if (isArray(graphic.attribute.boundsPadding) && graphic.attribute.boundsPadding.length === 1) {\n // return graphic.attribute.boundsPadding[0];\n // }\n // const paddingArray = parsePadding(graphic.attribute.boundsPadding);\n // if (field === 'x') {\n // return paddingArray[3];\n // } else if (field === 'y') {\n // return paddingArray[0];\n // }\n return 0;\n}\n\nexport const registerFlexLayoutPlugin = () => {\n Factory.registerPlugin('FlexLayoutPlugin', FlexLayoutPlugin);\n};\n"]}
@@ -31,7 +31,6 @@ export class HtmlAttributePlugin {
31
31
  }
32
32
  deactivate(context) {
33
33
  context.stage.hooks.afterRender.taps = context.stage.hooks.afterRender.taps.filter((item => item.name !== this.key)),
34
- application.graphicService.hooks.onRemove.unTap(this.key), application.graphicService.hooks.onRelease.unTap(this.key),
35
34
  this.release();
36
35
  }
37
36
  getWrapContainer(stage, userContainer, domParams) {