@visactor/vrender-core 0.22.15-alpha.1 → 0.22.15

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 (441) hide show
  1. package/cjs/animate/Ticker/default-ticker.d.ts +40 -0
  2. package/cjs/animate/Ticker/default-ticker.js +140 -0
  3. package/cjs/animate/Ticker/default-ticker.js.map +1 -0
  4. package/cjs/animate/Ticker/index.d.ts +5 -0
  5. package/cjs/{interface/animation → animate/Ticker}/index.js +3 -3
  6. package/cjs/animate/Ticker/index.js.map +1 -0
  7. package/cjs/animate/Ticker/manual-ticker-handler.d.ts +15 -0
  8. package/cjs/animate/Ticker/manual-ticker-handler.js +36 -0
  9. package/cjs/animate/Ticker/manual-ticker-handler.js.map +1 -0
  10. package/cjs/animate/Ticker/manual-ticker.d.ts +19 -0
  11. package/cjs/animate/Ticker/manual-ticker.js +37 -0
  12. package/cjs/animate/Ticker/manual-ticker.js.map +1 -0
  13. package/cjs/animate/Ticker/raf-tick-handler.d.ts +9 -0
  14. package/cjs/animate/Ticker/raf-tick-handler.js +30 -0
  15. package/cjs/animate/Ticker/raf-tick-handler.js.map +1 -0
  16. package/cjs/animate/Ticker/timeout-tick-handler.d.ts +9 -0
  17. package/cjs/animate/Ticker/timeout-tick-handler.js +28 -0
  18. package/cjs/animate/Ticker/timeout-tick-handler.js.map +1 -0
  19. package/cjs/animate/Ticker/type.d.ts +6 -0
  20. package/cjs/{interface/animation/ticker.js → animate/Ticker/type.js} +1 -1
  21. package/cjs/animate/Ticker/type.js.map +1 -0
  22. package/cjs/animate/animate.d.ts +147 -0
  23. package/cjs/animate/animate.js +403 -0
  24. package/cjs/animate/animate.js.map +1 -0
  25. package/cjs/animate/config.d.ts +2 -1
  26. package/cjs/animate/config.js +5 -1
  27. package/cjs/animate/config.js.map +1 -1
  28. package/cjs/animate/custom-animate.d.ts +236 -0
  29. package/cjs/animate/custom-animate.js +726 -0
  30. package/cjs/animate/custom-animate.js.map +1 -0
  31. package/cjs/animate/default-ticker.d.ts +2 -0
  32. package/cjs/animate/default-ticker.js +14 -0
  33. package/cjs/animate/default-ticker.js.map +1 -0
  34. package/cjs/animate/easing-func.d.ts +1 -0
  35. package/cjs/animate/easing-func.js +16 -0
  36. package/cjs/animate/easing-func.js.map +1 -0
  37. package/cjs/animate/easing.d.ts +49 -0
  38. package/cjs/animate/easing.js +141 -0
  39. package/cjs/animate/easing.js.map +1 -0
  40. package/cjs/animate/group-fade.d.ts +16 -0
  41. package/cjs/animate/group-fade.js +66 -0
  42. package/cjs/animate/group-fade.js.map +1 -0
  43. package/cjs/animate/index.d.ts +8 -0
  44. package/cjs/animate/index.js +24 -0
  45. package/cjs/animate/index.js.map +1 -0
  46. package/cjs/animate/morphing.d.ts +52 -0
  47. package/cjs/animate/morphing.js +292 -0
  48. package/cjs/animate/morphing.js.map +1 -0
  49. package/cjs/animate/timeline.d.ts +17 -0
  50. package/cjs/animate/timeline.js +46 -0
  51. package/cjs/animate/timeline.js.map +1 -0
  52. package/cjs/application.d.ts +1 -2
  53. package/cjs/application.js.map +1 -1
  54. package/cjs/canvas/constants.js +2 -1
  55. package/cjs/canvas/empty-context.d.ts +0 -1
  56. package/cjs/canvas/empty-context.js +0 -4
  57. package/cjs/canvas/empty-context.js.map +1 -1
  58. package/cjs/color-string/interpolate.d.ts +0 -1
  59. package/cjs/color-string/interpolate.js +4 -12
  60. package/cjs/color-string/interpolate.js.map +1 -1
  61. package/cjs/color-string/store.js +1 -2
  62. package/cjs/common/custom-path2d.js +2 -2
  63. package/cjs/common/custom-path2d.js.map +1 -1
  64. package/cjs/common/enums.d.ts +16 -0
  65. package/cjs/common/enums.js +11 -2
  66. package/cjs/common/enums.js.map +1 -1
  67. package/cjs/common/morphing-utils.js +124 -32
  68. package/cjs/common/morphing-utils.js.map +1 -1
  69. package/cjs/common/polygon.js +2 -5
  70. package/cjs/common/polygon.js.map +1 -1
  71. package/cjs/common/segment/curve/cubic-bezier.d.ts +2 -1
  72. package/cjs/common/segment/curve/cubic-bezier.js +8 -3
  73. package/cjs/common/segment/curve/cubic-bezier.js.map +1 -1
  74. package/cjs/common/segment/curve/quadratic-bezier.d.ts +0 -1
  75. package/cjs/common/segment/curve/quadratic-bezier.js +3 -10
  76. package/cjs/common/segment/curve/quadratic-bezier.js.map +1 -1
  77. package/cjs/common/segment/index.d.ts +0 -1
  78. package/cjs/common/segment/index.js +1 -1
  79. package/cjs/common/segment/index.js.map +1 -1
  80. package/cjs/common/shape/arc.d.ts +1 -1
  81. package/cjs/common/shape/arc.js +3 -7
  82. package/cjs/common/shape/arc.js.map +1 -1
  83. package/cjs/common/simplify.js +2 -1
  84. package/cjs/common/sort.js +1 -1
  85. package/cjs/common/split-path.js +2 -2
  86. package/cjs/common/split-path.js.map +1 -1
  87. package/cjs/common/store.js +1 -1
  88. package/cjs/common/text.js +1 -1
  89. package/cjs/common/utils.d.ts +2 -0
  90. package/cjs/common/utils.js +9 -5
  91. package/cjs/common/utils.js.map +1 -1
  92. package/cjs/core/application.js +1 -1
  93. package/cjs/core/camera.js +1 -1
  94. package/cjs/core/global.d.ts +0 -3
  95. package/cjs/core/global.js +3 -14
  96. package/cjs/core/global.js.map +1 -1
  97. package/cjs/core/stage.d.ts +3 -8
  98. package/cjs/core/stage.js +20 -34
  99. package/cjs/core/stage.js.map +1 -1
  100. package/cjs/graphic/arc.d.ts +2 -1
  101. package/cjs/graphic/arc.js +2 -3
  102. package/cjs/graphic/arc.js.map +1 -1
  103. package/cjs/graphic/area.d.ts +2 -1
  104. package/cjs/graphic/area.js +1 -4
  105. package/cjs/graphic/area.js.map +1 -1
  106. package/cjs/graphic/circle.d.ts +2 -1
  107. package/cjs/graphic/circle.js +2 -5
  108. package/cjs/graphic/circle.js.map +1 -1
  109. package/cjs/graphic/config.js +1 -2
  110. package/cjs/graphic/config.js.map +1 -1
  111. package/cjs/graphic/graphic-service/graphic-module.js +2 -1
  112. package/cjs/graphic/graphic-service/graphic-module.js.map +1 -1
  113. package/cjs/graphic/graphic-service/graphic-service.js +3 -2
  114. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  115. package/cjs/graphic/graphic.d.ts +12 -9
  116. package/cjs/graphic/graphic.js +105 -48
  117. package/cjs/graphic/graphic.js.map +1 -1
  118. package/cjs/graphic/group.js +8 -8
  119. package/cjs/graphic/group.js.map +1 -1
  120. package/cjs/graphic/line.d.ts +2 -1
  121. package/cjs/graphic/line.js +1 -5
  122. package/cjs/graphic/line.js.map +1 -1
  123. package/cjs/graphic/rect.js +2 -5
  124. package/cjs/graphic/rect.js.map +1 -1
  125. package/cjs/graphic/richtext/icon.d.ts +1 -1
  126. package/cjs/graphic/richtext/icon.js.map +1 -1
  127. package/cjs/graphic/richtext/paragraph.js +2 -2
  128. package/cjs/graphic/richtext/paragraph.js.map +1 -1
  129. package/cjs/graphic/star.d.ts +2 -1
  130. package/cjs/graphic/star.js +2 -4
  131. package/cjs/graphic/star.js.map +1 -1
  132. package/cjs/index.d.ts +3 -2
  133. package/cjs/index.js +16 -14
  134. package/cjs/index.js.map +1 -1
  135. package/cjs/interface/animate.d.ts +160 -1
  136. package/cjs/interface/animate.js +4 -1
  137. package/cjs/interface/animate.js.map +1 -1
  138. package/cjs/interface/context.d.ts +0 -1
  139. package/cjs/interface/context.js.map +1 -1
  140. package/cjs/interface/global.d.ts +0 -2
  141. package/cjs/interface/global.js.map +1 -1
  142. package/cjs/interface/graphic.d.ts +3 -11
  143. package/cjs/interface/graphic.js.map +1 -1
  144. package/cjs/interface/index.d.ts +1 -1
  145. package/cjs/interface/index.js +9 -9
  146. package/cjs/interface/index.js.map +1 -1
  147. package/cjs/interface/render.d.ts +0 -7
  148. package/cjs/interface/render.js.map +1 -1
  149. package/cjs/interface/stage.d.ts +1 -4
  150. package/cjs/interface/stage.js.map +1 -1
  151. package/cjs/modules.d.ts +1 -2
  152. package/cjs/modules.js +3 -4
  153. package/cjs/modules.js.map +1 -1
  154. package/cjs/plugins/builtin-plugin/auto-render-plugin.js +8 -9
  155. package/cjs/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
  156. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +11 -14
  157. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  158. package/cjs/plugins/builtin-plugin/edit-module.js +4 -4
  159. package/cjs/plugins/builtin-plugin/edit-module.js.map +1 -1
  160. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +10 -13
  161. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  162. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +1 -0
  163. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  164. package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js +5 -8
  165. package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js.map +1 -1
  166. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.d.ts +1 -0
  167. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.js +3 -0
  168. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.js.map +1 -0
  169. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.d.ts +2 -2
  170. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +5 -6
  171. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
  172. package/cjs/render/contributions/render/arc-render.d.ts +2 -4
  173. package/cjs/render/contributions/render/arc-render.js +17 -19
  174. package/cjs/render/contributions/render/arc-render.js.map +1 -1
  175. package/cjs/render/contributions/render/area-render.js +2 -2
  176. package/cjs/render/contributions/render/area-render.js.map +1 -1
  177. package/cjs/render/contributions/render/base-render.d.ts +2 -2
  178. package/cjs/render/contributions/render/base-render.js +2 -2
  179. package/cjs/render/contributions/render/base-render.js.map +1 -1
  180. package/cjs/render/contributions/render/draw-contribution.d.ts +0 -1
  181. package/cjs/render/contributions/render/draw-contribution.js +19 -23
  182. package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
  183. package/cjs/render/contributions/render/draw-interceptor.js +1 -2
  184. package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
  185. package/cjs/render/contributions/render/group-render.d.ts +2 -2
  186. package/cjs/render/contributions/render/group-render.js +11 -15
  187. package/cjs/render/contributions/render/group-render.js.map +1 -1
  188. package/cjs/render/contributions/render/line-render.js +1 -1
  189. package/cjs/render/contributions/render/line-render.js.map +1 -1
  190. package/cjs/render/contributions/render/rect-render.d.ts +1 -3
  191. package/cjs/render/contributions/render/rect-render.js +15 -17
  192. package/cjs/render/contributions/render/rect-render.js.map +1 -1
  193. package/cjs/render/contributions/render/symbol-render.d.ts +2 -4
  194. package/cjs/render/contributions/render/symbol-render.js +11 -16
  195. package/cjs/render/contributions/render/symbol-render.js.map +1 -1
  196. package/cjs/render/render-service.d.ts +1 -1
  197. package/cjs/render/render-service.js.map +1 -1
  198. package/dist/index.es.js +8868 -6022
  199. package/es/animate/Ticker/default-ticker.d.ts +40 -0
  200. package/es/animate/Ticker/default-ticker.js +138 -0
  201. package/es/animate/Ticker/default-ticker.js.map +1 -0
  202. package/es/animate/Ticker/index.d.ts +5 -0
  203. package/es/animate/Ticker/index.js +10 -0
  204. package/es/animate/Ticker/index.js.map +1 -0
  205. package/es/animate/Ticker/manual-ticker-handler.d.ts +15 -0
  206. package/es/animate/Ticker/manual-ticker-handler.js +28 -0
  207. package/es/animate/Ticker/manual-ticker-handler.js.map +1 -0
  208. package/es/animate/Ticker/manual-ticker.d.ts +19 -0
  209. package/es/animate/Ticker/manual-ticker.js +31 -0
  210. package/es/animate/Ticker/manual-ticker.js.map +1 -0
  211. package/es/animate/Ticker/raf-tick-handler.d.ts +9 -0
  212. package/es/animate/Ticker/raf-tick-handler.js +22 -0
  213. package/es/animate/Ticker/raf-tick-handler.js.map +1 -0
  214. package/es/animate/Ticker/timeout-tick-handler.d.ts +9 -0
  215. package/es/animate/Ticker/timeout-tick-handler.js +20 -0
  216. package/es/animate/Ticker/timeout-tick-handler.js.map +1 -0
  217. package/es/animate/Ticker/type.d.ts +6 -0
  218. package/es/{interface/animation/ticker.js → animate/Ticker/type.js} +1 -1
  219. package/es/animate/Ticker/type.js.map +1 -0
  220. package/es/animate/animate.d.ts +147 -0
  221. package/es/animate/animate.js +398 -0
  222. package/es/animate/animate.js.map +1 -0
  223. package/es/animate/config.d.ts +2 -1
  224. package/es/animate/config.js +5 -0
  225. package/es/animate/config.js.map +1 -1
  226. package/es/animate/custom-animate.d.ts +236 -0
  227. package/es/animate/custom-animate.js +703 -0
  228. package/es/animate/custom-animate.js.map +1 -0
  229. package/es/animate/default-ticker.d.ts +2 -0
  230. package/es/animate/default-ticker.js +12 -0
  231. package/es/animate/default-ticker.js.map +1 -0
  232. package/es/animate/easing-func.d.ts +1 -0
  233. package/es/animate/easing-func.js +10 -0
  234. package/es/animate/easing-func.js.map +1 -0
  235. package/es/animate/easing.d.ts +49 -0
  236. package/es/animate/easing.js +134 -0
  237. package/es/animate/easing.js.map +1 -0
  238. package/es/animate/group-fade.d.ts +16 -0
  239. package/es/animate/group-fade.js +56 -0
  240. package/es/animate/group-fade.js.map +1 -0
  241. package/es/animate/index.d.ts +8 -0
  242. package/es/animate/index.js +16 -0
  243. package/es/animate/index.js.map +1 -0
  244. package/es/animate/morphing.d.ts +52 -0
  245. package/es/animate/morphing.js +295 -0
  246. package/es/animate/morphing.js.map +1 -0
  247. package/es/animate/timeline.d.ts +17 -0
  248. package/es/animate/timeline.js +42 -0
  249. package/es/animate/timeline.js.map +1 -0
  250. package/es/application.d.ts +1 -2
  251. package/es/application.js.map +1 -1
  252. package/es/canvas/constants.js +2 -1
  253. package/es/canvas/empty-context.d.ts +0 -1
  254. package/es/canvas/empty-context.js +0 -4
  255. package/es/canvas/empty-context.js.map +1 -1
  256. package/es/color-string/interpolate.d.ts +0 -1
  257. package/es/color-string/interpolate.js +1 -8
  258. package/es/color-string/interpolate.js.map +1 -1
  259. package/es/color-string/store.js +1 -2
  260. package/es/common/custom-path2d.js +2 -2
  261. package/es/common/custom-path2d.js.map +1 -1
  262. package/es/common/enums.d.ts +16 -0
  263. package/es/common/enums.js +20 -0
  264. package/es/common/enums.js.map +1 -1
  265. package/es/common/morphing-utils.js +124 -29
  266. package/es/common/morphing-utils.js.map +1 -1
  267. package/es/common/polygon.js +3 -6
  268. package/es/common/polygon.js.map +1 -1
  269. package/es/common/segment/curve/cubic-bezier.d.ts +2 -1
  270. package/es/common/segment/curve/cubic-bezier.js +8 -1
  271. package/es/common/segment/curve/cubic-bezier.js.map +1 -1
  272. package/es/common/segment/curve/quadratic-bezier.d.ts +0 -1
  273. package/es/common/segment/curve/quadratic-bezier.js +2 -5
  274. package/es/common/segment/curve/quadratic-bezier.js.map +1 -1
  275. package/es/common/segment/index.d.ts +0 -1
  276. package/es/common/segment/index.js +0 -2
  277. package/es/common/segment/index.js.map +1 -1
  278. package/es/common/shape/arc.d.ts +1 -1
  279. package/es/common/shape/arc.js +3 -7
  280. package/es/common/shape/arc.js.map +1 -1
  281. package/es/common/simplify.js +2 -1
  282. package/es/common/sort.js +1 -1
  283. package/es/common/split-path.js +2 -2
  284. package/es/common/split-path.js.map +1 -1
  285. package/es/common/store.js +1 -1
  286. package/es/common/text.js +1 -1
  287. package/es/common/utils.d.ts +2 -0
  288. package/es/common/utils.js +5 -1
  289. package/es/common/utils.js.map +1 -1
  290. package/es/core/application.js +1 -1
  291. package/es/core/camera.js +1 -1
  292. package/es/core/global.d.ts +0 -3
  293. package/es/core/global.js +2 -15
  294. package/es/core/global.js.map +1 -1
  295. package/es/core/stage.d.ts +3 -8
  296. package/es/core/stage.js +22 -35
  297. package/es/core/stage.js.map +1 -1
  298. package/es/graphic/arc.d.ts +2 -1
  299. package/es/graphic/arc.js +2 -3
  300. package/es/graphic/arc.js.map +1 -1
  301. package/es/graphic/area.d.ts +2 -1
  302. package/es/graphic/area.js +1 -4
  303. package/es/graphic/area.js.map +1 -1
  304. package/es/graphic/circle.d.ts +2 -1
  305. package/es/graphic/circle.js +2 -4
  306. package/es/graphic/circle.js.map +1 -1
  307. package/es/graphic/config.js +1 -2
  308. package/es/graphic/config.js.map +1 -1
  309. package/es/graphic/graphic-service/graphic-module.js +1 -1
  310. package/es/graphic/graphic-service/graphic-module.js.map +1 -1
  311. package/es/graphic/graphic-service/graphic-service.js +4 -1
  312. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  313. package/es/graphic/graphic.d.ts +12 -9
  314. package/es/graphic/graphic.js +109 -52
  315. package/es/graphic/graphic.js.map +1 -1
  316. package/es/graphic/group.js +7 -7
  317. package/es/graphic/group.js.map +1 -1
  318. package/es/graphic/line.d.ts +2 -1
  319. package/es/graphic/line.js +1 -5
  320. package/es/graphic/line.js.map +1 -1
  321. package/es/graphic/rect.js +2 -5
  322. package/es/graphic/rect.js.map +1 -1
  323. package/es/graphic/richtext/icon.d.ts +1 -1
  324. package/es/graphic/richtext/icon.js.map +1 -1
  325. package/es/graphic/richtext/paragraph.js +2 -2
  326. package/es/graphic/richtext/paragraph.js.map +1 -1
  327. package/es/graphic/star.d.ts +2 -1
  328. package/es/graphic/star.js +2 -4
  329. package/es/graphic/star.js.map +1 -1
  330. package/es/index.d.ts +3 -2
  331. package/es/index.js +6 -4
  332. package/es/index.js.map +1 -1
  333. package/es/interface/animate.d.ts +160 -1
  334. package/es/interface/animate.js +1 -2
  335. package/es/interface/animate.js.map +1 -1
  336. package/es/interface/context.d.ts +0 -1
  337. package/es/interface/context.js.map +1 -1
  338. package/es/interface/global.d.ts +0 -2
  339. package/es/interface/global.js.map +1 -1
  340. package/es/interface/graphic.d.ts +3 -11
  341. package/es/interface/graphic.js.map +1 -1
  342. package/es/interface/index.d.ts +1 -1
  343. package/es/interface/index.js +2 -2
  344. package/es/interface/index.js.map +1 -1
  345. package/es/interface/render.d.ts +0 -7
  346. package/es/interface/render.js.map +1 -1
  347. package/es/interface/stage.d.ts +1 -4
  348. package/es/interface/stage.js.map +1 -1
  349. package/es/modules.d.ts +1 -2
  350. package/es/modules.js +0 -6
  351. package/es/modules.js.map +1 -1
  352. package/es/plugins/builtin-plugin/auto-render-plugin.js +8 -8
  353. package/es/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
  354. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +12 -13
  355. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  356. package/es/plugins/builtin-plugin/edit-module.js +4 -4
  357. package/es/plugins/builtin-plugin/edit-module.js.map +1 -1
  358. package/es/plugins/builtin-plugin/flex-layout-plugin.js +11 -12
  359. package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  360. package/es/plugins/builtin-plugin/html-attribute-plugin.js +1 -0
  361. package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  362. package/es/plugins/builtin-plugin/incremental-auto-render-plugin.js +5 -8
  363. package/es/plugins/builtin-plugin/incremental-auto-render-plugin.js.map +1 -1
  364. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.d.ts +1 -0
  365. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.js +3 -0
  366. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.js.map +1 -0
  367. package/es/plugins/builtin-plugin/richtext-edit-plugin.d.ts +2 -2
  368. package/es/plugins/builtin-plugin/richtext-edit-plugin.js +5 -4
  369. package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
  370. package/es/render/contributions/render/arc-render.d.ts +2 -4
  371. package/es/render/contributions/render/arc-render.js +17 -19
  372. package/es/render/contributions/render/arc-render.js.map +1 -1
  373. package/es/render/contributions/render/area-render.js +2 -2
  374. package/es/render/contributions/render/area-render.js.map +1 -1
  375. package/es/render/contributions/render/base-render.d.ts +2 -2
  376. package/es/render/contributions/render/base-render.js +2 -2
  377. package/es/render/contributions/render/base-render.js.map +1 -1
  378. package/es/render/contributions/render/draw-contribution.d.ts +0 -1
  379. package/es/render/contributions/render/draw-contribution.js +19 -23
  380. package/es/render/contributions/render/draw-contribution.js.map +1 -1
  381. package/es/render/contributions/render/draw-interceptor.js +1 -2
  382. package/es/render/contributions/render/draw-interceptor.js.map +1 -1
  383. package/es/render/contributions/render/group-render.d.ts +2 -2
  384. package/es/render/contributions/render/group-render.js +11 -15
  385. package/es/render/contributions/render/group-render.js.map +1 -1
  386. package/es/render/contributions/render/line-render.js +1 -1
  387. package/es/render/contributions/render/line-render.js.map +1 -1
  388. package/es/render/contributions/render/rect-render.d.ts +1 -3
  389. package/es/render/contributions/render/rect-render.js +14 -17
  390. package/es/render/contributions/render/rect-render.js.map +1 -1
  391. package/es/render/contributions/render/symbol-render.d.ts +2 -4
  392. package/es/render/contributions/render/symbol-render.js +11 -16
  393. package/es/render/contributions/render/symbol-render.js.map +1 -1
  394. package/es/render/render-service.d.ts +1 -1
  395. package/es/render/render-service.js.map +1 -1
  396. package/package.json +4 -4
  397. package/cjs/common/diff.d.ts +0 -1
  398. package/cjs/common/diff.js +0 -19
  399. package/cjs/common/diff.js.map +0 -1
  400. package/cjs/common/performance-raf.d.ts +0 -8
  401. package/cjs/common/performance-raf.js +0 -32
  402. package/cjs/common/performance-raf.js.map +0 -1
  403. package/cjs/interface/animation/animate.d.ts +0 -117
  404. package/cjs/interface/animation/animate.js +0 -10
  405. package/cjs/interface/animation/animate.js.map +0 -1
  406. package/cjs/interface/animation/easing.d.ts +0 -3
  407. package/cjs/interface/animation/easing.js +0 -6
  408. package/cjs/interface/animation/easing.js.map +0 -1
  409. package/cjs/interface/animation/index.d.ts +0 -5
  410. package/cjs/interface/animation/index.js.map +0 -1
  411. package/cjs/interface/animation/ticker.d.ts +0 -39
  412. package/cjs/interface/animation/ticker.js.map +0 -1
  413. package/cjs/interface/animation/timeline.d.ts +0 -17
  414. package/cjs/interface/animation/timeline.js +0 -6
  415. package/cjs/interface/animation/timeline.js.map +0 -1
  416. package/cjs/interface/animation/type.d.ts +0 -13
  417. package/cjs/interface/animation/type.js +0 -15
  418. package/cjs/interface/animation/type.js.map +0 -1
  419. package/es/common/diff.d.ts +0 -1
  420. package/es/common/diff.js +0 -11
  421. package/es/common/diff.js.map +0 -1
  422. package/es/common/performance-raf.d.ts +0 -8
  423. package/es/common/performance-raf.js +0 -24
  424. package/es/common/performance-raf.js.map +0 -1
  425. package/es/interface/animation/animate.d.ts +0 -117
  426. package/es/interface/animation/animate.js +0 -6
  427. package/es/interface/animation/animate.js.map +0 -1
  428. package/es/interface/animation/easing.d.ts +0 -3
  429. package/es/interface/animation/easing.js +0 -2
  430. package/es/interface/animation/easing.js.map +0 -1
  431. package/es/interface/animation/index.d.ts +0 -5
  432. package/es/interface/animation/index.js +0 -10
  433. package/es/interface/animation/index.js.map +0 -1
  434. package/es/interface/animation/ticker.d.ts +0 -39
  435. package/es/interface/animation/ticker.js.map +0 -1
  436. package/es/interface/animation/timeline.d.ts +0 -17
  437. package/es/interface/animation/timeline.js +0 -2
  438. package/es/interface/animation/timeline.js.map +0 -1
  439. package/es/interface/animation/type.d.ts +0 -13
  440. package/es/interface/animation/type.js +0 -14
  441. package/es/interface/animation/type.js.map +0 -1
@@ -21,14 +21,7 @@ const inversify_lite_1 = require("../../../common/inversify-lite"), sort_1 = req
21
21
  let DefaultDrawContribution = class {
22
22
  constructor(contributions, drawItemInterceptorContributions) {
23
23
  this.contributions = contributions, this.drawItemInterceptorContributions = drawItemInterceptorContributions,
24
- this._renderInGroup = (skipSort, group, drawContext, nextM) => {
25
- var _a;
26
- skipSort ? group.forEachChildren((item => {
27
- drawContext.break || (item.isContainer ? this.renderGroup(item, drawContext, nextM) : this.renderItem(item, drawContext));
28
- })) : (0, sort_1.foreach)(group, config_1.DefaultAttribute.zIndex, (item => {
29
- drawContext.break || (item.isContainer ? this.renderGroup(item, drawContext, nextM) : this.renderItem(item, drawContext));
30
- }), !1, !!(null === (_a = drawContext.context) || void 0 === _a ? void 0 : _a.camera));
31
- }, this.currentRenderMap = new Map, this.defaultRenderMap = new Map, this.styleRenderMap = new Map,
24
+ this.currentRenderMap = new Map, this.defaultRenderMap = new Map, this.styleRenderMap = new Map,
32
25
  this.dirtyBounds = new vutils_1.Bounds, this.backupDirtyBounds = new vutils_1.Bounds,
33
26
  this.global = application_1.application.global, this.layerService = application_1.application.layerService,
34
27
  (0, vutils_1.isArray)(this.contributions) || (this.contributions = [ this.contributions ]),
@@ -66,17 +59,18 @@ let DefaultDrawContribution = class {
66
59
  (d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr,
67
60
  dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr,
68
61
  dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds),
69
- context.reset(!1), context.save(), context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f),
70
- context.clearMatrix(!1), context.translate(viewBox.x1, viewBox.y1, !0), context.beginPath(),
71
- context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()),
62
+ context.inuse = !0, context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f),
63
+ context.clearMatrix(), context.setTransformForCurrent(!0), context.translate(viewBox.x1, viewBox.y1, !0),
64
+ context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()),
72
65
  context.clip(), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0),
73
66
  this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext),
74
- renderService.renderTreeRoots.sort(((a, b) => {
67
+ context.save(), renderService.renderTreeRoots.sort(((a, b) => {
75
68
  var _a, _b;
76
69
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : config_1.DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : config_1.DefaultAttribute.zIndex);
77
70
  })).forEach((group => {
78
71
  group.isContainer ? this.renderGroup(group, drawContext, matrix_allocate_1.matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : this.renderItem(group, drawContext);
79
- })), context.restore(), context.draw();
72
+ })), context.restore(), context.setClearMatrix(1, 0, 0, 1, 0, 0), context.inuse = !1,
73
+ context.draw();
80
74
  }
81
75
  doRegister() {
82
76
  throw new Error("暂不支持");
@@ -102,13 +96,15 @@ let DefaultDrawContribution = class {
102
96
  nextM = matrix_allocate_1.matrixAllocate.allocateByObj(parentMatrix).multiply(gm.a, gm.b, gm.c, gm.d, gm.e, gm.f),
103
97
  this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(nextM.getInverse());
104
98
  }
105
- drawContext.isGroupScroll = !(!group.attribute.scrollX && !group.attribute.scrollY),
106
99
  this.renderItem(group, drawContext, {
107
- renderInGroupParams: {
108
- skipSort: skipSort,
109
- nextM: nextM
110
- },
111
- renderInGroup: this._renderInGroup
100
+ drawingCb: () => {
101
+ var _a;
102
+ skipSort ? group.forEachChildren((item => {
103
+ drawContext.break || (item.isContainer ? this.renderGroup(item, drawContext, nextM) : this.renderItem(item, drawContext));
104
+ })) : (0, sort_1.foreach)(group, config_1.DefaultAttribute.zIndex, (item => {
105
+ drawContext.break || (item.isContainer ? this.renderGroup(item, drawContext, nextM) : this.renderItem(item, drawContext));
106
+ }), !1, !!(null === (_a = drawContext.context) || void 0 === _a ? void 0 : _a.camera));
107
+ }
112
108
  }), this.useDirtyBounds && (this.dirtyBounds.copy(tempBounds), bounds_allocate_1.boundsAllocate.free(tempBounds),
113
109
  matrix_allocate_1.matrixAllocate.free(nextM));
114
110
  }
@@ -160,11 +156,11 @@ let DefaultDrawContribution = class {
160
156
  }
161
157
  const renderer = this.getRenderContribution(graphic);
162
158
  if (!renderer) return;
163
- let tempBounds, retrans = !1;
164
- if (drawContext.isGroupScroll) {
159
+ let tempBounds, retrans = this.scrollMatrix && (0 !== this.scrollMatrix.e || 0 !== this.scrollMatrix.f);
160
+ if (graphic.parent) {
165
161
  const {scrollX: scrollX = 0, scrollY: scrollY = 0} = graphic.parent.attribute;
166
- retrans = !0, this.scrollMatrix || (this.scrollMatrix = matrix_allocate_1.matrixAllocate.allocate(1, 0, 0, 1, 0, 0)),
167
- this.scrollMatrix.translate(-scrollX, -scrollY);
162
+ (scrollX || scrollY) && (retrans = !0, this.scrollMatrix || (this.scrollMatrix = matrix_allocate_1.matrixAllocate.allocate(1, 0, 0, 1, 0, 0)),
163
+ this.scrollMatrix.translate(-scrollX, -scrollY));
168
164
  }
169
165
  if (retrans && (tempBounds = this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix)),
170
166
  this.useDirtyBounds && !graphic.isContainer && "empty" !== graphic.attribute.boundsMode && !(0,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/draw-contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAAwF;AAexF,+CAAgE;AAEhE,iFAA6E;AAC7E,oDAA2D;AAE3D,6CAA8F;AAC9F,kDAA+C;AAC/C,qCAAsE;AACtE,yDAAyD;AACzD,+DAA2D;AAE3D,wEAAoE;AACpE,wEAAoE;AACpE,sDAAmD;AAM5C,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAgBlC,YAIiD,aAA+B,EAK3D,gCAAyF;QAL7D,kBAAa,GAAb,aAAa,CAAkB;QAK3D,qCAAgC,GAAhC,gCAAgC,CAAyD;QAsM9G,mBAAc,GAAG,CAAC,QAAiB,EAAE,KAAa,EAAE,WAAyB,EAAE,KAAc,EAAE,EAAE;;YAC/F,QAAQ;gBACN,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,IAAc,EAAE,EAAE;oBACvC,IAAI,WAAW,CAAC,KAAK,EAAE;wBACrB,OAAO;qBACR;oBACD,IAAI,IAAI,CAAC,WAAW,EAAE;wBACpB,IAAI,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AC,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE;oBAC9C,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;iBAClD;aACF;iBAAM;gBACL,OAAO,CAAC,SAAS,GAAG,IAAA,0BAAW,EAC7B,OAAO,EACP,KAAK,EACL;oBACE,UAAU,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,EAAE;iBAC5D,EACD,CAAC,EACD,CAAC,CACF,CAAC;gBACF,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;aACvC;SACF;IACH,CAAC;IAED,SAAS,CAAC,aAA6B,EAAE,UAAwB;QAC/D,OAAO;IACT,CAAC;CACF,CAAA;AA7cY,uBAAuB;IADnC,IAAA,2BAAU,GAAE;IAqBR,WAAA,IAAA,4BAAW,EAAC,sBAAa,CAAC,CAAA;IAG1B,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,sCAAmB,CAAC,CAAA;;GAxBlB,uBAAuB,CA6cnC;AA7cY,0DAAuB","file":"draw-contribution.js","sourcesContent":["import { injectable, inject, named, multiInject } from '../../../common/inversify-lite';\nimport type {\n IContext2d,\n MaybePromise,\n IGraphic,\n IGroup,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider,\n IDrawItemInterceptorContribution,\n IDrawContribution,\n IGlobal\n} from '../../../interface';\nimport { findNextGraphic, foreach } from '../../../common/sort';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { DefaultAttribute } from '../../../graphic/config';\nimport type { IAABBBounds, IBounds, IMatrix } from '@visactor/vutils';\nimport { Bounds, Logger, getRectIntersect, isArray, isRectIntersect } from '@visactor/vutils';\nimport { container } from '../../../container';\nimport { GraphicRender, IncrementalDrawContribution } from './symbol';\nimport { DrawItemInterceptor } from './draw-interceptor';\nimport { createColor } from '../../../common/canvas-utils';\nimport type { ILayerService } from '../../../interface/core';\nimport { boundsAllocate } from '../../../allocator/bounds-allocate';\nimport { matrixAllocate } from '../../../allocator/matrix-allocate';\nimport { application } from '../../../application';\n\n/**\n * 默认的渲染contribution,基于树状结构针对图元的渲染\n */\n@injectable()\nexport class DefaultDrawContribution implements IDrawContribution {\n declare currentRenderMap: Map<number, IGraphicRender>;\n declare defaultRenderMap: Map<number, IGraphicRender>;\n declare styleRenderMap: Map<string, Map<number, IGraphicRender>>;\n declare dirtyBounds: IBounds;\n declare backupDirtyBounds: IBounds;\n // 是否使用dirtyBounds\n declare useDirtyBounds: boolean;\n declare currentRenderService: IRenderService;\n declare InterceptorContributions: IDrawItemInterceptorContribution[];\n\n declare global: IGlobal;\n declare layerService: ILayerService;\n\n declare scrollMatrix?: IMatrix;\n\n constructor(\n // @inject(ContributionProvider)\n // @named(GraphicRender)\n // protected readonly contributions: ContributionProvider<IGraphicRender>,\n @multiInject(GraphicRender) protected readonly contributions: IGraphicRender[],\n // @inject(RenderSelector) protected readonly renderSelector: IRenderSelector, // 根据图元类型选择对应的renderItem进行渲染\n // 拦截器\n @inject(ContributionProvider)\n @named(DrawItemInterceptor)\n protected readonly drawItemInterceptorContributions: IContributionProvider<IDrawItemInterceptorContribution>\n ) {\n this.currentRenderMap = new Map();\n this.defaultRenderMap = new Map();\n this.styleRenderMap = new Map();\n this.dirtyBounds = new Bounds();\n this.backupDirtyBounds = new Bounds();\n this.global = application.global;\n this.layerService = application.layerService;\n if (!isArray(this.contributions)) {\n this.contributions = [this.contributions];\n }\n this.init();\n }\n\n reInit() {\n this.init();\n this.contributions.forEach(item => {\n item.reInit();\n });\n }\n\n init() {\n this.contributions.forEach(item => {\n if (item.style) {\n const map = this.styleRenderMap.get(item.style) || new Map();\n map.set(item.numberType, item);\n this.styleRenderMap.set(item.style, map);\n } else {\n this.defaultRenderMap.set(item.numberType, item);\n }\n });\n this.InterceptorContributions = this.drawItemInterceptorContributions\n .getContributions()\n .sort((a, b) => a.order - b.order);\n }\n\n prepareForDraw(renderService: IRenderService, drawContext: IDrawContext) {\n // 有dirtyBounds用dirtyBounds\n if (drawContext.updateBounds) {\n this.useDirtyBounds = true;\n } else {\n // 没有的话,看看是否需要跳过outRange的渲染\n this.useDirtyBounds = !drawContext.stage.params.optimize.disableCheckGraphicWidthOutRange;\n }\n }\n\n draw(renderService: IRenderService, drawContext: IDrawContext): MaybePromise<void> {\n this.prepareForDraw(renderService, drawContext);\n drawContext.drawContribution = this;\n this.currentRenderMap = this.styleRenderMap.get(drawContext.renderStyle) || this.defaultRenderMap;\n // this.startAtId = drawParams.startAtId;\n this.currentRenderService = renderService;\n // this.drawParams = drawParams;\n const { context, stage, viewBox, transMatrix } = drawContext;\n\n if (!context) {\n return;\n }\n // if (context.drawPromise) {\n // return;\n // }\n const dirtyBounds: IBounds | undefined = this.dirtyBounds.setValue(0, 0, viewBox.width(), viewBox.height());\n if (stage.dirtyBounds && !stage.dirtyBounds.empty()) {\n const b = getRectIntersect(dirtyBounds, stage.dirtyBounds, false);\n dirtyBounds.x1 = Math.floor(b.x1);\n dirtyBounds.y1 = Math.floor(b.y1);\n dirtyBounds.x2 = Math.ceil(b.x2);\n dirtyBounds.y2 = Math.ceil(b.y2);\n }\n // 如果dpr不是整数或者.5的小数,需要格式化dirtyBounds\n const d = context.dpr % 1;\n if (d || d !== 0.5) {\n dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr;\n dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr;\n dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr;\n dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr;\n }\n this.backupDirtyBounds.copy(dirtyBounds);\n // TODO:不需要设置context.transform,后续translate会设置\n context.reset(false);\n context.save();\n context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f);\n // 初始化context\n context.clearMatrix(false);\n // context.setTransformForCurrent(true);\n\n // const drawInArea =\n // dirtyBounds.width() * context.dpr < context.canvas.width ||\n // dirtyBounds.height() * context.dpr < context.canvas.height;\n // context.save();\n\n // 设置translate\n context.translate(viewBox.x1, viewBox.y1, true);\n context.beginPath();\n context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height());\n context.clip();\n\n // 如果存在3d视角,那么不使用dirtyBounds\n if (stage.camera) {\n this.dirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n this.backupDirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n }\n\n this.clearScreen(renderService, context, drawContext);\n // // 渲染的时候图元的起始位置就是x,y\n // this.backupDirtyBounds.translate(-x, -y);\n // this.dirtyBounds.translate(-x, -y);\n\n // // 设置translate\n // context.translate(x, y, true);\n\n // context.save();\n renderService.renderTreeRoots\n .sort((a, b) => {\n return (a.attribute.zIndex ?? DefaultAttribute.zIndex) - (b.attribute.zIndex ?? DefaultAttribute.zIndex);\n })\n .forEach(group => {\n group.isContainer\n ? this.renderGroup(group as IGroup, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0))\n : this.renderItem(group as IGraphic, drawContext);\n });\n\n // context.restore();\n // context.restore();\n // context.setClearMatrix(1, 0, 0, 1, 0, 0);\n // this.break = false;\n // context.inuse = false;\n context.restore();\n context.draw();\n }\n\n doRegister() {\n throw new Error('暂不支持');\n }\n\n // 找到下一个graphic\n protected _findNextGraphic(group: IGroup): IGraphic | null {\n let parent = group.parent;\n let id = group._uid;\n while (parent) {\n const g = findNextGraphic(parent, id, DefaultAttribute.zIndex);\n if (g) {\n return g;\n }\n id = parent._uid;\n parent = parent.parent;\n }\n return null;\n }\n\n renderGroup(group: IGroup, drawContext: IDrawContext, parentMatrix: IMatrix, skipSort?: boolean) {\n if (drawContext.break || group.attribute.visibleAll === false) {\n return;\n }\n if (group.incremental && (drawContext.startAtId == null || drawContext.startAtId === group._uid)) {\n drawContext.break = true;\n this._increaseRender(group, drawContext);\n return;\n }\n\n if (\n this.useDirtyBounds &&\n !isRectIntersect(group.AABBBounds, this.dirtyBounds, false) &&\n group.attribute.boundsMode !== 'empty'\n ) {\n return;\n }\n\n let nextM: IMatrix = parentMatrix;\n let tempBounds: IBounds;\n\n if (this.useDirtyBounds) {\n tempBounds = boundsAllocate.allocateByObj(this.dirtyBounds);\n // 变换dirtyBounds\n const gm = group.transMatrix;\n nextM = matrixAllocate.allocateByObj(parentMatrix).multiply(gm.a, gm.b, gm.c, gm.d, gm.e, gm.f);\n // const m = group.globalTransMatrix.getInverse();\n this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(nextM.getInverse());\n }\n\n drawContext.isGroupScroll = !!(group.attribute.scrollX || group.attribute.scrollY);\n\n this.renderItem(group, drawContext, {\n renderInGroupParams: {\n skipSort,\n nextM\n },\n renderInGroup: this._renderInGroup\n });\n\n if (this.useDirtyBounds) {\n this.dirtyBounds.copy(tempBounds);\n boundsAllocate.free(tempBounds);\n matrixAllocate.free(nextM);\n }\n }\n\n _renderInGroup = (skipSort: boolean, group: IGroup, drawContext: IDrawContext, nextM: IMatrix) => {\n skipSort\n ? group.forEachChildren((item: IGraphic) => {\n if (drawContext.break) {\n return;\n }\n if (item.isContainer) {\n this.renderGroup(item as IGroup, drawContext, nextM);\n } else {\n this.renderItem(item, drawContext);\n }\n })\n : foreach(\n group,\n DefaultAttribute.zIndex,\n (item: IGraphic) => {\n if (drawContext.break) {\n return;\n }\n if (item.isContainer) {\n this.renderGroup(item as IGroup, drawContext, nextM);\n } else {\n this.renderItem(item, drawContext);\n }\n },\n false,\n !!drawContext.context?.camera\n );\n };\n\n protected _increaseRender(group: IGroup, drawContext: IDrawContext) {\n const { layer, stage } = drawContext;\n const { subLayers } = layer;\n // 获取渐进渲染层\n let incrementalLayer = subLayers.get(group._uid);\n if (!incrementalLayer) {\n incrementalLayer = {\n layer: this.layerService.createLayer(stage),\n zIndex: subLayers.size,\n group\n };\n subLayers.set(group._uid, incrementalLayer);\n }\n // 渲染\n const incrementalContext = incrementalLayer.layer.getNativeHandler().getContext();\n const idc = incrementalLayer.drawContribution || container.get(IncrementalDrawContribution);\n idc.dirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n idc.backupDirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n (idc as any).draw(this.currentRenderService, {\n ...drawContext,\n drawContribution: idc,\n clear: 'transparent',\n layer: incrementalLayer.layer,\n context: incrementalContext,\n startAtId: group._uid,\n break: false\n });\n incrementalLayer.drawContribution = idc;\n // this.draw(this.currentRenderService, {...this.drawParams, startAtId: group._uid})\n // this.draw(this.currentRenderService, {...this.drawParams, clear: 'transparent', layer: incrementalContext.layer, context: incrementalContext, startAtId: group._uid})\n const nextGraphic = this._findNextGraphic(group);\n if (nextGraphic) {\n // 如果是下一个渐进渲染层,那就再来一次\n if (nextGraphic.isContainer && nextGraphic.incremental) {\n this._increaseRender(nextGraphic as IGroup, drawContext);\n } else {\n // 如果不是渐进渲染层,那就默认图层渲染\n let afterLayer = subLayers.get(nextGraphic._uid);\n if (!afterLayer) {\n afterLayer = {\n layer: this.layerService.createLayer(stage),\n zIndex: subLayers.size\n };\n subLayers.set(nextGraphic._uid, afterLayer);\n }\n const afterContext = afterLayer.layer.getNativeHandler().getContext();\n this.draw(this.currentRenderService, {\n ...drawContext,\n drawContribution: idc,\n clear: 'transparent',\n layer: afterLayer.layer,\n context: afterContext,\n startAtId: nextGraphic._uid,\n break: false\n });\n }\n }\n }\n\n getRenderContribution(graphic: IGraphic): IGraphicRender | null {\n let renderer;\n if (!renderer) {\n renderer = this.selectRenderByNumberType(graphic.numberType, graphic);\n }\n if (!renderer) {\n renderer = this.selectRenderByType(graphic.type);\n }\n return renderer;\n }\n\n renderItem(graphic: IGraphic, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n // 添加拦截器\n if (this.InterceptorContributions.length) {\n for (let i = 0; i < this.InterceptorContributions.length; i++) {\n const drawContribution = this.InterceptorContributions[i];\n if (\n drawContribution.beforeDrawItem &&\n drawContribution.beforeDrawItem(graphic, this.currentRenderService, drawContext, this, params)\n ) {\n return;\n }\n }\n }\n\n const renderer = this.getRenderContribution(graphic);\n if (!renderer) {\n return;\n }\n\n let retrans: boolean = false;\n let tempBounds: IBounds;\n\n if (drawContext.isGroupScroll) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n retrans = true;\n if (!this.scrollMatrix) {\n this.scrollMatrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);\n }\n this.scrollMatrix.translate(-scrollX, -scrollY);\n }\n // if (graphic.parent) {\n // const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n // if (!!(scrollX || scrollY)) {\n // retrans = true;\n // if (!this.scrollMatrix) {\n // this.scrollMatrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);\n // }\n // this.scrollMatrix.translate(-scrollX, -scrollY);\n // }\n // }\n // 需要二次变化,那就重新算一个变换后的Bounds\n if (retrans) {\n tempBounds = this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix);\n }\n\n if (\n this.useDirtyBounds &&\n !(\n graphic.isContainer ||\n graphic.attribute.boundsMode === 'empty' ||\n isRectIntersect(graphic.AABBBounds, tempBounds ?? this.dirtyBounds, false)\n )\n ) {\n if (retrans && graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n this.scrollMatrix && this.scrollMatrix.translate(scrollX, scrollY);\n }\n return;\n }\n\n const skipDraw = drawContext.startAtId != null && graphic._uid !== drawContext.startAtId;\n if (graphic._uid === drawContext.startAtId) {\n drawContext.startAtId = null;\n }\n params && (params.skipDraw = skipDraw);\n if (skipDraw) {\n graphic.isContainer && renderer.draw(graphic, this.currentRenderService, drawContext, params);\n } else {\n renderer.draw(graphic, this.currentRenderService, drawContext, params);\n }\n\n // retrans && this.dirtyBounds.copy(tempBounds);\n if (retrans && graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n this.scrollMatrix && this.scrollMatrix.translate(scrollX, scrollY);\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.afterDrawItem) {\n if (drawContribution.afterDrawItem(graphic, this.currentRenderService, drawContext, this)) {\n return;\n }\n }\n }\n }\n }\n // 根据type选择对应的render\n protected selectRenderByType(type?: string): IGraphicRender | null {\n Logger.getInstance().warn('未知错误,不应该走到这里');\n return null;\n }\n // 根据type选择对应的render\n protected selectRenderByNumberType(type: number, graphic: IGraphic): IGraphicRender | null {\n let data;\n if (graphic.attribute.renderStyle) {\n const currentRenderMap = this.styleRenderMap.get(graphic.attribute.renderStyle);\n data = currentRenderMap && currentRenderMap.get(type);\n }\n return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);\n }\n\n protected clearScreen(renderService: IRenderService, context: IContext2d, drawContext: IDrawContext) {\n const { clear, viewBox } = drawContext;\n // 已经translate过了\n const x = 0;\n const y = 0;\n const width = viewBox.width();\n const height = viewBox.height();\n if (clear) {\n context.clearRect(x, y, width, height);\n const stage = renderService.drawParams?.stage;\n stage && (context.globalAlpha = (stage as any).attribute.opacity ?? 1);\n if (stage && (stage as any).backgroundImg && (stage as any).resources) {\n const res = (stage as any).resources.get(clear);\n if (res && res.state === 'success' && res.data) {\n context.drawImage(res.data, x, y, width, height);\n }\n } else {\n context.fillStyle = createColor(\n context,\n clear,\n {\n AABBBounds: { x1: x, y1: y, x2: x + width, y2: y + height }\n },\n 0,\n 0\n );\n context.fillRect(x, y, width, height);\n }\n }\n }\n\n afterDraw(renderService: IRenderService, drawParams: IDrawContext) {\n return;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/draw-contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAAwF;AAexF,+CAAgE;AAEhE,iFAA6E;AAC7E,oDAA2D;AAE3D,6CAA8F;AAC9F,kDAA+C;AAC/C,qCAAsE;AACtE,yDAAyD;AACzD,+DAA2D;AAE3D,wEAAoE;AACpE,wEAAoE;AACpE,sDAAmD;AAM5C,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAgBlC,YAIiD,aAA+B,EAK3D,gCAAyF;QAL7D,kBAAa,GAAb,aAAa,CAAkB;QAK3D,qCAAgC,GAAhC,gCAAgC,CAAyD;QAE5G,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,WAAW,GAAG,IAAI,eAAM,EAAE,CAAC;QAChC,IAAI,CAAC,iBAAiB,GAAG,IAAI,eAAM,EAAE,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,yBAAW,CAAC,MAAM,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,yBAAW,CAAC,YAAY,CAAC;QAC7C,IAAI,CAAC,IAAA,gBAAO,EAAC,IAAI,CAAC,aAAa,CAAC,EAAE;YAChC,IAAI,CAAC,aAAa,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAC3C;QACD,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAChC,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI;QACF,IAAI,C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AC,EACD,CAAC,CACF,CAAC;gBACF,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;aACvC;SACF;IACH,CAAC;IAED,SAAS,CAAC,aAA6B,EAAE,UAAwB;QAC/D,OAAO;IACT,CAAC;CACF,CAAA;AA1bY,uBAAuB;IADnC,IAAA,2BAAU,GAAE;IAqBR,WAAA,IAAA,4BAAW,EAAC,sBAAa,CAAC,CAAA;IAG1B,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,sCAAmB,CAAC,CAAA;;GAxBlB,uBAAuB,CA0bnC;AA1bY,0DAAuB","file":"draw-contribution.js","sourcesContent":["import { injectable, inject, named, multiInject } from '../../../common/inversify-lite';\nimport type {\n IContext2d,\n MaybePromise,\n IGraphic,\n IGroup,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider,\n IDrawItemInterceptorContribution,\n IDrawContribution,\n IGlobal\n} from '../../../interface';\nimport { findNextGraphic, foreach } from '../../../common/sort';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { DefaultAttribute } from '../../../graphic/config';\nimport type { IAABBBounds, IBounds, IMatrix } from '@visactor/vutils';\nimport { Bounds, Logger, getRectIntersect, isArray, isRectIntersect } from '@visactor/vutils';\nimport { container } from '../../../container';\nimport { GraphicRender, IncrementalDrawContribution } from './symbol';\nimport { DrawItemInterceptor } from './draw-interceptor';\nimport { createColor } from '../../../common/canvas-utils';\nimport type { ILayerService } from '../../../interface/core';\nimport { boundsAllocate } from '../../../allocator/bounds-allocate';\nimport { matrixAllocate } from '../../../allocator/matrix-allocate';\nimport { application } from '../../../application';\n\n/**\n * 默认的渲染contribution,基于树状结构针对图元的渲染\n */\n@injectable()\nexport class DefaultDrawContribution implements IDrawContribution {\n declare currentRenderMap: Map<number, IGraphicRender>;\n declare defaultRenderMap: Map<number, IGraphicRender>;\n declare styleRenderMap: Map<string, Map<number, IGraphicRender>>;\n declare dirtyBounds: IBounds;\n declare backupDirtyBounds: IBounds;\n // 是否使用dirtyBounds\n declare useDirtyBounds: boolean;\n declare currentRenderService: IRenderService;\n declare InterceptorContributions: IDrawItemInterceptorContribution[];\n\n declare global: IGlobal;\n declare layerService: ILayerService;\n\n declare scrollMatrix?: IMatrix;\n\n constructor(\n // @inject(ContributionProvider)\n // @named(GraphicRender)\n // protected readonly contributions: ContributionProvider<IGraphicRender>,\n @multiInject(GraphicRender) protected readonly contributions: IGraphicRender[],\n // @inject(RenderSelector) protected readonly renderSelector: IRenderSelector, // 根据图元类型选择对应的renderItem进行渲染\n // 拦截器\n @inject(ContributionProvider)\n @named(DrawItemInterceptor)\n protected readonly drawItemInterceptorContributions: IContributionProvider<IDrawItemInterceptorContribution>\n ) {\n this.currentRenderMap = new Map();\n this.defaultRenderMap = new Map();\n this.styleRenderMap = new Map();\n this.dirtyBounds = new Bounds();\n this.backupDirtyBounds = new Bounds();\n this.global = application.global;\n this.layerService = application.layerService;\n if (!isArray(this.contributions)) {\n this.contributions = [this.contributions];\n }\n this.init();\n }\n\n reInit() {\n this.init();\n this.contributions.forEach(item => {\n item.reInit();\n });\n }\n\n init() {\n this.contributions.forEach(item => {\n if (item.style) {\n const map = this.styleRenderMap.get(item.style) || new Map();\n map.set(item.numberType, item);\n this.styleRenderMap.set(item.style, map);\n } else {\n this.defaultRenderMap.set(item.numberType, item);\n }\n });\n this.InterceptorContributions = this.drawItemInterceptorContributions\n .getContributions()\n .sort((a, b) => a.order - b.order);\n }\n\n prepareForDraw(renderService: IRenderService, drawContext: IDrawContext) {\n // 有dirtyBounds用dirtyBounds\n if (drawContext.updateBounds) {\n this.useDirtyBounds = true;\n } else {\n // 没有的话,看看是否需要跳过outRange的渲染\n this.useDirtyBounds = !drawContext.stage.params.optimize.disableCheckGraphicWidthOutRange;\n }\n }\n\n draw(renderService: IRenderService, drawContext: IDrawContext): MaybePromise<void> {\n this.prepareForDraw(renderService, drawContext);\n drawContext.drawContribution = this;\n this.currentRenderMap = this.styleRenderMap.get(drawContext.renderStyle) || this.defaultRenderMap;\n // this.startAtId = drawParams.startAtId;\n this.currentRenderService = renderService;\n // this.drawParams = drawParams;\n const { context, stage, viewBox, transMatrix } = drawContext;\n\n if (!context) {\n return;\n }\n // if (context.drawPromise) {\n // return;\n // }\n const dirtyBounds: IBounds | undefined = this.dirtyBounds.setValue(0, 0, viewBox.width(), viewBox.height());\n if (stage.dirtyBounds && !stage.dirtyBounds.empty()) {\n const b = getRectIntersect(dirtyBounds, stage.dirtyBounds, false);\n dirtyBounds.x1 = Math.floor(b.x1);\n dirtyBounds.y1 = Math.floor(b.y1);\n dirtyBounds.x2 = Math.ceil(b.x2);\n dirtyBounds.y2 = Math.ceil(b.y2);\n }\n // 如果dpr不是整数或者.5的小数,需要格式化dirtyBounds\n const d = context.dpr % 1;\n if (d || d !== 0.5) {\n dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr;\n dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr;\n dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr;\n dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr;\n }\n this.backupDirtyBounds.copy(dirtyBounds);\n context.inuse = true;\n context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f);\n // 初始化context\n context.clearMatrix();\n context.setTransformForCurrent(true);\n\n // const drawInArea =\n // dirtyBounds.width() * context.dpr < context.canvas.width ||\n // dirtyBounds.height() * context.dpr < context.canvas.height;\n // context.save();\n\n // 设置translate\n context.translate(viewBox.x1, viewBox.y1, true);\n context.beginPath();\n context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height());\n context.clip();\n\n // 如果存在3d视角,那么不使用dirtyBounds\n if (stage.camera) {\n this.dirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n this.backupDirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n }\n\n this.clearScreen(renderService, context, drawContext);\n // // 渲染的时候图元的起始位置就是x,y\n // this.backupDirtyBounds.translate(-x, -y);\n // this.dirtyBounds.translate(-x, -y);\n\n // // 设置translate\n // context.translate(x, y, true);\n\n context.save();\n renderService.renderTreeRoots\n .sort((a, b) => {\n return (a.attribute.zIndex ?? DefaultAttribute.zIndex) - (b.attribute.zIndex ?? DefaultAttribute.zIndex);\n })\n .forEach(group => {\n group.isContainer\n ? this.renderGroup(group as IGroup, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0))\n : this.renderItem(group as IGraphic, drawContext);\n });\n\n // context.restore();\n context.restore();\n context.setClearMatrix(1, 0, 0, 1, 0, 0);\n // this.break = false;\n context.inuse = false;\n context.draw();\n }\n\n doRegister() {\n throw new Error('暂不支持');\n }\n\n // 找到下一个graphic\n protected _findNextGraphic(group: IGroup): IGraphic | null {\n let parent = group.parent;\n let id = group._uid;\n while (parent) {\n const g = findNextGraphic(parent, id, DefaultAttribute.zIndex);\n if (g) {\n return g;\n }\n id = parent._uid;\n parent = parent.parent;\n }\n return null;\n }\n\n renderGroup(group: IGroup, drawContext: IDrawContext, parentMatrix: IMatrix, skipSort?: boolean) {\n if (drawContext.break || group.attribute.visibleAll === false) {\n return;\n }\n if (group.incremental && (drawContext.startAtId == null || drawContext.startAtId === group._uid)) {\n drawContext.break = true;\n this._increaseRender(group, drawContext);\n return;\n }\n\n if (\n this.useDirtyBounds &&\n !isRectIntersect(group.AABBBounds, this.dirtyBounds, false) &&\n group.attribute.boundsMode !== 'empty'\n ) {\n return;\n }\n\n let nextM: IMatrix = parentMatrix;\n let tempBounds: IBounds;\n\n if (this.useDirtyBounds) {\n tempBounds = boundsAllocate.allocateByObj(this.dirtyBounds);\n // 变换dirtyBounds\n const gm = group.transMatrix;\n nextM = matrixAllocate.allocateByObj(parentMatrix).multiply(gm.a, gm.b, gm.c, gm.d, gm.e, gm.f);\n // const m = group.globalTransMatrix.getInverse();\n this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(nextM.getInverse());\n }\n\n this.renderItem(group, drawContext, {\n drawingCb: () => {\n skipSort\n ? group.forEachChildren((item: IGraphic) => {\n if (drawContext.break) {\n return;\n }\n if (item.isContainer) {\n this.renderGroup(item as IGroup, drawContext, nextM);\n } else {\n this.renderItem(item, drawContext);\n }\n })\n : foreach(\n group,\n DefaultAttribute.zIndex,\n (item: IGraphic) => {\n if (drawContext.break) {\n return;\n }\n if (item.isContainer) {\n this.renderGroup(item as IGroup, drawContext, nextM);\n } else {\n this.renderItem(item, drawContext);\n }\n },\n false,\n !!drawContext.context?.camera\n );\n }\n });\n\n if (this.useDirtyBounds) {\n this.dirtyBounds.copy(tempBounds);\n boundsAllocate.free(tempBounds);\n matrixAllocate.free(nextM);\n }\n }\n\n protected _increaseRender(group: IGroup, drawContext: IDrawContext) {\n const { layer, stage } = drawContext;\n const { subLayers } = layer;\n // 获取渐进渲染层\n let incrementalLayer = subLayers.get(group._uid);\n if (!incrementalLayer) {\n incrementalLayer = {\n layer: this.layerService.createLayer(stage),\n zIndex: subLayers.size,\n group\n };\n subLayers.set(group._uid, incrementalLayer);\n }\n // 渲染\n const incrementalContext = incrementalLayer.layer.getNativeHandler().getContext();\n const idc = incrementalLayer.drawContribution || container.get(IncrementalDrawContribution);\n idc.dirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n idc.backupDirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n (idc as any).draw(this.currentRenderService, {\n ...drawContext,\n drawContribution: idc,\n clear: 'transparent',\n layer: incrementalLayer.layer,\n context: incrementalContext,\n startAtId: group._uid,\n break: false\n });\n incrementalLayer.drawContribution = idc;\n // this.draw(this.currentRenderService, {...this.drawParams, startAtId: group._uid})\n // this.draw(this.currentRenderService, {...this.drawParams, clear: 'transparent', layer: incrementalContext.layer, context: incrementalContext, startAtId: group._uid})\n const nextGraphic = this._findNextGraphic(group);\n if (nextGraphic) {\n // 如果是下一个渐进渲染层,那就再来一次\n if (nextGraphic.isContainer && nextGraphic.incremental) {\n this._increaseRender(nextGraphic as IGroup, drawContext);\n } else {\n // 如果不是渐进渲染层,那就默认图层渲染\n let afterLayer = subLayers.get(nextGraphic._uid);\n if (!afterLayer) {\n afterLayer = {\n layer: this.layerService.createLayer(stage),\n zIndex: subLayers.size\n };\n subLayers.set(nextGraphic._uid, afterLayer);\n }\n const afterContext = afterLayer.layer.getNativeHandler().getContext();\n this.draw(this.currentRenderService, {\n ...drawContext,\n drawContribution: idc,\n clear: 'transparent',\n layer: afterLayer.layer,\n context: afterContext,\n startAtId: nextGraphic._uid,\n break: false\n });\n }\n }\n }\n\n getRenderContribution(graphic: IGraphic): IGraphicRender | null {\n let renderer;\n if (!renderer) {\n renderer = this.selectRenderByNumberType(graphic.numberType, graphic);\n }\n if (!renderer) {\n renderer = this.selectRenderByType(graphic.type);\n }\n return renderer;\n }\n\n renderItem(graphic: IGraphic, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n // 添加拦截器\n if (this.InterceptorContributions.length) {\n for (let i = 0; i < this.InterceptorContributions.length; i++) {\n const drawContribution = this.InterceptorContributions[i];\n if (\n drawContribution.beforeDrawItem &&\n drawContribution.beforeDrawItem(graphic, this.currentRenderService, drawContext, this, params)\n ) {\n return;\n }\n }\n }\n\n const renderer = this.getRenderContribution(graphic);\n if (!renderer) {\n return;\n }\n\n let retrans: boolean = this.scrollMatrix && (this.scrollMatrix.e !== 0 || this.scrollMatrix.f !== 0);\n let tempBounds: IBounds;\n\n if (graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n if (!!(scrollX || scrollY)) {\n retrans = true;\n if (!this.scrollMatrix) {\n this.scrollMatrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);\n }\n this.scrollMatrix.translate(-scrollX, -scrollY);\n }\n }\n // 需要二次变化,那就重新算一个变换后的Bounds\n if (retrans) {\n tempBounds = this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix);\n }\n\n if (\n this.useDirtyBounds &&\n !(\n graphic.isContainer ||\n graphic.attribute.boundsMode === 'empty' ||\n isRectIntersect(graphic.AABBBounds, tempBounds ?? this.dirtyBounds, false)\n )\n ) {\n if (retrans && graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n this.scrollMatrix && this.scrollMatrix.translate(scrollX, scrollY);\n }\n return;\n }\n\n const skipDraw = drawContext.startAtId != null && graphic._uid !== drawContext.startAtId;\n if (graphic._uid === drawContext.startAtId) {\n drawContext.startAtId = null;\n }\n params && (params.skipDraw = skipDraw);\n if (skipDraw) {\n graphic.isContainer && renderer.draw(graphic, this.currentRenderService, drawContext, params);\n } else {\n renderer.draw(graphic, this.currentRenderService, drawContext, params);\n }\n\n // retrans && this.dirtyBounds.copy(tempBounds);\n if (retrans && graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n this.scrollMatrix && this.scrollMatrix.translate(scrollX, scrollY);\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.afterDrawItem) {\n if (drawContribution.afterDrawItem(graphic, this.currentRenderService, drawContext, this)) {\n return;\n }\n }\n }\n }\n }\n // 根据type选择对应的render\n protected selectRenderByType(type?: string): IGraphicRender | null {\n Logger.getInstance().warn('未知错误,不应该走到这里');\n return null;\n }\n // 根据type选择对应的render\n protected selectRenderByNumberType(type: number, graphic: IGraphic): IGraphicRender | null {\n let data;\n if (graphic.attribute.renderStyle) {\n const currentRenderMap = this.styleRenderMap.get(graphic.attribute.renderStyle);\n data = currentRenderMap && currentRenderMap.get(type);\n }\n return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);\n }\n\n protected clearScreen(renderService: IRenderService, context: IContext2d, drawContext: IDrawContext) {\n const { clear, viewBox } = drawContext;\n // 已经translate过了\n const x = 0;\n const y = 0;\n const width = viewBox.width();\n const height = viewBox.height();\n if (clear) {\n context.clearRect(x, y, width, height);\n const stage = renderService.drawParams?.stage;\n stage && (context.globalAlpha = (stage as any).attribute.opacity ?? 1);\n if (stage && (stage as any).backgroundImg && (stage as any).resources) {\n const res = (stage as any).resources.get(clear);\n if (res && res.state === 'success' && res.data) {\n context.drawImage(res.data, x, y, width, height);\n }\n } else {\n context.fillStyle = createColor(\n context,\n clear,\n {\n AABBBounds: { x1: x, y1: y, x2: x + width, y2: y + height }\n },\n 0,\n 0\n );\n context.fillRect(x, y, width, height);\n }\n }\n }\n\n afterDraw(renderService: IRenderService, drawParams: IDrawContext) {\n return;\n }\n}\n"]}
@@ -75,12 +75,11 @@ let CommonDrawItemInterceptorContribution = class {
75
75
  this.order = 1, this.interceptors = [ new ShadowRootDrawItemInterceptorContribution, new Canvas3DDrawItemInterceptor, new InteractiveDrawItemInterceptorContribution, new DebugDrawItemInterceptorContribution ];
76
76
  }
77
77
  afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
78
- if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !graphic.attribute._debug_bounds && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
79
78
  for (let i = 0; i < this.interceptors.length; i++) if (this.interceptors[i].afterDrawItem && this.interceptors[i].afterDrawItem(graphic, renderService, drawContext, drawContribution, params)) return !0;
80
79
  return !1;
81
80
  }
82
81
  beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
83
- if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !graphic.attribute._debug_bounds && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
82
+ if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
84
83
  for (let i = 0; i < this.interceptors.length; i++) if (this.interceptors[i].beforeDrawItem && this.interceptors[i].beforeDrawItem(graphic, renderService, drawContext, drawContribution, params)) return !0;
85
84
  return !1;
86
85
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/draw-interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAA4D;AAC5D,6CAA8C;AAC9C,mDAAsE;AACtE,sEAAkE;AAYlE,wEAAkF;AAClF,oEAA4D;AAG/C,QAAA,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;AASrE,MAAM,eAAe,GAAG,IAAI,mBAAU,EAAE,CAAC;AACzC,MAAM,qBAAqB,GAAG,IAAI,mBAAU,EAAE,CAAC;AAK/C,MAAa,yCAAyC;IAAtD;QACE,UAAK,GAAW,CAAC,CAAC;IAoFpB,CAAC;IAnFC,aAAa,CACX,OAAiB,EACjB,aAA6B,EAC7B,WAAyB,EACzB,gBAAmC,EACnC,MAAiC;QAGjC,IACE,OAAO,CAAC,SAAS,CAAC,aAAa,IAAI,IAAI;YACvC,OAAO,CAAC,UAAU;YAClB,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,GAAG,CAAC,EAC9C;YACA,OAAO,KAAK,CAAC;SACd;QACD,IACE,OAAO,CAAC,SAAS,CAAC,aAAa,GAAG,CAAC;YACnC,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa;YAChC,CAAC,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,GAAG,CAAC,CAAC,EACtE;YACA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;SAC9E;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,cAAc,CACZ,OAAiB,EACjB,aAA6B,EAC7B,WAA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7C,IAAI,OAAO,CAAC,WAAW,EAAE;YACvB,IAAA,4BAAU,EACR,OAAO,EACP,OAAO,EACP,CAAC,KAAc,EAAE,IAAa,EAAE,EAAE;gBAChC,OAAO,gBAAgB,CAAC,WAAW,CACjC,OAAiB,EACjB,WAAW,EACX,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAChC,CAAC,KAAK,IAAI,IAAI,CACf,CAAC;YACJ,CAAC,EACD,WAAW,CACZ,CAAC;SACH;aAAM;YACL,gBAAgB,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;SACnD;QACD,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;QACtB,OAAO,CAAC,OAAO,EAAE,CAAC;QAElB,IAAI,OAAO,CAAC,WAAW,KAAK,eAAe,EAAE;YAC3C,8BAAY,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACxC;QACD,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;QAEtC,WAAW,CAAC,eAAe,GAAG,KAAK,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa,CAAC,OAAmB;QAC/B,OAAO,CAAC,sBAAsB,EAAE,CAAC;IACnC,CAAC;CACF;AA9ED,kEA8EC","file":"draw-interceptor.js","sourcesContent":["import { injectable } from '../../../common/inversify-lite';\nimport { AABBBounds } from '@visactor/vutils';\nimport { mat3Tomat4, multiplyMat4Mat4 } from '../../../common/matrix';\nimport { graphicCreator } from '../../../graphic/graphic-creator';\nimport type {\n IContext2d,\n IDrawContext,\n IDrawContribution,\n IDrawItemInterceptorContribution,\n IGraphic,\n IGraphicRenderDrawParams,\n IGroup,\n ILayer,\n IRenderService\n} from '../../../interface';\nimport { mat4Allocate, matrixAllocate } from '../../../allocator/matrix-allocate';\nimport { draw3dItem } from '../../../common/3d-interceptor';\n\n// 拦截器\nexport const DrawItemInterceptor = Symbol.for('DrawItemInterceptor');\n\n// @injectable()\n// export class DefaultDrawItemInterceptor implements IDrawItemInterceptor {\n// drawItem(graphic: IGraphic, renderService: IRenderService, params?: IGraphicRenderDrawParams): boolean {\n// return false;\n// }\n// }\n\nconst tempDirtyBounds = new AABBBounds();\nconst tempBackupDirtyBounds = new AABBBounds();\n/**\n * 影子节点拦截器,用于渲染影子节点\n */\n// @injectable()\nexport class ShadowRootDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n afterDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 如果graphic没设置shadowRootIdx,shadowRoot设置了,那就使用shadowRoot的shadowRootIdx\n if (\n graphic.attribute.shadowRootIdx == null &&\n graphic.shadowRoot &&\n graphic.shadowRoot.attribute.shadowRootIdx < 0\n ) {\n return false;\n }\n if (\n graphic.attribute.shadowRootIdx > 0 ||\n !graphic.attribute.shadowRootIdx ||\n (graphic.shadowRoot && graphic.shadowRoot.attribute.shadowRootIdx > 0)\n ) {\n this.drawItem(graphic, renderService, drawContext, drawContribution, params);\n }\n return false;\n }\n\n beforeDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 如果graphic没设置shadowRootIdx,shadowRoot设置了,那就使用shadowRoot的shadowRootIdx\n if (\n graphic.attribute.shadowRootIdx == null &&\n graphic.shadowRoot &&\n graphic.shadowRoot.attribute.shadowRootIdx > 0\n ) {\n return false;\n }\n if (graphic.attribute.shadowRootIdx < 0 || (graphic.shadowRoot && graphic.shadowRoot.attribute.shadowRootIdx < 0)) {\n this.drawItem(graphic, renderService, drawContext, drawContribution, params);\n }\n return false;\n }\n\n protected drawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n if (!graphic.shadowRoot) {\n return false;\n }\n\n const { context } = drawContext;\n context.highPerformanceSave();\n // 直接transform\n context.transformFromMatrix(graphic.transMatrix, true);\n\n // 变换dirtyBounds\n if (drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {\n tempDirtyBounds.copy(drawContribution.dirtyBounds);\n tempBackupDirtyBounds.copy(drawContribution.backupDirtyBounds);\n const m = graphic.globalTransMatrix.getInverse();\n drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m);\n drawContribution.backupDirtyBounds.copy(drawContribution.dirtyBounds);\n }\n\n // 设置context的transform到上一个节点\n drawContribution.renderGroup(graphic.shadowRoot, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0));\n\n context.highPerformanceRestore();\n\n if (drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {\n drawContribution.dirtyBounds.copy(tempDirtyBounds);\n drawContribution.backupDirtyBounds.copy(tempBackupDirtyBounds);\n }\n\n return true;\n }\n}\n\n// @injectable()\nexport class DebugDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n\n afterDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n if (graphic.attribute._debug_bounds) {\n this.drawItem(graphic, renderService, drawContext, drawContribution, params);\n }\n return false;\n }\n\n protected drawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n if (!graphic.attribute._debug_bounds) {\n return false;\n }\n\n const { context } = drawContext;\n context.highPerformanceSave();\n // 直接transform\n graphic.parent && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);\n graphic.glyphHost &&\n graphic.glyphHost.parent &&\n context.setTransformFromMatrix(graphic.glyphHost.parent.globalTransMatrix, true);\n\n const b = graphic.AABBBounds;\n\n if (graphic.attribute._debug_bounds !== true) {\n graphic.attribute._debug_bounds(context, graphic);\n }\n context.strokeRect(b.x1, b.y1, b.width(), b.height());\n\n context.highPerformanceRestore();\n\n return true;\n }\n}\n\n@injectable()\nexport class CommonDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n interceptors: IDrawItemInterceptorContribution[];\n constructor() {\n this.interceptors = [\n new ShadowRootDrawItemInterceptorContribution(),\n new Canvas3DDrawItemInterceptor(),\n new InteractiveDrawItemInterceptorContribution(),\n new DebugDrawItemInterceptorContribution()\n ];\n }\n afterDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 【性能方案】判定写在外层,减少遍历判断耗时,10000条数据减少1ms\n if (\n (!graphic.in3dMode || drawContext.in3dInterceptor) &&\n !graphic.shadowRoot &&\n !graphic.attribute._debug_bounds &&\n !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)\n ) {\n return false;\n }\n\n for (let i = 0; i < this.interceptors.length; i++) {\n if (\n this.interceptors[i].afterDrawItem &&\n this.interceptors[i].afterDrawItem(graphic, renderService, drawContext, drawContribution, params)\n ) {\n return true;\n }\n }\n return false;\n }\n\n beforeDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 【性能方案】判定写在外层,减少遍历判断耗时,10000条数据减少1ms\n if (\n (!graphic.in3dMode || drawContext.in3dInterceptor) &&\n !graphic.shadowRoot &&\n !graphic.attribute._debug_bounds &&\n !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)\n ) {\n return false;\n }\n\n for (let i = 0; i < this.interceptors.length; i++) {\n if (\n this.interceptors[i].beforeDrawItem &&\n this.interceptors[i].beforeDrawItem(graphic, renderService, drawContext, drawContribution, params)\n ) {\n return true;\n }\n }\n return false;\n }\n}\n\n/**\n * 交互层节点拦截器,用于支持交互层图元\n */\n// @injectable()\nexport class InteractiveDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n processing: boolean;\n // afterDrawItem(\n // graphic: IGraphic,\n // renderService: IRenderService,\n // drawContext: IDrawContext,\n // drawContribution: IDrawContribution,\n // params?: IGraphicRenderDrawParams\n // ): boolean {\n\n // if (graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx) {\n // this.drawItem(graphic, renderService, drawContext, drawContribution, params);\n // }\n // return false;\n // }\n\n beforeDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n if (this.processing) {\n return false;\n }\n // 判断是否在交互层\n if (graphic.baseGraphic) {\n return this.beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params);\n }\n return this.beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params);\n }\n\n /**\n * 用于提升interactive\n * @param graphic\n * @param renderService\n * @param drawContext\n * @param drawContribution\n * @param params\n */\n beforeSetInteractive(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n let interactiveGraphic: IGraphic = graphic.interactiveGraphic;\n if (graphic.attribute.globalZIndex) {\n if (!interactiveGraphic) {\n interactiveGraphic = graphic.clone();\n graphic.interactiveGraphic = interactiveGraphic;\n interactiveGraphic.baseGraphic = graphic;\n }\n // 设置位置\n // const m = graphic.globalTransMatrix;\n interactiveGraphic.setAttributes(\n {\n globalZIndex: 0,\n zIndex: graphic.attribute.globalZIndex\n },\n false,\n { skipUpdateCallback: true }\n );\n // 添加到交互层中\n drawContext.stage.tryInitInteractiveLayer();\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n const shadowRoot = this.getShadowRoot(interactiveLayer);\n shadowRoot.add(interactiveGraphic);\n }\n return true;\n } else if (interactiveGraphic) {\n // 从交互层中删除\n drawContext.stage.tryInitInteractiveLayer();\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n const shadowRoot = this.getShadowRoot(interactiveLayer);\n shadowRoot.removeChild(interactiveGraphic);\n }\n graphic.interactiveGraphic = null;\n interactiveGraphic.baseGraphic = null;\n }\n return false;\n }\n\n /**\n * 用于绘制interactive\n * @param graphic\n * @param renderService\n * @param drawContext\n * @param drawContribution\n * @param params\n */\n beforeDrawInteractive(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 默认使用原始的图元\n const baseGraphic = graphic.baseGraphic as IGraphic;\n // 如果主图元被删除了,那把交互图元这个也删除\n // 一直往上找\n let intree = !!baseGraphic.stage;\n let _g = baseGraphic.parent;\n while (intree && _g) {\n if ((_g as any).stage === _g) {\n break;\n }\n intree = !!_g.stage;\n _g = _g.parent;\n }\n if (!intree) {\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n const shadowRoot = this.getShadowRoot(interactiveLayer);\n shadowRoot.removeChild(graphic);\n }\n return true;\n }\n if (baseGraphic) {\n this.processing = true;\n const { context } = drawContext;\n context.highPerformanceSave();\n // 直接transform\n context.setTransformFromMatrix(baseGraphic.parent.globalTransMatrix, true);\n // context.fillRect(0, 0, 100, 100);\n // 设置context的transform到上一个节点\n baseGraphic.isContainer\n ? drawContribution.renderGroup(baseGraphic as IGroup, drawContext, baseGraphic.parent.globalTransMatrix)\n : drawContribution.renderItem(baseGraphic, drawContext);\n\n context.highPerformanceRestore();\n this.processing = false;\n\n return true;\n }\n return false;\n }\n getShadowRoot(interactiveLayer: ILayer) {\n // 获取绑定影子节点的group\n let group = interactiveLayer.getElementById('_interactive_group') as IGroup;\n if (!group) {\n group = graphicCreator.CreateGraphic('group', {});\n group.id = '_interactive_group';\n interactiveLayer.add(group);\n }\n return group.shadowRoot ?? group.attachShadow();\n }\n}\n\n/**\n * 3d拦截器,用于渲染3d视角\n */\n// @injectable()\nexport class Canvas3DDrawItemInterceptor implements IDrawItemInterceptorContribution {\n // canvas?: ICanvas;\n order: number = 1;\n\n beforeDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ) {\n if (!graphic.in3dMode || drawContext.in3dInterceptor) {\n return false;\n }\n\n drawContext.in3dInterceptor = true;\n const { context, stage } = renderService.drawParams;\n const canvas = context.canvas;\n\n // 使用3d模式渲染\n context.save();\n this.initCanvasCtx(context);\n context.camera = stage.camera;\n\n // 将三维矩阵换成四维矩阵\n const m = context.currentMatrix;\n m.a /= context.dpr;\n m.b /= context.dpr;\n m.c /= context.dpr;\n m.d /= context.dpr;\n m.e /= context.dpr;\n m.f /= context.dpr;\n const matrix = mat4Allocate.allocate();\n mat3Tomat4(matrix, m);\n const lastModelMatrix = context.modelMatrix;\n if (lastModelMatrix) {\n if (matrix) {\n const m = mat4Allocate.allocate();\n context.modelMatrix = multiplyMat4Mat4(m, lastModelMatrix, matrix);\n }\n } else {\n context.modelMatrix = matrix;\n }\n context.setTransform(1, 0, 0, 1, 0, 0, true);\n\n // 设置context的transform到上一个节点\n if (graphic.isContainer) {\n draw3dItem(\n context,\n graphic,\n (isPie: boolean, is3d: boolean) => {\n return drawContribution.renderGroup(\n graphic as IGroup,\n drawContext,\n graphic.parent.globalTransMatrix,\n !isPie && is3d\n );\n },\n drawContext\n );\n } else {\n drawContribution.renderItem(graphic, drawContext);\n }\n context.camera = null;\n context.restore();\n\n if (context.modelMatrix !== lastModelMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastModelMatrix;\n\n drawContext.in3dInterceptor = false;\n return true;\n }\n\n initCanvasCtx(context: IContext2d) {\n context.setTransformForCurrent();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/draw-interceptor.ts"],"names":[],"mappings":";;;;;;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C,WAAW,GAAG,eAAe,CAAC;QAEtC,WAAW,CAAC,eAAe,GAAG,KAAK,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa,CAAC,OAAmB;QAC/B,OAAO,CAAC,sBAAsB,EAAE,CAAC;IACnC,CAAC;CACF;AA9ED,kEA8EC","file":"draw-interceptor.js","sourcesContent":["import { injectable } from '../../../common/inversify-lite';\nimport { AABBBounds } from '@visactor/vutils';\nimport { mat3Tomat4, multiplyMat4Mat4 } from '../../../common/matrix';\nimport { graphicCreator } from '../../../graphic/graphic-creator';\nimport type {\n IContext2d,\n IDrawContext,\n IDrawContribution,\n IDrawItemInterceptorContribution,\n IGraphic,\n IGraphicRenderDrawParams,\n IGroup,\n ILayer,\n IRenderService\n} from '../../../interface';\nimport { mat4Allocate, matrixAllocate } from '../../../allocator/matrix-allocate';\nimport { draw3dItem } from '../../../common/3d-interceptor';\n\n// 拦截器\nexport const DrawItemInterceptor = Symbol.for('DrawItemInterceptor');\n\n// @injectable()\n// export class DefaultDrawItemInterceptor implements IDrawItemInterceptor {\n// drawItem(graphic: IGraphic, renderService: IRenderService, params?: IGraphicRenderDrawParams): boolean {\n// return false;\n// }\n// }\n\nconst tempDirtyBounds = new AABBBounds();\nconst tempBackupDirtyBounds = new AABBBounds();\n/**\n * 影子节点拦截器,用于渲染影子节点\n */\n// @injectable()\nexport class ShadowRootDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n afterDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 如果graphic没设置shadowRootIdx,shadowRoot设置了,那就使用shadowRoot的shadowRootIdx\n if (\n graphic.attribute.shadowRootIdx == null &&\n graphic.shadowRoot &&\n graphic.shadowRoot.attribute.shadowRootIdx < 0\n ) {\n return false;\n }\n if (\n graphic.attribute.shadowRootIdx > 0 ||\n !graphic.attribute.shadowRootIdx ||\n (graphic.shadowRoot && graphic.shadowRoot.attribute.shadowRootIdx > 0)\n ) {\n this.drawItem(graphic, renderService, drawContext, drawContribution, params);\n }\n return false;\n }\n\n beforeDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 如果graphic没设置shadowRootIdx,shadowRoot设置了,那就使用shadowRoot的shadowRootIdx\n if (\n graphic.attribute.shadowRootIdx == null &&\n graphic.shadowRoot &&\n graphic.shadowRoot.attribute.shadowRootIdx > 0\n ) {\n return false;\n }\n if (graphic.attribute.shadowRootIdx < 0 || (graphic.shadowRoot && graphic.shadowRoot.attribute.shadowRootIdx < 0)) {\n this.drawItem(graphic, renderService, drawContext, drawContribution, params);\n }\n return false;\n }\n\n protected drawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n if (!graphic.shadowRoot) {\n return false;\n }\n\n const { context } = drawContext;\n context.highPerformanceSave();\n // 直接transform\n context.transformFromMatrix(graphic.transMatrix, true);\n\n // 变换dirtyBounds\n if (drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {\n tempDirtyBounds.copy(drawContribution.dirtyBounds);\n tempBackupDirtyBounds.copy(drawContribution.backupDirtyBounds);\n const m = graphic.globalTransMatrix.getInverse();\n drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m);\n drawContribution.backupDirtyBounds.copy(drawContribution.dirtyBounds);\n }\n\n // 设置context的transform到上一个节点\n drawContribution.renderGroup(graphic.shadowRoot, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0));\n\n context.highPerformanceRestore();\n\n if (drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {\n drawContribution.dirtyBounds.copy(tempDirtyBounds);\n drawContribution.backupDirtyBounds.copy(tempBackupDirtyBounds);\n }\n\n return true;\n }\n}\n\n// @injectable()\nexport class DebugDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n\n afterDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n if (graphic.attribute._debug_bounds) {\n this.drawItem(graphic, renderService, drawContext, drawContribution, params);\n }\n return false;\n }\n\n protected drawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n if (!graphic.attribute._debug_bounds) {\n return false;\n }\n\n const { context } = drawContext;\n context.highPerformanceSave();\n // 直接transform\n graphic.parent && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);\n graphic.glyphHost &&\n graphic.glyphHost.parent &&\n context.setTransformFromMatrix(graphic.glyphHost.parent.globalTransMatrix, true);\n\n const b = graphic.AABBBounds;\n\n if (graphic.attribute._debug_bounds !== true) {\n graphic.attribute._debug_bounds(context, graphic);\n }\n context.strokeRect(b.x1, b.y1, b.width(), b.height());\n\n context.highPerformanceRestore();\n\n return true;\n }\n}\n\n@injectable()\nexport class CommonDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n interceptors: IDrawItemInterceptorContribution[];\n constructor() {\n this.interceptors = [\n new ShadowRootDrawItemInterceptorContribution(),\n new Canvas3DDrawItemInterceptor(),\n new InteractiveDrawItemInterceptorContribution(),\n new DebugDrawItemInterceptorContribution()\n ];\n }\n afterDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n for (let i = 0; i < this.interceptors.length; i++) {\n if (\n this.interceptors[i].afterDrawItem &&\n this.interceptors[i].afterDrawItem(graphic, renderService, drawContext, drawContribution, params)\n ) {\n return true;\n }\n }\n return false;\n }\n\n beforeDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 【性能方案】判定写在外层,减少遍历判断耗时,10000条数据减少1ms\n if (\n (!graphic.in3dMode || drawContext.in3dInterceptor) &&\n !graphic.shadowRoot &&\n !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)\n ) {\n return false;\n }\n\n for (let i = 0; i < this.interceptors.length; i++) {\n if (\n this.interceptors[i].beforeDrawItem &&\n this.interceptors[i].beforeDrawItem(graphic, renderService, drawContext, drawContribution, params)\n ) {\n return true;\n }\n }\n return false;\n }\n}\n\n/**\n * 交互层节点拦截器,用于支持交互层图元\n */\n// @injectable()\nexport class InteractiveDrawItemInterceptorContribution implements IDrawItemInterceptorContribution {\n order: number = 1;\n processing: boolean;\n // afterDrawItem(\n // graphic: IGraphic,\n // renderService: IRenderService,\n // drawContext: IDrawContext,\n // drawContribution: IDrawContribution,\n // params?: IGraphicRenderDrawParams\n // ): boolean {\n\n // if (graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx) {\n // this.drawItem(graphic, renderService, drawContext, drawContribution, params);\n // }\n // return false;\n // }\n\n beforeDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n if (this.processing) {\n return false;\n }\n // 判断是否在交互层\n if (graphic.baseGraphic) {\n return this.beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params);\n }\n return this.beforeSetInteractive(graphic, renderService, drawContext, drawContribution, params);\n }\n\n /**\n * 用于提升interactive\n * @param graphic\n * @param renderService\n * @param drawContext\n * @param drawContribution\n * @param params\n */\n beforeSetInteractive(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n let interactiveGraphic: IGraphic = graphic.interactiveGraphic;\n if (graphic.attribute.globalZIndex) {\n if (!interactiveGraphic) {\n interactiveGraphic = graphic.clone();\n graphic.interactiveGraphic = interactiveGraphic;\n interactiveGraphic.baseGraphic = graphic;\n }\n // 设置位置\n // const m = graphic.globalTransMatrix;\n interactiveGraphic.setAttributes(\n {\n globalZIndex: 0,\n zIndex: graphic.attribute.globalZIndex\n },\n false,\n { skipUpdateCallback: true }\n );\n // 添加到交互层中\n drawContext.stage.tryInitInteractiveLayer();\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n const shadowRoot = this.getShadowRoot(interactiveLayer);\n shadowRoot.add(interactiveGraphic);\n }\n return true;\n } else if (interactiveGraphic) {\n // 从交互层中删除\n drawContext.stage.tryInitInteractiveLayer();\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n const shadowRoot = this.getShadowRoot(interactiveLayer);\n shadowRoot.removeChild(interactiveGraphic);\n }\n graphic.interactiveGraphic = null;\n interactiveGraphic.baseGraphic = null;\n }\n return false;\n }\n\n /**\n * 用于绘制interactive\n * @param graphic\n * @param renderService\n * @param drawContext\n * @param drawContribution\n * @param params\n */\n beforeDrawInteractive(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ): boolean {\n // 默认使用原始的图元\n const baseGraphic = graphic.baseGraphic as IGraphic;\n // 如果主图元被删除了,那把交互图元这个也删除\n // 一直往上找\n let intree = !!baseGraphic.stage;\n let _g = baseGraphic.parent;\n while (intree && _g) {\n if ((_g as any).stage === _g) {\n break;\n }\n intree = !!_g.stage;\n _g = _g.parent;\n }\n if (!intree) {\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n const shadowRoot = this.getShadowRoot(interactiveLayer);\n shadowRoot.removeChild(graphic);\n }\n return true;\n }\n if (baseGraphic) {\n this.processing = true;\n const { context } = drawContext;\n context.highPerformanceSave();\n // 直接transform\n context.setTransformFromMatrix(baseGraphic.parent.globalTransMatrix, true);\n // context.fillRect(0, 0, 100, 100);\n // 设置context的transform到上一个节点\n baseGraphic.isContainer\n ? drawContribution.renderGroup(baseGraphic as IGroup, drawContext, baseGraphic.parent.globalTransMatrix)\n : drawContribution.renderItem(baseGraphic, drawContext);\n\n context.highPerformanceRestore();\n this.processing = false;\n\n return true;\n }\n return false;\n }\n getShadowRoot(interactiveLayer: ILayer) {\n // 获取绑定影子节点的group\n let group = interactiveLayer.getElementById('_interactive_group') as IGroup;\n if (!group) {\n group = graphicCreator.CreateGraphic('group', {});\n group.id = '_interactive_group';\n interactiveLayer.add(group);\n }\n return group.shadowRoot ?? group.attachShadow();\n }\n}\n\n/**\n * 3d拦截器,用于渲染3d视角\n */\n// @injectable()\nexport class Canvas3DDrawItemInterceptor implements IDrawItemInterceptorContribution {\n // canvas?: ICanvas;\n order: number = 1;\n\n beforeDrawItem(\n graphic: IGraphic,\n renderService: IRenderService,\n drawContext: IDrawContext,\n drawContribution: IDrawContribution,\n params?: IGraphicRenderDrawParams\n ) {\n if (!graphic.in3dMode || drawContext.in3dInterceptor) {\n return false;\n }\n\n drawContext.in3dInterceptor = true;\n const { context, stage } = renderService.drawParams;\n const canvas = context.canvas;\n\n // 使用3d模式渲染\n context.save();\n this.initCanvasCtx(context);\n context.camera = stage.camera;\n\n // 将三维矩阵换成四维矩阵\n const m = context.currentMatrix;\n m.a /= context.dpr;\n m.b /= context.dpr;\n m.c /= context.dpr;\n m.d /= context.dpr;\n m.e /= context.dpr;\n m.f /= context.dpr;\n const matrix = mat4Allocate.allocate();\n mat3Tomat4(matrix, m);\n const lastModelMatrix = context.modelMatrix;\n if (lastModelMatrix) {\n if (matrix) {\n const m = mat4Allocate.allocate();\n context.modelMatrix = multiplyMat4Mat4(m, lastModelMatrix, matrix);\n }\n } else {\n context.modelMatrix = matrix;\n }\n context.setTransform(1, 0, 0, 1, 0, 0, true);\n\n // 设置context的transform到上一个节点\n if (graphic.isContainer) {\n draw3dItem(\n context,\n graphic,\n (isPie: boolean, is3d: boolean) => {\n return drawContribution.renderGroup(\n graphic as IGroup,\n drawContext,\n graphic.parent.globalTransMatrix,\n !isPie && is3d\n );\n },\n drawContext\n );\n } else {\n drawContribution.renderItem(graphic, drawContext);\n }\n context.camera = null;\n context.restore();\n\n if (context.modelMatrix !== lastModelMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastModelMatrix;\n\n drawContext.in3dInterceptor = false;\n return true;\n }\n\n initCanvasCtx(context: IContext2d) {\n context.setTransformForCurrent();\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { IGraphicAttribute, IContext2d, IGroup, IMarkAttribute, IThemeAttribute, IGroupRenderContribution, IDrawContext, IRenderService, IGraphicRender, IGraphicRenderDrawParams, IContributionProvider, IGroupGraphicAttribute } from '../../../interface';
1
+ import type { IGraphicAttribute, IContext2d, IGroup, IMarkAttribute, IThemeAttribute, IGroupRenderContribution, IDrawContext, IRenderService, IGraphicRender, IGraphicRenderDrawParams, IContributionProvider } from '../../../interface';
2
2
  export declare class DefaultCanvasGroupRender implements IGraphicRender {
3
3
  protected readonly groupRenderContribitions: IContributionProvider<IGroupRenderContribution>;
4
4
  type: 'group';
@@ -6,6 +6,6 @@ export declare class DefaultCanvasGroupRender implements IGraphicRender {
6
6
  _groupRenderContribitions: IGroupRenderContribution[];
7
7
  constructor(groupRenderContribitions: IContributionProvider<IGroupRenderContribution>);
8
8
  reInit(): void;
9
- drawShape(group: IGroup, context: IContext2d, x: number, y: number, drawContext: IDrawContext, params?: IGraphicRenderDrawParams, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, groupAttribute?: Required<IGroupGraphicAttribute>): void;
9
+ drawShape(group: IGroup, context: IContext2d, x: number, y: number, drawContext: IDrawContext, params?: IGraphicRenderDrawParams, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
10
10
  draw(group: IGroup, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams): void;
11
11
  }
@@ -16,7 +16,7 @@ Object.defineProperty(exports, "__esModule", {
16
16
  value: !0
17
17
  }), exports.DefaultCanvasGroupRender = void 0;
18
18
 
19
- const inversify_lite_1 = require("../../../common/inversify-lite"), theme_1 = require("../../../graphic/theme"), graphic_service_1 = require("../../../graphic/graphic-service/graphic-service"), vutils_1 = require("@visactor/vutils"), contribution_provider_1 = require("../../../common/contribution-provider"), rect_1 = require("../../../common/shape/rect"), utils_1 = require("./utils"), constants_1 = require("./contributions/constants"), matrix_allocate_1 = require("../../../allocator/matrix-allocate"), constants_2 = require("../../../graphic/constants"), enums_1 = require("../../../common/enums"), contributions_1 = require("./contributions"), matrix_1 = require("../../../common/matrix"), application_1 = require("../../../application");
19
+ const inversify_lite_1 = require("../../../common/inversify-lite"), theme_1 = require("../../../graphic/theme"), graphic_service_1 = require("../../../graphic/graphic-service/graphic-service"), vutils_1 = require("@visactor/vutils"), contribution_provider_1 = require("../../../common/contribution-provider"), rect_1 = require("../../../common/shape/rect"), utils_1 = require("./utils"), constants_1 = require("./contributions/constants"), matrix_allocate_1 = require("../../../allocator/matrix-allocate"), constants_2 = require("../../../graphic/constants"), enums_1 = require("../../../common/enums"), contributions_1 = require("./contributions"), matrix_1 = require("../../../common/matrix"), modules_1 = require("../../../modules");
20
20
 
21
21
  let DefaultCanvasGroupRender = class {
22
22
  constructor(groupRenderContribitions) {
@@ -26,11 +26,8 @@ let DefaultCanvasGroupRender = class {
26
26
  this._groupRenderContribitions = this.groupRenderContribitions.getContributions() || [],
27
27
  this._groupRenderContribitions.push(contributions_1.defaultGroupBackgroundRenderContribution);
28
28
  }
29
- drawShape(group, context, x, y, drawContext, params, fillCb, strokeCb, groupAttribute) {
30
- const {clip: clip, fill: fill, stroke: stroke, background: background} = group.attribute;
31
- if (!(clip || fill || stroke || background)) return;
32
- groupAttribute = null != groupAttribute ? groupAttribute : (0, theme_1.getTheme)(group, null == params ? void 0 : params.theme).group;
33
- const {opacity: opacity = groupAttribute.opacity, width: width = groupAttribute.width, height: height = groupAttribute.height, fillOpacity: fillOpacity = groupAttribute.fillOpacity, strokeOpacity: strokeOpacity = groupAttribute.strokeOpacity, cornerRadius: cornerRadius = groupAttribute.cornerRadius, path: path = groupAttribute.path, lineWidth: lineWidth = groupAttribute.lineWidth, visible: visible = groupAttribute.visible, fillStrokeOrder: fillStrokeOrder = groupAttribute.fillStrokeOrder, cornerType: cornerType = groupAttribute.cornerType, x: originX = groupAttribute.x, y: originY = groupAttribute.y} = group.attribute, fVisible = (0,
29
+ drawShape(group, context, x, y, drawContext, params, fillCb, strokeCb) {
30
+ const groupAttribute = (0, theme_1.getTheme)(group, null == params ? void 0 : params.theme).group, {fill: fill = groupAttribute.fill, background: background, stroke: stroke = groupAttribute.stroke, opacity: opacity = groupAttribute.opacity, width: width = groupAttribute.width, height: height = groupAttribute.height, clip: clip = groupAttribute.clip, fillOpacity: fillOpacity = groupAttribute.fillOpacity, strokeOpacity: strokeOpacity = groupAttribute.strokeOpacity, cornerRadius: cornerRadius = groupAttribute.cornerRadius, path: path = groupAttribute.path, lineWidth: lineWidth = groupAttribute.lineWidth, visible: visible = groupAttribute.visible, fillStrokeOrder: fillStrokeOrder = groupAttribute.fillStrokeOrder, cornerType: cornerType = groupAttribute.cornerType, x: originX = groupAttribute.x, y: originY = groupAttribute.y} = group.attribute, fVisible = (0,
34
31
  utils_1.rectFillVisible)(opacity, fillOpacity, width, height, fill), sVisible = (0,
35
32
  utils_1.rectStrokeVisible)(opacity, strokeOpacity, width, height), doFill = (0,
36
33
  utils_1.runFill)(fill, background), doStroke = (0, utils_1.runStroke)(stroke, lineWidth);
@@ -69,12 +66,11 @@ let DefaultCanvasGroupRender = class {
69
66
  }));
70
67
  }
71
68
  draw(group, renderService, drawContext, params) {
72
- var _a, _b;
73
69
  const {context: context} = drawContext;
74
70
  if (!context) return;
75
- const {clip: clip, baseOpacity: baseOpacity = 1, drawMode: drawMode} = group.attribute, lastNativeContext = context.nativeContext, lastNativeCanvas = context.canvas.nativeCanvas;
71
+ const {clip: clip, baseOpacity: baseOpacity = 1, drawMode: drawMode, x: x, y: y, width: width, height: height} = group.attribute, lastNativeContext = context.nativeContext, lastNativeCanvas = context.canvas.nativeCanvas;
76
72
  if (drawMode > 0) {
77
- const {x: x, y: y, width: width, height: height} = group.attribute, canvas = context.canvas, newCanvas = application_1.application.global.createCanvas({
73
+ const canvas = context.canvas, newCanvas = modules_1.vglobal.createCanvas({
78
74
  width: canvas.width,
79
75
  height: canvas.height,
80
76
  dpr: 1
@@ -88,22 +84,22 @@ let DefaultCanvasGroupRender = class {
88
84
  clip ? context.save() : context.highPerformanceSave();
89
85
  const baseGlobalAlpha = context.baseGlobalAlpha;
90
86
  context.baseGlobalAlpha *= baseOpacity;
91
- const lastModelMatrix = context.modelMatrix;
87
+ const groupAttribute = (0, theme_1.getTheme)(group, null == params ? void 0 : params.theme).group, lastModelMatrix = context.modelMatrix;
92
88
  if (context.camera) {
93
- const groupAttribute = (0, theme_1.getTheme)(group, null == params ? void 0 : params.theme).group, nextModelMatrix = matrix_allocate_1.mat4Allocate.allocate(), modelMatrix = matrix_allocate_1.mat4Allocate.allocate();
89
+ const nextModelMatrix = matrix_allocate_1.mat4Allocate.allocate(), modelMatrix = matrix_allocate_1.mat4Allocate.allocate();
94
90
  (0, graphic_service_1.getModelMatrix)(modelMatrix, group, groupAttribute), lastModelMatrix ? (0,
95
91
  matrix_1.multiplyMat4Mat4)(nextModelMatrix, lastModelMatrix, modelMatrix) : (0,
96
92
  matrix_1.multiplyMat4Mat4)(nextModelMatrix, nextModelMatrix, modelMatrix), context.modelMatrix = nextModelMatrix,
97
93
  matrix_allocate_1.mat4Allocate.free(modelMatrix), context.setTransform(1, 0, 0, 1, 0, 0, !0);
98
94
  } else context.transformFromMatrix(group.transMatrix, !0);
99
- context.beginPath(), params.skipDraw ? this.drawShape(group, context, 0, 0, drawContext, params, (() => !1), (() => !1)) : this.drawShape(group, context, 0, 0, drawContext, null, null, null);
100
- const {scrollX: scrollX, scrollY: scrollY} = group.attribute;
95
+ context.beginPath(), params.skipDraw ? this.drawShape(group, context, 0, 0, drawContext, params, (() => !1), (() => !1)) : this.drawShape(group, context, 0, 0, drawContext);
96
+ const {scrollX: scrollX = groupAttribute.scrollX, scrollY: scrollY = groupAttribute.scrollY} = group.attribute;
101
97
  let p;
102
- if ((scrollX || scrollY) && context.translate(scrollX, scrollY), params && params.renderInGroup && (p = params.renderInGroup(null === (_a = params.renderInGroupParams) || void 0 === _a ? void 0 : _a.skipSort, group, drawContext, null === (_b = params.renderInGroupParams) || void 0 === _b ? void 0 : _b.nextM)),
98
+ if ((scrollX || scrollY) && context.translate(scrollX, scrollY), params && params.drawingCb && (p = params.drawingCb()),
103
99
  context.modelMatrix !== lastModelMatrix && matrix_allocate_1.mat4Allocate.free(context.modelMatrix),
104
100
  context.modelMatrix = lastModelMatrix, context.baseGlobalAlpha = baseGlobalAlpha,
105
101
  drawMode > 0) {
106
- const {x: x, y: y, width: width, height: height} = group.attribute, newContext = context.nativeContext, newCanvas = context.canvas.nativeCanvas;
102
+ const newContext = context.nativeContext, newCanvas = context.canvas.nativeCanvas;
107
103
  lastNativeContext.save(), lastNativeContext.setTransform(context.dpr, 0, 0, context.dpr, 0, 0, !0),
108
104
  1 === drawMode && newContext.rect(x, y, width, height), lastNativeContext.drawImage(newCanvas, 0, 0, newCanvas.width, newCanvas.height, 0, 0, context.canvas.displayWidth, context.canvas.displayHeight);
109
105
  const transform = newContext.getTransform();
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contribut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;GARtB,wBAAwB,CAsXpC;AAtXY,4DAAwB","file":"group-render.js","sourcesContent":["import { inject, injectable, named } from '../../../common/inversify-lite';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IGroup,\n IMarkAttribute,\n IThemeAttribute,\n IGroupRenderContribution,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider,\n IGroupGraphicAttribute\n} from '../../../interface';\nimport { getTheme } from '../../../graphic/theme';\nimport { getModelMatrix } from '../../../graphic/graphic-service/graphic-service';\nimport { isArray } from '@visactor/vutils';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { createRectPath } from '../../../common/shape/rect';\nimport { rectFillVisible, rectStrokeVisible, runFill, runStroke } from './utils';\nimport { GroupRenderContribution } from './contributions/constants';\nimport { mat4Allocate } from '../../../allocator/matrix-allocate';\nimport { GROUP_NUMBER_TYPE } from '../../../graphic/constants';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { defaultGroupBackgroundRenderContribution } from './contributions';\nimport { multiplyMat4Mat4 } from '../../../common/matrix';\nimport { application } from '../../../application';\n\n@injectable()\nexport class DefaultCanvasGroupRender implements IGraphicRender {\n type: 'group';\n numberType: number = GROUP_NUMBER_TYPE;\n\n _groupRenderContribitions: IGroupRenderContribution[];\n\n constructor(\n @inject(ContributionProvider)\n @named(GroupRenderContribution)\n protected readonly groupRenderContribitions: IContributionProvider<IGroupRenderContribution>\n ) {}\n\n reInit() {\n this._groupRenderContribitions = this.groupRenderContribitions.getContributions() || [];\n this._groupRenderContribitions.push(defaultGroupBackgroundRenderContribution);\n }\n\n drawShape(\n group: IGroup,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n groupAttribute?: Required<IGroupGraphicAttribute>\n ) {\n // 提前判定,否则每次都要获取一堆属性\n const { clip, fill, stroke, background } = group.attribute;\n\n if (!(clip || fill || stroke || background)) {\n return;\n }\n\n groupAttribute = groupAttribute ?? getTheme(group, params?.theme).group;\n\n const {\n opacity = groupAttribute.opacity,\n width = groupAttribute.width,\n height = groupAttribute.height,\n fillOpacity = groupAttribute.fillOpacity,\n strokeOpacity = groupAttribute.strokeOpacity,\n cornerRadius = groupAttribute.cornerRadius,\n path = groupAttribute.path,\n lineWidth = groupAttribute.lineWidth,\n visible = groupAttribute.visible,\n fillStrokeOrder = groupAttribute.fillStrokeOrder,\n cornerType = groupAttribute.cornerType,\n x: originX = groupAttribute.x,\n y: originY = groupAttribute.y\n } = group.attribute;\n\n // 不绘制或者透明\n const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill);\n const sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height);\n const doFill = runFill(fill, background);\n const doStroke = runStroke(stroke, lineWidth);\n\n if (!(group.valid && visible)) {\n return;\n }\n\n if (!clip) {\n if (!(doFill || doStroke)) {\n return;\n }\n\n // 如果存在fillCb和strokeCb,那就不直接跳过\n if (!(fVisible || sVisible || fillCb || strokeCb || background)) {\n return;\n }\n }\n\n if (path && path.length && drawContext.drawContribution) {\n // 禁用fill和stroke\n const disableFill = context.disableFill;\n const disableStroke = context.disableStroke;\n const disableBeginPath = context.disableBeginPath;\n context.disableFill = true;\n context.disableStroke = true;\n context.disableBeginPath = true;\n path.forEach(g => {\n const rc = drawContext.drawContribution.getRenderContribution(g);\n rc.draw(g, drawContext.renderService, drawContext, params);\n });\n context.disableFill = disableFill;\n context.disableStroke = disableStroke;\n context.disableBeginPath = disableBeginPath;\n } else if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n context.beginPath();\n context.rect(x, y, width, height);\n } else {\n context.beginPath();\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache\n createRectPath(context, x, y, width, height, cornerRadius, cornerType !== 'bevel');\n }\n\n if (!this._groupRenderContribitions) {\n this._groupRenderContribitions = this.groupRenderContribitions.getContributions() || [];\n this._groupRenderContribitions.push(defaultGroupBackgroundRenderContribution);\n }\n\n const doFillOrStroke = {\n doFill,\n doStroke\n };\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(group, group.attribute, groupAttribute);\n\n this._groupRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.beforeFillStroke) {\n // c.useStyle && context.setCommonStyle(group, group.attribute, x, y, groupAttribute);\n c.drawShape(\n group,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n groupAttribute,\n drawContext,\n fillCb,\n strokeCb,\n doFillOrStroke\n );\n }\n });\n\n // beforeFillStroke contribition可以操作clip范围\n if (clip) {\n context.clip();\n }\n\n const _runFill = () => {\n if ((doFillOrStroke as any).doFill) {\n if (fillCb) {\n fillCb(context, group.attribute, groupAttribute);\n } else if (fVisible) {\n context.setCommonStyle(group, group.attribute, originX - x, originY - y, groupAttribute);\n context.fill();\n }\n }\n };\n\n const _runStroke = () => {\n if ((doFillOrStroke as any).doStroke) {\n if (strokeCb) {\n strokeCb(context, group.attribute, groupAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(group, group.attribute, originX - x, originY - y, groupAttribute);\n context.stroke();\n }\n }\n };\n\n if (!fillStrokeOrder) {\n _runFill();\n _runStroke();\n } else {\n _runStroke();\n _runFill();\n }\n\n this._groupRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.afterFillStroke) {\n // c.useStyle && context.setCommonStyle(group, group.attribute, x, y, groupAttribute);\n c.drawShape(\n group,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n groupAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n });\n }\n\n draw(group: IGroup, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const { context } = drawContext;\n if (!context) {\n return;\n }\n\n const { clip, baseOpacity = 1, drawMode } = group.attribute;\n const lastNativeContext = context.nativeContext;\n const lastNativeCanvas = context.canvas.nativeCanvas;\n\n if (drawMode > 0) {\n const { x, y, width, height } = group.attribute;\n // 绘制到新的Canvas上,然后再绘制回来\n const canvas = context.canvas;\n const newCanvas = application.global.createCanvas({ width: canvas.width, height: canvas.height, dpr: 1 });\n const newContext = newCanvas.getContext('2d');\n const transform = context.nativeContext.getTransform();\n // 首先应用transform\n newContext.setTransform(transform.a, transform.b, transform.c, transform.d, transform.e, transform.f);\n // 然后将背景绘制到新的canvas上,只绘制group的Bounds区域\n // 如果drawMode === 1,则需要背景\n // 如果drawMode === 2,则不需要背景,只需要group即可\n if (drawMode === 1) {\n newContext.save();\n newContext.clearRect(0, 0, canvas.width, canvas.height);\n newContext.beginPath();\n\n newContext.rect(x, y, width, height);\n newContext.clip();\n newContext.drawImage(\n canvas.nativeCanvas,\n 0,\n 0,\n canvas.width,\n canvas.height,\n 0,\n 0,\n canvas.displayWidth,\n canvas.displayHeight\n );\n newContext.restore();\n }\n // 狸猫换太子,把新的context赋值给context\n context.nativeContext = newContext;\n canvas.nativeCanvas = newCanvas;\n }\n if (clip) {\n context.save();\n } else {\n context.highPerformanceSave();\n }\n const baseGlobalAlpha = context.baseGlobalAlpha;\n context.baseGlobalAlpha *= baseOpacity;\n\n // const lastMatrix = context.modelMatrix;\n // if (context.camera) {\n // const m = group.transMatrix;\n // const matrix = createMat4();\n // mat3Tomat4(matrix, m);\n // const lastModelMatrix = context.modelMatrix;\n // if (lastModelMatrix) {\n // if (matrix) {\n // const m = createMat4();\n // context.modelMatrix = multiplyMat4Mat4(m, lastModelMatrix, matrix);\n // }\n // } else {\n // context.modelMatrix = matrix;\n // }\n // } else {\n // // group直接transform\n // context.transformFromMatrix(group.transMatrix, true);\n // }\n const lastModelMatrix = context.modelMatrix;\n const camera = context.camera;\n if (camera) {\n const groupAttribute = getTheme(group, params?.theme).group;\n const nextModelMatrix = mat4Allocate.allocate();\n // 计算模型矩阵\n const modelMatrix = mat4Allocate.allocate();\n getModelMatrix(modelMatrix, group, groupAttribute);\n if (lastModelMatrix) {\n multiplyMat4Mat4(nextModelMatrix, lastModelMatrix, modelMatrix);\n } else {\n multiplyMat4Mat4(nextModelMatrix, nextModelMatrix, modelMatrix);\n }\n context.modelMatrix = nextModelMatrix;\n mat4Allocate.free(modelMatrix);\n context.setTransform(1, 0, 0, 1, 0, 0, true);\n } else {\n // group直接transform\n context.transformFromMatrix(group.transMatrix, true);\n }\n\n context.beginPath();\n // 如果跳过绘制,那就不绘制\n if (params.skipDraw) {\n this.drawShape(\n group,\n context,\n 0,\n 0,\n drawContext,\n params,\n () => false,\n () => false\n );\n } else {\n this.drawShape(group, context, 0, 0, drawContext, null, null, null);\n }\n\n // 绘制子元素的时候要添加scroll\n const { scrollX, scrollY } = group.attribute;\n if (scrollX || scrollY) {\n context.translate(scrollX, scrollY);\n }\n let p: any;\n if (params && params.renderInGroup) {\n p = params.renderInGroup(\n params.renderInGroupParams?.skipSort,\n group,\n drawContext,\n params.renderInGroupParams?.nextM\n );\n }\n\n if (context.modelMatrix !== lastModelMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastModelMatrix;\n\n context.baseGlobalAlpha = baseGlobalAlpha;\n\n if (drawMode > 0) {\n const { x, y, width, height } = group.attribute;\n // 将原始的context和canvas恢复,另外将newCanvas上的内容绘制到lastCanvas上\n const newContext = context.nativeContext;\n const newCanvas = context.canvas.nativeCanvas;\n lastNativeContext.save();\n lastNativeContext.setTransform(context.dpr, 0, 0, context.dpr, 0, 0, true);\n // 如果drawMode === 1,则需要清一下之前的背景,否则背景就重复绘制了一次\n if (drawMode === 1) {\n newContext.rect(x, y, width, height);\n }\n lastNativeContext.drawImage(\n newCanvas,\n 0,\n 0,\n newCanvas.width,\n newCanvas.height,\n 0,\n 0,\n context.canvas.displayWidth,\n context.canvas.displayHeight\n );\n const transform = newContext.getTransform();\n lastNativeContext.setTransform(transform.a, transform.b, transform.c, transform.d, transform.e, transform.f);\n context.nativeContext = lastNativeContext;\n context.canvas.nativeCanvas = lastNativeCanvas;\n lastNativeContext.restore();\n }\n\n if (p && p.then) {\n p.then(() => {\n if (clip) {\n context.restore();\n } else {\n context.highPerformanceRestore();\n }\n });\n } else {\n if (clip) {\n context.restore();\n } else {\n context.highPerformanceRestore();\n }\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/group-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAA2E;AAc3E,kDAAkD;AAClD,sFAAkF;AAClF,6CAA2C;AAE3C,iFAA6E;AAC7E,qDAA4D;AAC5D,mCAAiF;AACjF,yDAAoE;AACpE,wEAAkE;AAClE,0DAA+D;AAC/D,iDAAmE;AACnE,mDAA2E;AAC3E,mDAA0D;AAC1D,8CAA2C;AAGpC,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAMnC,YAGqB,wBAAyE;QAAzE,6BAAwB,GAAxB,wBAAwB,CAAiD;QAP9F,eAAU,GAAW,6BAAiB,CAAC;IAQpC,CAAC;IAEJ,MAAM;QACJ,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC,wBAAwB,CAAC,gBAAgB,EAAE,IAAI,EAAE,CAAC;QACxF,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,wDAAwC,CAAC,CAAC;IAChF,CAAC;IAED,SAAS,CACP,KAAa,EACb,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ,QAIY;QAGZ,MAAM,cAAc,GAAG,IAAA,gBAAQ,EAAC,KAAK,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,KAAK,CAAC;QAC5D,MAAM,E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K,EAAC,mCAAuB,CAAC,CAAA;;GARtB,wBAAwB,CA6WpC;AA7WY,4DAAwB","file":"group-render.js","sourcesContent":["import { inject, injectable, named } from '../../../common/inversify-lite';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IGroup,\n IMarkAttribute,\n IThemeAttribute,\n IGroupRenderContribution,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider\n} from '../../../interface';\nimport { getTheme } from '../../../graphic/theme';\nimport { getModelMatrix } from '../../../graphic/graphic-service/graphic-service';\nimport { isArray } from '@visactor/vutils';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { createRectPath } from '../../../common/shape/rect';\nimport { rectFillVisible, rectStrokeVisible, runFill, runStroke } from './utils';\nimport { GroupRenderContribution } from './contributions/constants';\nimport { mat4Allocate } from '../../../allocator/matrix-allocate';\nimport { GROUP_NUMBER_TYPE } from '../../../graphic/constants';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { defaultGroupBackgroundRenderContribution } from './contributions';\nimport { multiplyMat4Mat4 } from '../../../common/matrix';\nimport { vglobal } from '../../../modules';\n\n@injectable()\nexport class DefaultCanvasGroupRender implements IGraphicRender {\n type: 'group';\n numberType: number = GROUP_NUMBER_TYPE;\n\n _groupRenderContribitions: IGroupRenderContribution[];\n\n constructor(\n @inject(ContributionProvider)\n @named(GroupRenderContribution)\n protected readonly groupRenderContribitions: IContributionProvider<IGroupRenderContribution>\n ) {}\n\n reInit() {\n this._groupRenderContribitions = this.groupRenderContribitions.getContributions() || [];\n this._groupRenderContribitions.push(defaultGroupBackgroundRenderContribution);\n }\n\n drawShape(\n group: IGroup,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n // const groupAttribute = graphicService.themeService.getCurrentTheme().groupAttribute;\n const groupAttribute = getTheme(group, params?.theme).group;\n const {\n fill = groupAttribute.fill,\n background,\n stroke = groupAttribute.stroke,\n opacity = groupAttribute.opacity,\n width = groupAttribute.width,\n height = groupAttribute.height,\n clip = groupAttribute.clip,\n fillOpacity = groupAttribute.fillOpacity,\n strokeOpacity = groupAttribute.strokeOpacity,\n cornerRadius = groupAttribute.cornerRadius,\n path = groupAttribute.path,\n lineWidth = groupAttribute.lineWidth,\n visible = groupAttribute.visible,\n fillStrokeOrder = groupAttribute.fillStrokeOrder,\n cornerType = groupAttribute.cornerType,\n x: originX = groupAttribute.x,\n y: originY = groupAttribute.y\n } = group.attribute;\n\n // 不绘制或者透明\n const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill);\n const sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height);\n const doFill = runFill(fill, background);\n const doStroke = runStroke(stroke, lineWidth);\n\n if (!(group.valid && visible)) {\n return;\n }\n\n if (!clip) {\n if (!(doFill || doStroke)) {\n return;\n }\n\n // 如果存在fillCb和strokeCb,那就不直接跳过\n if (!(fVisible || sVisible || fillCb || strokeCb || background)) {\n return;\n }\n }\n\n if (path && path.length && drawContext.drawContribution) {\n // 禁用fill和stroke\n const disableFill = context.disableFill;\n const disableStroke = context.disableStroke;\n const disableBeginPath = context.disableBeginPath;\n context.disableFill = true;\n context.disableStroke = true;\n context.disableBeginPath = true;\n path.forEach(g => {\n const rc = drawContext.drawContribution.getRenderContribution(g);\n rc.draw(g, drawContext.renderService, drawContext, params);\n });\n context.disableFill = disableFill;\n context.disableStroke = disableStroke;\n context.disableBeginPath = disableBeginPath;\n } else if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n context.beginPath();\n context.rect(x, y, width, height);\n } else {\n context.beginPath();\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache\n createRectPath(context, x, y, width, height, cornerRadius, cornerType !== 'bevel');\n }\n\n if (!this._groupRenderContribitions) {\n this._groupRenderContribitions = this.groupRenderContribitions.getContributions() || [];\n this._groupRenderContribitions.push(defaultGroupBackgroundRenderContribution);\n }\n\n const doFillOrStroke = {\n doFill,\n doStroke\n };\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(group, group.attribute, groupAttribute);\n\n this._groupRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.beforeFillStroke) {\n // c.useStyle && context.setCommonStyle(group, group.attribute, x, y, groupAttribute);\n c.drawShape(\n group,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n groupAttribute,\n drawContext,\n fillCb,\n strokeCb,\n doFillOrStroke\n );\n }\n });\n\n // beforeFillStroke contribition可以操作clip范围\n if (clip) {\n context.clip();\n }\n\n const _runFill = () => {\n if ((doFillOrStroke as any).doFill) {\n if (fillCb) {\n fillCb(context, group.attribute, groupAttribute);\n } else if (fVisible) {\n context.setCommonStyle(group, group.attribute, originX - x, originY - y, groupAttribute);\n context.fill();\n }\n }\n };\n\n const _runStroke = () => {\n if ((doFillOrStroke as any).doStroke) {\n if (strokeCb) {\n strokeCb(context, group.attribute, groupAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(group, group.attribute, originX - x, originY - y, groupAttribute);\n context.stroke();\n }\n }\n };\n\n if (!fillStrokeOrder) {\n _runFill();\n _runStroke();\n } else {\n _runStroke();\n _runFill();\n }\n\n this._groupRenderContribitions.forEach(c => {\n if (c.time === BaseRenderContributionTime.afterFillStroke) {\n // c.useStyle && context.setCommonStyle(group, group.attribute, x, y, groupAttribute);\n c.drawShape(\n group,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n groupAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n });\n }\n\n draw(group: IGroup, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const { context } = drawContext;\n if (!context) {\n return;\n }\n\n // debugger;\n const { clip, baseOpacity = 1, drawMode, x, y, width, height } = group.attribute;\n const lastNativeContext = context.nativeContext;\n const lastNativeCanvas = context.canvas.nativeCanvas;\n\n if (drawMode > 0) {\n // 绘制到新的Canvas上,然后再绘制回来\n const canvas = context.canvas;\n const newCanvas = vglobal.createCanvas({ width: canvas.width, height: canvas.height, dpr: 1 });\n const newContext = newCanvas.getContext('2d');\n const transform = context.nativeContext.getTransform();\n // 首先应用transform\n newContext.setTransform(transform.a, transform.b, transform.c, transform.d, transform.e, transform.f);\n // 然后将背景绘制到新的canvas上,只绘制group的Bounds区域\n // 如果drawMode === 1,则需要背景\n // 如果drawMode === 2,则不需要背景,只需要group即可\n if (drawMode === 1) {\n newContext.save();\n newContext.clearRect(0, 0, canvas.width, canvas.height);\n newContext.beginPath();\n\n newContext.rect(x, y, width, height);\n newContext.clip();\n newContext.drawImage(\n canvas.nativeCanvas,\n 0,\n 0,\n canvas.width,\n canvas.height,\n 0,\n 0,\n canvas.displayWidth,\n canvas.displayHeight\n );\n newContext.restore();\n }\n // 狸猫换太子,把新的context赋值给context\n context.nativeContext = newContext;\n canvas.nativeCanvas = newCanvas;\n }\n if (clip) {\n context.save();\n } else {\n context.highPerformanceSave();\n }\n const baseGlobalAlpha = context.baseGlobalAlpha;\n context.baseGlobalAlpha *= baseOpacity;\n\n const groupAttribute = getTheme(group, params?.theme).group;\n\n // const lastMatrix = context.modelMatrix;\n // if (context.camera) {\n // const m = group.transMatrix;\n // const matrix = createMat4();\n // mat3Tomat4(matrix, m);\n // const lastModelMatrix = context.modelMatrix;\n // if (lastModelMatrix) {\n // if (matrix) {\n // const m = createMat4();\n // context.modelMatrix = multiplyMat4Mat4(m, lastModelMatrix, matrix);\n // }\n // } else {\n // context.modelMatrix = matrix;\n // }\n // } else {\n // // group直接transform\n // context.transformFromMatrix(group.transMatrix, true);\n // }\n const lastModelMatrix = context.modelMatrix;\n const camera = context.camera;\n if (camera) {\n const nextModelMatrix = mat4Allocate.allocate();\n // 计算模型矩阵\n const modelMatrix = mat4Allocate.allocate();\n getModelMatrix(modelMatrix, group, groupAttribute);\n if (lastModelMatrix) {\n multiplyMat4Mat4(nextModelMatrix, lastModelMatrix, modelMatrix);\n } else {\n multiplyMat4Mat4(nextModelMatrix, nextModelMatrix, modelMatrix);\n }\n context.modelMatrix = nextModelMatrix;\n mat4Allocate.free(modelMatrix);\n context.setTransform(1, 0, 0, 1, 0, 0, true);\n } else {\n // group直接transform\n context.transformFromMatrix(group.transMatrix, true);\n }\n\n context.beginPath();\n // 如果跳过绘制,那就不绘制\n if (params.skipDraw) {\n this.drawShape(\n group,\n context,\n 0,\n 0,\n drawContext,\n params,\n () => false,\n () => false\n );\n } else {\n this.drawShape(group, context, 0, 0, drawContext);\n }\n\n // 绘制子元素的时候要添加scroll\n const { scrollX = groupAttribute.scrollX, scrollY = groupAttribute.scrollY } = group.attribute;\n if (scrollX || scrollY) {\n context.translate(scrollX, scrollY);\n }\n let p: any;\n if (params && params.drawingCb) {\n p = params.drawingCb();\n }\n\n if (context.modelMatrix !== lastModelMatrix) {\n mat4Allocate.free(context.modelMatrix);\n }\n context.modelMatrix = lastModelMatrix;\n\n context.baseGlobalAlpha = baseGlobalAlpha;\n\n if (drawMode > 0) {\n // 将原始的context和canvas恢复,另外将newCanvas上的内容绘制到lastCanvas上\n const newContext = context.nativeContext;\n const newCanvas = context.canvas.nativeCanvas;\n lastNativeContext.save();\n lastNativeContext.setTransform(context.dpr, 0, 0, context.dpr, 0, 0, true);\n // 如果drawMode === 1,则需要清一下之前的背景,否则背景就重复绘制了一次\n if (drawMode === 1) {\n newContext.rect(x, y, width, height);\n }\n lastNativeContext.drawImage(\n newCanvas,\n 0,\n 0,\n newCanvas.width,\n newCanvas.height,\n 0,\n 0,\n context.canvas.displayWidth,\n context.canvas.displayHeight\n );\n const transform = newContext.getTransform();\n lastNativeContext.setTransform(transform.a, transform.b, transform.c, transform.d, transform.e, transform.f);\n context.nativeContext = lastNativeContext;\n context.canvas.nativeCanvas = lastNativeCanvas;\n lastNativeContext.restore();\n }\n\n if (p && p.then) {\n p.then(() => {\n if (clip) {\n context.restore();\n } else {\n context.highPerformanceRestore();\n }\n });\n } else {\n if (clip) {\n context.restore();\n } else {\n context.highPerformanceRestore();\n }\n }\n }\n}\n"]}
@@ -25,7 +25,7 @@ let DefaultCanvasLineRender = class extends base_render_1.BaseRender {
25
25
  if (!cache) return;
26
26
  context.beginPath();
27
27
  const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
28
- (0, render_curve_1.drawSegments)(context, cache, clipRange, clipRangeByDimension, {
28
+ (0, render_curve_1.drawSegments)(context.camera ? context : context.nativeContext, cache, clipRange, clipRangeByDimension, {
29
29
  offsetX: offsetX,
30
30
  offsetY: offsetY,
31
31
  offsetZ: z