@visactor/vrender-core 0.18.0-alpha.0 → 0.18.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (361) hide show
  1. package/cjs/common/canvas-utils.js +2 -2
  2. package/cjs/common/canvas-utils.js.map +1 -1
  3. package/cjs/common/color-utils.d.ts +9 -0
  4. package/cjs/common/color-utils.js +231 -0
  5. package/cjs/common/color-utils.js.map +1 -0
  6. package/cjs/common/rect-utils.d.ts +7 -0
  7. package/cjs/common/rect-utils.js +27 -0
  8. package/cjs/common/rect-utils.js.map +1 -0
  9. package/cjs/common/render-area.js +3 -15
  10. package/cjs/common/render-area.js.map +1 -1
  11. package/cjs/common/render-curve.js +4 -16
  12. package/cjs/common/render-curve.js.map +1 -1
  13. package/cjs/common/render-utils.d.ts +10 -0
  14. package/cjs/common/render-utils.js +22 -0
  15. package/cjs/common/render-utils.js.map +1 -0
  16. package/cjs/common/segment/basis.js +2 -3
  17. package/cjs/common/segment/basis.js.map +1 -1
  18. package/cjs/common/segment/common.d.ts +4 -1
  19. package/cjs/common/segment/common.js +13 -3
  20. package/cjs/common/segment/common.js.map +1 -1
  21. package/cjs/common/segment/linear-closed.d.ts +2 -16
  22. package/cjs/common/segment/linear-closed.js +3 -34
  23. package/cjs/common/segment/linear-closed.js.map +1 -1
  24. package/cjs/common/segment/linear.d.ts +1 -1
  25. package/cjs/common/segment/linear.js +2 -3
  26. package/cjs/common/segment/linear.js.map +1 -1
  27. package/cjs/common/segment/monotone.d.ts +2 -2
  28. package/cjs/common/segment/monotone.js +10 -12
  29. package/cjs/common/segment/monotone.js.map +1 -1
  30. package/cjs/common/sort.js +2 -1
  31. package/cjs/common/split-path.js +2 -2
  32. package/cjs/common/split-path.js.map +1 -1
  33. package/cjs/core/application.js +1 -1
  34. package/cjs/core/camera.js +1 -1
  35. package/cjs/core/constants.js +1 -1
  36. package/cjs/core/stage.d.ts +2 -1
  37. package/cjs/core/stage.js +12 -5
  38. package/cjs/core/stage.js.map +1 -1
  39. package/cjs/env-check.js +17 -17
  40. package/cjs/env-check.js.map +1 -1
  41. package/cjs/event/event-system.js +3 -3
  42. package/cjs/event/event-system.js.map +1 -1
  43. package/cjs/graphic/arc.js +1 -1
  44. package/cjs/graphic/arc.js.map +1 -1
  45. package/cjs/graphic/arc3d.js +1 -1
  46. package/cjs/graphic/arc3d.js.map +1 -1
  47. package/cjs/graphic/area.js +1 -1
  48. package/cjs/graphic/area.js.map +1 -1
  49. package/cjs/graphic/bounds.d.ts +2 -2
  50. package/cjs/graphic/bounds.js +1 -1
  51. package/cjs/graphic/bounds.js.map +1 -1
  52. package/cjs/graphic/circle.js +1 -1
  53. package/cjs/graphic/circle.js.map +1 -1
  54. package/cjs/graphic/config.js +5 -1
  55. package/cjs/graphic/config.js.map +1 -1
  56. package/cjs/graphic/glyph.js +1 -1
  57. package/cjs/graphic/glyph.js.map +1 -1
  58. package/cjs/graphic/graphic-service/graphic-service.js +13 -11
  59. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  60. package/cjs/graphic/graphic.d.ts +1 -0
  61. package/cjs/graphic/graphic.js +8 -6
  62. package/cjs/graphic/graphic.js.map +1 -1
  63. package/cjs/graphic/group.d.ts +1 -1
  64. package/cjs/graphic/group.js +3 -3
  65. package/cjs/graphic/group.js.map +1 -1
  66. package/cjs/graphic/image.d.ts +3 -1
  67. package/cjs/graphic/image.js +7 -1
  68. package/cjs/graphic/image.js.map +1 -1
  69. package/cjs/graphic/line.js +1 -1
  70. package/cjs/graphic/line.js.map +1 -1
  71. package/cjs/graphic/node-tree.d.ts +1 -1
  72. package/cjs/graphic/node-tree.js +6 -2
  73. package/cjs/graphic/node-tree.js.map +1 -1
  74. package/cjs/graphic/path.js +1 -1
  75. package/cjs/graphic/path.js.map +1 -1
  76. package/cjs/graphic/polygon.js +1 -1
  77. package/cjs/graphic/polygon.js.map +1 -1
  78. package/cjs/graphic/pyramid3d.js +1 -1
  79. package/cjs/graphic/pyramid3d.js.map +1 -1
  80. package/cjs/graphic/rect.js +4 -7
  81. package/cjs/graphic/rect.js.map +1 -1
  82. package/cjs/graphic/richtext/frame.d.ts +2 -2
  83. package/cjs/graphic/richtext/frame.js +1 -12
  84. package/cjs/graphic/richtext/frame.js.map +1 -1
  85. package/cjs/graphic/richtext/line.js +1 -12
  86. package/cjs/graphic/richtext/line.js.map +1 -1
  87. package/cjs/graphic/richtext/paragraph.js +2 -2
  88. package/cjs/graphic/richtext/paragraph.js.map +1 -1
  89. package/cjs/graphic/richtext.d.ts +45 -2
  90. package/cjs/graphic/richtext.js +22 -7
  91. package/cjs/graphic/richtext.js.map +1 -1
  92. package/cjs/graphic/symbol.js +1 -1
  93. package/cjs/graphic/symbol.js.map +1 -1
  94. package/cjs/graphic/text.js +4 -4
  95. package/cjs/graphic/text.js.map +1 -1
  96. package/cjs/graphic/theme.js +1 -1
  97. package/cjs/graphic/theme.js.map +1 -1
  98. package/cjs/interface/event.d.ts +2 -0
  99. package/cjs/interface/event.js.map +1 -1
  100. package/cjs/interface/graphic/richText.d.ts +2 -2
  101. package/cjs/interface/graphic/richText.js.map +1 -1
  102. package/cjs/interface/graphic/symbol.d.ts +1 -1
  103. package/cjs/interface/graphic/symbol.js.map +1 -1
  104. package/cjs/interface/graphic.d.ts +17 -3
  105. package/cjs/interface/graphic.js.map +1 -1
  106. package/cjs/interface/node-tree.d.ts +1 -1
  107. package/cjs/interface/node-tree.js.map +1 -1
  108. package/cjs/interface/picker.d.ts +1 -0
  109. package/cjs/interface/picker.js.map +1 -1
  110. package/cjs/interface/render.d.ts +1 -0
  111. package/cjs/interface/render.js.map +1 -1
  112. package/cjs/interface/stage.d.ts +7 -1
  113. package/cjs/interface/stage.js.map +1 -1
  114. package/cjs/modules.d.ts +3 -0
  115. package/cjs/modules.js +9 -10
  116. package/cjs/modules.js.map +1 -1
  117. package/cjs/picker/picker-service.js +8 -3
  118. package/cjs/picker/picker-service.js.map +1 -1
  119. package/cjs/plugins/builtin-plugin/flex-layout-plugin.d.ts +14 -3
  120. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +126 -65
  121. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  122. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +28 -25
  123. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  124. package/cjs/render/contributions/render/area-render.js +9 -7
  125. package/cjs/render/contributions/render/area-render.js.map +1 -1
  126. package/cjs/render/contributions/render/contributions/arc-contribution-render.d.ts +1 -1
  127. package/cjs/render/contributions/render/contributions/arc-contribution-render.js +2 -2
  128. package/cjs/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
  129. package/cjs/render/contributions/render/contributions/area-contribution-render.d.ts +1 -9
  130. package/cjs/render/contributions/render/contributions/area-contribution-render.js +3 -55
  131. package/cjs/render/contributions/render/contributions/area-contribution-render.js.map +1 -1
  132. package/cjs/render/contributions/render/contributions/area-texture-contribution-render.d.ts +9 -0
  133. package/cjs/render/contributions/render/contributions/area-texture-contribution-render.js +26 -0
  134. package/cjs/render/contributions/render/contributions/area-texture-contribution-render.js.map +1 -0
  135. package/cjs/render/contributions/render/contributions/base-contribution-render.d.ts +2 -20
  136. package/cjs/render/contributions/render/contributions/base-contribution-render.js +25 -125
  137. package/cjs/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  138. package/cjs/render/contributions/render/contributions/base-texture-contribution-render.d.ts +21 -0
  139. package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js +128 -0
  140. package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js.map +1 -0
  141. package/cjs/render/contributions/render/contributions/circle-contribution-render.d.ts +1 -1
  142. package/cjs/render/contributions/render/contributions/circle-contribution-render.js +2 -2
  143. package/cjs/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
  144. package/cjs/render/contributions/render/contributions/group-contribution-render.js +2 -2
  145. package/cjs/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
  146. package/cjs/render/contributions/render/contributions/image-contribution-render.js +3 -2
  147. package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
  148. package/cjs/render/contributions/render/contributions/index.d.ts +2 -0
  149. package/cjs/render/contributions/render/contributions/index.js +2 -1
  150. package/cjs/render/contributions/render/contributions/index.js.map +1 -1
  151. package/cjs/render/contributions/render/contributions/path-contribution-render.d.ts +1 -1
  152. package/cjs/render/contributions/render/contributions/path-contribution-render.js +2 -2
  153. package/cjs/render/contributions/render/contributions/path-contribution-render.js.map +1 -1
  154. package/cjs/render/contributions/render/contributions/polygon-contribution-render.d.ts +1 -1
  155. package/cjs/render/contributions/render/contributions/polygon-contribution-render.js +2 -2
  156. package/cjs/render/contributions/render/contributions/polygon-contribution-render.js.map +1 -1
  157. package/cjs/render/contributions/render/contributions/rect-contribution-render.d.ts +1 -1
  158. package/cjs/render/contributions/render/contributions/rect-contribution-render.js +2 -2
  159. package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  160. package/cjs/render/contributions/render/contributions/symbol-contribution-render.d.ts +1 -1
  161. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js +2 -2
  162. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  163. package/cjs/render/contributions/render/contributions/text-contribution-render.js +23 -8
  164. package/cjs/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
  165. package/cjs/render/contributions/render/draw-contribution.js +11 -5
  166. package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
  167. package/cjs/render/contributions/render/image-render.js +4 -2
  168. package/cjs/render/contributions/render/image-render.js.map +1 -1
  169. package/cjs/render/contributions/render/incremental-draw-contribution.d.ts +0 -1
  170. package/cjs/render/contributions/render/incremental-draw-contribution.js +19 -15
  171. package/cjs/render/contributions/render/incremental-draw-contribution.js.map +1 -1
  172. package/cjs/render/contributions/render/index.d.ts +1 -0
  173. package/cjs/render/contributions/render/index.js +2 -1
  174. package/cjs/render/contributions/render/index.js.map +1 -1
  175. package/cjs/render/contributions/render/utils.d.ts +1 -1
  176. package/cjs/render/contributions/render/utils.js.map +1 -1
  177. package/cjs/resource-loader/loader.d.ts +5 -0
  178. package/cjs/resource-loader/loader.js +56 -15
  179. package/cjs/resource-loader/loader.js.map +1 -1
  180. package/es/common/canvas-utils.js +3 -1
  181. package/es/common/canvas-utils.js.map +1 -1
  182. package/es/common/color-utils.d.ts +9 -0
  183. package/es/common/color-utils.js +224 -0
  184. package/es/common/color-utils.js.map +1 -0
  185. package/es/common/rect-utils.d.ts +7 -0
  186. package/es/common/rect-utils.js +20 -0
  187. package/es/common/rect-utils.js.map +1 -0
  188. package/es/common/render-area.js +2 -12
  189. package/es/common/render-area.js.map +1 -1
  190. package/es/common/render-curve.js +2 -15
  191. package/es/common/render-curve.js.map +1 -1
  192. package/es/common/render-utils.d.ts +10 -0
  193. package/es/common/render-utils.js +14 -0
  194. package/es/common/render-utils.js.map +1 -0
  195. package/es/common/segment/basis.js +2 -8
  196. package/es/common/segment/basis.js.map +1 -1
  197. package/es/common/segment/common.d.ts +4 -1
  198. package/es/common/segment/common.js +11 -0
  199. package/es/common/segment/common.js.map +1 -1
  200. package/es/common/segment/linear-closed.d.ts +2 -16
  201. package/es/common/segment/linear-closed.js +4 -38
  202. package/es/common/segment/linear-closed.js.map +1 -1
  203. package/es/common/segment/linear.d.ts +1 -1
  204. package/es/common/segment/linear.js +2 -8
  205. package/es/common/segment/linear.js.map +1 -1
  206. package/es/common/segment/monotone.d.ts +2 -2
  207. package/es/common/segment/monotone.js +7 -13
  208. package/es/common/segment/monotone.js.map +1 -1
  209. package/es/common/sort.js +2 -1
  210. package/es/common/split-path.js +3 -1
  211. package/es/common/split-path.js.map +1 -1
  212. package/es/core/application.js +1 -1
  213. package/es/core/camera.js +1 -1
  214. package/es/core/constants.js +1 -1
  215. package/es/core/stage.d.ts +2 -1
  216. package/es/core/stage.js +12 -5
  217. package/es/core/stage.js.map +1 -1
  218. package/es/env-check.js +12 -13
  219. package/es/env-check.js.map +1 -1
  220. package/es/event/event-system.js +3 -3
  221. package/es/event/event-system.js.map +1 -1
  222. package/es/graphic/arc.js +1 -1
  223. package/es/graphic/arc.js.map +1 -1
  224. package/es/graphic/arc3d.js +1 -1
  225. package/es/graphic/arc3d.js.map +1 -1
  226. package/es/graphic/area.js +1 -1
  227. package/es/graphic/area.js.map +1 -1
  228. package/es/graphic/bounds.d.ts +2 -2
  229. package/es/graphic/bounds.js +1 -1
  230. package/es/graphic/bounds.js.map +1 -1
  231. package/es/graphic/circle.js +1 -1
  232. package/es/graphic/circle.js.map +1 -1
  233. package/es/graphic/config.js +5 -1
  234. package/es/graphic/config.js.map +1 -1
  235. package/es/graphic/glyph.js +1 -1
  236. package/es/graphic/glyph.js.map +1 -1
  237. package/es/graphic/graphic-service/graphic-service.js +13 -11
  238. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  239. package/es/graphic/graphic.d.ts +1 -0
  240. package/es/graphic/graphic.js +9 -7
  241. package/es/graphic/graphic.js.map +1 -1
  242. package/es/graphic/group.d.ts +1 -1
  243. package/es/graphic/group.js +3 -3
  244. package/es/graphic/group.js.map +1 -1
  245. package/es/graphic/image.d.ts +3 -1
  246. package/es/graphic/image.js +7 -1
  247. package/es/graphic/image.js.map +1 -1
  248. package/es/graphic/line.js +1 -1
  249. package/es/graphic/line.js.map +1 -1
  250. package/es/graphic/node-tree.d.ts +1 -1
  251. package/es/graphic/node-tree.js +6 -2
  252. package/es/graphic/node-tree.js.map +1 -1
  253. package/es/graphic/path.js +1 -1
  254. package/es/graphic/path.js.map +1 -1
  255. package/es/graphic/polygon.js +1 -1
  256. package/es/graphic/polygon.js.map +1 -1
  257. package/es/graphic/pyramid3d.js +1 -1
  258. package/es/graphic/pyramid3d.js.map +1 -1
  259. package/es/graphic/rect.js +4 -7
  260. package/es/graphic/rect.js.map +1 -1
  261. package/es/graphic/richtext/frame.d.ts +2 -2
  262. package/es/graphic/richtext/frame.js +1 -12
  263. package/es/graphic/richtext/frame.js.map +1 -1
  264. package/es/graphic/richtext/line.js +1 -12
  265. package/es/graphic/richtext/line.js.map +1 -1
  266. package/es/graphic/richtext/paragraph.js +2 -2
  267. package/es/graphic/richtext/paragraph.js.map +1 -1
  268. package/es/graphic/richtext.d.ts +45 -2
  269. package/es/graphic/richtext.js +23 -6
  270. package/es/graphic/richtext.js.map +1 -1
  271. package/es/graphic/symbol.js +1 -1
  272. package/es/graphic/symbol.js.map +1 -1
  273. package/es/graphic/text.js +4 -4
  274. package/es/graphic/text.js.map +1 -1
  275. package/es/graphic/theme.js +1 -1
  276. package/es/graphic/theme.js.map +1 -1
  277. package/es/interface/event.d.ts +2 -0
  278. package/es/interface/event.js.map +1 -1
  279. package/es/interface/graphic/richText.d.ts +2 -2
  280. package/es/interface/graphic/richText.js.map +1 -1
  281. package/es/interface/graphic/symbol.d.ts +1 -1
  282. package/es/interface/graphic/symbol.js.map +1 -1
  283. package/es/interface/graphic.d.ts +17 -3
  284. package/es/interface/graphic.js.map +1 -1
  285. package/es/interface/node-tree.d.ts +1 -1
  286. package/es/interface/node-tree.js.map +1 -1
  287. package/es/interface/picker.d.ts +1 -0
  288. package/es/interface/picker.js.map +1 -1
  289. package/es/interface/render.d.ts +1 -0
  290. package/es/interface/render.js.map +1 -1
  291. package/es/interface/stage.d.ts +7 -1
  292. package/es/interface/stage.js.map +1 -1
  293. package/es/modules.d.ts +3 -0
  294. package/es/modules.js +4 -6
  295. package/es/modules.js.map +1 -1
  296. package/es/picker/picker-service.js +8 -3
  297. package/es/picker/picker-service.js.map +1 -1
  298. package/es/plugins/builtin-plugin/flex-layout-plugin.d.ts +14 -3
  299. package/es/plugins/builtin-plugin/flex-layout-plugin.js +126 -69
  300. package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  301. package/es/plugins/builtin-plugin/html-attribute-plugin.js +28 -25
  302. package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  303. package/es/render/contributions/render/area-render.js +9 -7
  304. package/es/render/contributions/render/area-render.js.map +1 -1
  305. package/es/render/contributions/render/contributions/arc-contribution-render.d.ts +1 -1
  306. package/es/render/contributions/render/contributions/arc-contribution-render.js +3 -1
  307. package/es/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
  308. package/es/render/contributions/render/contributions/area-contribution-render.d.ts +1 -9
  309. package/es/render/contributions/render/contributions/area-contribution-render.js +2 -51
  310. package/es/render/contributions/render/contributions/area-contribution-render.js.map +1 -1
  311. package/es/render/contributions/render/contributions/area-texture-contribution-render.d.ts +9 -0
  312. package/es/render/contributions/render/contributions/area-texture-contribution-render.js +18 -0
  313. package/es/render/contributions/render/contributions/area-texture-contribution-render.js.map +1 -0
  314. package/es/render/contributions/render/contributions/base-contribution-render.d.ts +2 -20
  315. package/es/render/contributions/render/contributions/base-contribution-render.js +23 -123
  316. package/es/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  317. package/es/render/contributions/render/contributions/base-texture-contribution-render.d.ts +21 -0
  318. package/es/render/contributions/render/contributions/base-texture-contribution-render.js +124 -0
  319. package/es/render/contributions/render/contributions/base-texture-contribution-render.js.map +1 -0
  320. package/es/render/contributions/render/contributions/circle-contribution-render.d.ts +1 -1
  321. package/es/render/contributions/render/contributions/circle-contribution-render.js +3 -1
  322. package/es/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
  323. package/es/render/contributions/render/contributions/group-contribution-render.js +2 -2
  324. package/es/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
  325. package/es/render/contributions/render/contributions/image-contribution-render.js +3 -2
  326. package/es/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
  327. package/es/render/contributions/render/contributions/index.d.ts +2 -0
  328. package/es/render/contributions/render/contributions/index.js +4 -0
  329. package/es/render/contributions/render/contributions/index.js.map +1 -1
  330. package/es/render/contributions/render/contributions/path-contribution-render.d.ts +1 -1
  331. package/es/render/contributions/render/contributions/path-contribution-render.js +3 -1
  332. package/es/render/contributions/render/contributions/path-contribution-render.js.map +1 -1
  333. package/es/render/contributions/render/contributions/polygon-contribution-render.d.ts +1 -1
  334. package/es/render/contributions/render/contributions/polygon-contribution-render.js +3 -1
  335. package/es/render/contributions/render/contributions/polygon-contribution-render.js.map +1 -1
  336. package/es/render/contributions/render/contributions/rect-contribution-render.d.ts +1 -1
  337. package/es/render/contributions/render/contributions/rect-contribution-render.js +3 -1
  338. package/es/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  339. package/es/render/contributions/render/contributions/symbol-contribution-render.d.ts +1 -1
  340. package/es/render/contributions/render/contributions/symbol-contribution-render.js +3 -1
  341. package/es/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  342. package/es/render/contributions/render/contributions/text-contribution-render.js +28 -7
  343. package/es/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
  344. package/es/render/contributions/render/draw-contribution.js +11 -5
  345. package/es/render/contributions/render/draw-contribution.js.map +1 -1
  346. package/es/render/contributions/render/image-render.js +6 -2
  347. package/es/render/contributions/render/image-render.js.map +1 -1
  348. package/es/render/contributions/render/incremental-draw-contribution.d.ts +0 -1
  349. package/es/render/contributions/render/incremental-draw-contribution.js +19 -15
  350. package/es/render/contributions/render/incremental-draw-contribution.js.map +1 -1
  351. package/es/render/contributions/render/index.d.ts +1 -0
  352. package/es/render/contributions/render/index.js +2 -0
  353. package/es/render/contributions/render/index.js.map +1 -1
  354. package/es/render/contributions/render/utils.d.ts +1 -1
  355. package/es/render/contributions/render/utils.js.map +1 -1
  356. package/es/resource-loader/loader.d.ts +5 -0
  357. package/es/resource-loader/loader.js +56 -14
  358. package/es/resource-loader/loader.js.map +1 -1
  359. package/package.json +6 -4
  360. package/dist/index.js +0 -27707
  361. package/dist/index.min.js +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/contributions/image-contribution-render.ts"],"names":[],"mappings":";;;AAWA,iDAA+C;AAC/C,yEAAqF;AACrF,oDAAsE;AACtE,6CAAsD;AACtD,oDAAwD;AACxD,wDAA+D;AAE/D,MAA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AC;QAC7C,MAAM,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;KAC/C;IAED,OAAO;QACL,CAAC;QACD,CAAC;QACD,KAAK;QACL,MAAM;KACP,CAAC;AACJ,CAAC;AAEY,QAAA,wCAAwC,GAAG,IAAI,wCAAwC,EAAE,CAAC","file":"image-contribution-render.js","sourcesContent":["import { injectable } from '../../../../common/inversify-lite';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IImage,\n IThemeAttribute,\n IImageRenderContribution,\n IDrawContext,\n IBackgroundConfig,\n IGraphic\n} from '../../../../interface';\nimport { getTheme } from '../../../../graphic';\nimport { DefaultBaseBackgroundRenderContribution } from './base-contribution-render';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\nimport { isNumber, isObject } from '@visactor/vutils';\nimport { parsePadding } from '../../../../common/utils';\nimport { createRectPath } from '../../../../common/shape/rect';\n\nexport class DefaultImageBackgroundRenderContribution\n extends DefaultBaseBackgroundRenderContribution\n implements IImageRenderContribution\n{\n time: BaseRenderContributionTime = BaseRenderContributionTime.beforeFillStroke;\n\n drawShape(\n graphic: IImage,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean\n ) {\n const { background, backgroundMode = graphicAttribute.backgroundMode } = graphic.attribute;\n if (!background) {\n return;\n }\n\n if (!graphic.backgroundImg) {\n if (isObject(background)) {\n const {\n stroke,\n fill,\n lineWidth = 1,\n cornerRadius = 0,\n expandX = 0,\n expandY = 0\n } = background as IBackgroundConfig;\n\n if (!stroke && !fill) {\n return;\n }\n\n context.beginPath();\n const { x, y, width, height } = getActualPosition(graphic);\n if (cornerRadius) {\n createRectPath(context, x - expandX, y - expandY, width + expandX * 2, height + expandY * 2, cornerRadius);\n } else {\n context.rect(x - expandX, y - expandY, width + expandX * 2, height + expandY * 2);\n }\n\n context.globalAlpha = 1;\n if (fill) {\n context.fillStyle = fill as string;\n context.fill();\n }\n\n if (stroke && lineWidth > 0) {\n context.lineWidth = lineWidth;\n context.strokeStyle = stroke as string;\n context.stroke();\n }\n } else {\n context.beginPath();\n const b = graphic.AABBBounds;\n context.rect(x, y, b.width(), b.height());\n context.fillStyle = background as string;\n context.globalAlpha = 1;\n context.fill();\n }\n } else {\n const res = graphic.resources.get(background);\n if (res.state !== 'success' || !res.data) {\n return;\n }\n context.save();\n if (graphic.parent && !graphic.transMatrix.onlyTranslate()) {\n const groupAttribute = getTheme(graphic.parent).group;\n const { scrollX = groupAttribute.scrollX, scrollY = groupAttribute.scrollY } = graphic.parent.attribute;\n context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);\n context.translate(scrollX, scrollY);\n }\n // context.clip();\n const b = graphic.AABBBounds;\n this.doDrawImage(context, res.data, b, backgroundMode);\n context.restore();\n if (!graphic.transMatrix.onlyTranslate()) {\n context.setTransformForCurrent();\n }\n }\n }\n}\n\nfunction getActualPosition(graphic: IGraphic) {\n const boundsPadding = parsePadding(graphic.attribute.boundsPadding);\n const bounds = graphic.AABBBounds;\n let x = bounds.x1;\n let y = bounds.y1;\n let width = bounds.width();\n let height = bounds.height();\n\n if (isNumber(boundsPadding)) {\n x += boundsPadding;\n y += boundsPadding;\n width -= boundsPadding * 2;\n height -= boundsPadding * 2;\n } else {\n x += boundsPadding[3];\n y += boundsPadding[0];\n width -= boundsPadding[1] + boundsPadding[3];\n height -= boundsPadding[0] + boundsPadding[2];\n }\n\n return {\n x,\n y,\n width,\n height\n };\n}\n\nexport const defaultImageBackgroundRenderContribution = new DefaultImageBackgroundRenderContribution();\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/contributions/image-contribution-render.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ACL,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;QACtB,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;QACtB,KAAK,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;QAC7C,MAAM,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;KAC/C;IAED,OAAO;QACL,CAAC;QACD,CAAC;QACD,KAAK;QACL,MAAM;KACP,CAAC;AACJ,CAAC;AAEY,QAAA,wCAAwC,GAAG,IAAI,wCAAwC,EAAE,CAAC","file":"image-contribution-render.js","sourcesContent":["import type {\n IGraphicAttribute,\n IContext2d,\n IImage,\n IThemeAttribute,\n IImageRenderContribution,\n IDrawContext,\n IBackgroundConfig,\n IGraphic\n} from '../../../../interface';\nimport { getTheme } from '../../../../graphic';\nimport { DefaultBaseBackgroundRenderContribution } from './base-contribution-render';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\nimport { isNumber, isObject } from '@visactor/vutils';\nimport { parsePadding } from '../../../../common/utils';\nimport { createRectPath } from '../../../../common/shape/rect';\n\nexport class DefaultImageBackgroundRenderContribution\n extends DefaultBaseBackgroundRenderContribution\n implements IImageRenderContribution\n{\n time: BaseRenderContributionTime = BaseRenderContributionTime.beforeFillStroke;\n\n drawShape(\n graphic: IImage,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean\n ) {\n const {\n background,\n backgroundMode = graphicAttribute.backgroundMode,\n backgroundFit = graphicAttribute.backgroundFit\n } = graphic.attribute;\n if (!background) {\n return;\n }\n\n if (!graphic.backgroundImg) {\n if (isObject(background)) {\n const {\n stroke,\n fill,\n lineWidth = 1,\n cornerRadius = 0,\n expandX = 0,\n expandY = 0\n } = background as IBackgroundConfig;\n\n if (!stroke && !fill) {\n return;\n }\n\n context.beginPath();\n const { x, y, width, height } = getActualPosition(graphic);\n if (cornerRadius) {\n createRectPath(context, x - expandX, y - expandY, width + expandX * 2, height + expandY * 2, cornerRadius);\n } else {\n context.rect(x - expandX, y - expandY, width + expandX * 2, height + expandY * 2);\n }\n\n context.globalAlpha = 1;\n if (fill) {\n context.fillStyle = fill as string;\n context.fill();\n }\n\n if (stroke && lineWidth > 0) {\n context.lineWidth = lineWidth;\n context.strokeStyle = stroke as string;\n context.stroke();\n }\n } else {\n context.beginPath();\n const b = graphic.AABBBounds;\n context.rect(x, y, b.width(), b.height());\n context.fillStyle = background as string;\n context.globalAlpha = 1;\n context.fill();\n }\n } else {\n const res = graphic.resources.get(background as any);\n if (res.state !== 'success' || !res.data) {\n return;\n }\n context.save();\n if (graphic.parent && !graphic.transMatrix.onlyTranslate()) {\n const groupAttribute = getTheme(graphic.parent).group;\n const { scrollX = groupAttribute.scrollX, scrollY = groupAttribute.scrollY } = graphic.parent.attribute;\n context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);\n context.translate(scrollX, scrollY);\n }\n // context.clip();\n const b = graphic.AABBBounds;\n this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit);\n context.restore();\n if (!graphic.transMatrix.onlyTranslate()) {\n context.setTransformForCurrent();\n }\n }\n }\n}\n\nfunction getActualPosition(graphic: IGraphic) {\n const boundsPadding = parsePadding(graphic.attribute.boundsPadding);\n const bounds = graphic.AABBBounds;\n let x = bounds.x1;\n let y = bounds.y1;\n let width = bounds.width();\n let height = bounds.height();\n\n if (isNumber(boundsPadding)) {\n x += boundsPadding;\n y += boundsPadding;\n width -= boundsPadding * 2;\n height -= boundsPadding * 2;\n } else {\n x += boundsPadding[3];\n y += boundsPadding[0];\n width -= boundsPadding[1] + boundsPadding[3];\n height -= boundsPadding[0] + boundsPadding[2];\n }\n\n return {\n x,\n y,\n width,\n height\n };\n}\n\nexport const defaultImageBackgroundRenderContribution = new DefaultImageBackgroundRenderContribution();\n"]}
@@ -5,3 +5,5 @@ export * from './group-contribution-render';
5
5
  export * from './image-contribution-render';
6
6
  export * from './rect-contribution-render';
7
7
  export * from './symbol-contribution-render';
8
+ export * from './base-texture-contribution-render';
9
+ export * from './area-texture-contribution-render';
@@ -20,5 +20,6 @@ Object.defineProperty(exports, "__esModule", {
20
20
  }), __exportStar(require("./arc-contribution-render"), exports), __exportStar(require("./base-contribution-render"), exports),
21
21
  __exportStar(require("./circle-contribution-render"), exports), __exportStar(require("./group-contribution-render"), exports),
22
22
  __exportStar(require("./image-contribution-render"), exports), __exportStar(require("./rect-contribution-render"), exports),
23
- __exportStar(require("./symbol-contribution-render"), exports);
23
+ __exportStar(require("./symbol-contribution-render"), exports), __exportStar(require("./base-texture-contribution-render"), exports),
24
+ __exportStar(require("./area-texture-contribution-render"), exports);
24
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/contributions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,6DAA2C;AAC3C,+DAA6C;AAC7C,8DAA4C;AAC5C,8DAA4C;AAC5C,6DAA2C;AAC3C,+DAA6C","file":"index.js","sourcesContent":["export * from './arc-contribution-render';\nexport * from './base-contribution-render';\nexport * from './circle-contribution-render';\nexport * from './group-contribution-render';\nexport * from './image-contribution-render';\nexport * from './rect-contribution-render';\nexport * from './symbol-contribution-render';\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/contributions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,6DAA2C;AAC3C,+DAA6C;AAC7C,8DAA4C;AAC5C,8DAA4C;AAC5C,6DAA2C;AAC3C,+DAA6C;AAE7C,qEAAmD;AACnD,qEAAmD","file":"index.js","sourcesContent":["export * from './arc-contribution-render';\nexport * from './base-contribution-render';\nexport * from './circle-contribution-render';\nexport * from './group-contribution-render';\nexport * from './image-contribution-render';\nexport * from './rect-contribution-render';\nexport * from './symbol-contribution-render';\n\nexport * from './base-texture-contribution-render';\nexport * from './area-texture-contribution-render';\n"]}
@@ -1,2 +1,2 @@
1
- export declare const defaultPathTextureRenderContribution: import("./base-contribution-render").DefaultBaseTextureRenderContribution;
1
+ export declare const defaultPathTextureRenderContribution: import("./base-texture-contribution-render").DefaultBaseTextureRenderContribution;
2
2
  export declare const defaultPathBackgroundRenderContribution: import("./base-contribution-render").DefaultBaseBackgroundRenderContribution;
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.defaultPathBackgroundRenderContribution = exports.defaultPathTextureRenderContribution = void 0;
6
6
 
7
- const base_contribution_render_1 = require("./base-contribution-render");
7
+ const base_contribution_render_1 = require("./base-contribution-render"), base_texture_contribution_render_1 = require("./base-texture-contribution-render");
8
8
 
9
- exports.defaultPathTextureRenderContribution = base_contribution_render_1.defaultBaseTextureRenderContribution,
9
+ exports.defaultPathTextureRenderContribution = base_texture_contribution_render_1.defaultBaseTextureRenderContribution,
10
10
  exports.defaultPathBackgroundRenderContribution = base_contribution_render_1.defaultBaseBackgroundRenderContribution;
11
11
  //# sourceMappingURL=path-contribution-render.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/contributions/path-contribution-render.ts"],"names":[],"mappings":";;;AAAA,yEAGoC;AAEvB,QAAA,oCAAoC,GAAG,+DAAoC,CAAC;AAC5E,QAAA,uCAAuC,GAAG,kEAAuC,CAAC","file":"path-contribution-render.js","sourcesContent":["import {\n defaultBaseBackgroundRenderContribution,\n defaultBaseTextureRenderContribution\n} from './base-contribution-render';\n\nexport const defaultPathTextureRenderContribution = defaultBaseTextureRenderContribution;\nexport const defaultPathBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/contributions/path-contribution-render.ts"],"names":[],"mappings":";;;AAAA,yEAAqF;AACrF,yFAA0F;AAE7E,QAAA,oCAAoC,GAAG,uEAAoC,CAAC;AAC5E,QAAA,uCAAuC,GAAG,kEAAuC,CAAC","file":"path-contribution-render.js","sourcesContent":["import { defaultBaseBackgroundRenderContribution } from './base-contribution-render';\nimport { defaultBaseTextureRenderContribution } from './base-texture-contribution-render';\n\nexport const defaultPathTextureRenderContribution = defaultBaseTextureRenderContribution;\nexport const defaultPathBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;\n"]}
@@ -1,2 +1,2 @@
1
- export declare const defaultPolygonTextureRenderContribution: import("./base-contribution-render").DefaultBaseTextureRenderContribution;
1
+ export declare const defaultPolygonTextureRenderContribution: import("./base-texture-contribution-render").DefaultBaseTextureRenderContribution;
2
2
  export declare const defaultPolygonBackgroundRenderContribution: import("./base-contribution-render").DefaultBaseBackgroundRenderContribution;
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.defaultPolygonBackgroundRenderContribution = exports.defaultPolygonTextureRenderContribution = void 0;
6
6
 
7
- const base_contribution_render_1 = require("./base-contribution-render");
7
+ const base_contribution_render_1 = require("./base-contribution-render"), base_texture_contribution_render_1 = require("./base-texture-contribution-render");
8
8
 
9
- exports.defaultPolygonTextureRenderContribution = base_contribution_render_1.defaultBaseTextureRenderContribution,
9
+ exports.defaultPolygonTextureRenderContribution = base_texture_contribution_render_1.defaultBaseTextureRenderContribution,
10
10
  exports.defaultPolygonBackgroundRenderContribution = base_contribution_render_1.defaultBaseBackgroundRenderContribution;
11
11
  //# sourceMappingURL=polygon-contribution-render.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/contributions/polygon-contribution-render.ts"],"names":[],"mappings":";;;AAAA,yEAGoC;AAEvB,QAAA,uCAAuC,GAAG,+DAAoC,CAAC;AAC/E,QAAA,0CAA0C,GAAG,kEAAuC,CAAC","file":"polygon-contribution-render.js","sourcesContent":["import {\n defaultBaseBackgroundRenderContribution,\n defaultBaseTextureRenderContribution\n} from './base-contribution-render';\n\nexport const defaultPolygonTextureRenderContribution = defaultBaseTextureRenderContribution;\nexport const defaultPolygonBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/contributions/polygon-contribution-render.ts"],"names":[],"mappings":";;;AAAA,yEAAqF;AACrF,yFAA0F;AAE7E,QAAA,uCAAuC,GAAG,uEAAoC,CAAC;AAC/E,QAAA,0CAA0C,GAAG,kEAAuC,CAAC","file":"polygon-contribution-render.js","sourcesContent":["import { defaultBaseBackgroundRenderContribution } from './base-contribution-render';\nimport { defaultBaseTextureRenderContribution } from './base-texture-contribution-render';\n\nexport const defaultPolygonTextureRenderContribution = defaultBaseTextureRenderContribution;\nexport const defaultPolygonBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;\n"]}
@@ -22,5 +22,5 @@ export declare class SplitRectAfterRenderContribution implements IRectRenderCont
22
22
  drawShape(rect: IRect, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, groupAttribute: Required<IRectGraphicAttribute>, drawContext: IDrawContext, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
23
23
  }
24
24
  export declare const defaultRectRenderContribution: DefaultRectRenderContribution;
25
- export declare const defaultRectTextureRenderContribution: import("./base-contribution-render").DefaultBaseTextureRenderContribution;
25
+ export declare const defaultRectTextureRenderContribution: import("./base-texture-contribution-render").DefaultBaseTextureRenderContribution;
26
26
  export declare const defaultRectBackgroundRenderContribution: import("./base-contribution-render").DefaultBaseBackgroundRenderContribution;
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", {
10
10
  value: !0
11
11
  }), exports.defaultRectBackgroundRenderContribution = exports.defaultRectTextureRenderContribution = exports.defaultRectRenderContribution = exports.SplitRectAfterRenderContribution = exports.SplitRectBeforeRenderContribution = exports.DefaultRectRenderContribution = void 0;
12
12
 
13
- const vutils_1 = require("@visactor/vutils"), inversify_lite_1 = require("../../../../common/inversify-lite"), canvas_utils_1 = require("../../../../common/canvas-utils"), base_contribution_render_1 = require("./base-contribution-render"), rect_1 = require("../../../../common/shape/rect"), enums_1 = require("../../../../common/enums");
13
+ const vutils_1 = require("@visactor/vutils"), inversify_lite_1 = require("../../../../common/inversify-lite"), canvas_utils_1 = require("../../../../common/canvas-utils"), base_contribution_render_1 = require("./base-contribution-render"), rect_1 = require("../../../../common/shape/rect"), enums_1 = require("../../../../common/enums"), base_texture_contribution_render_1 = require("./base-texture-contribution-render");
14
14
 
15
15
  class DefaultRectRenderContribution {
16
16
  constructor() {
@@ -91,6 +91,6 @@ let SplitRectAfterRenderContribution = class {
91
91
 
92
92
  SplitRectAfterRenderContribution = __decorate([ (0, inversify_lite_1.injectable)() ], SplitRectAfterRenderContribution),
93
93
  exports.SplitRectAfterRenderContribution = SplitRectAfterRenderContribution, exports.defaultRectRenderContribution = new DefaultRectRenderContribution,
94
- exports.defaultRectTextureRenderContribution = base_contribution_render_1.defaultBaseTextureRenderContribution,
94
+ exports.defaultRectTextureRenderContribution = base_texture_contribution_render_1.defaultBaseTextureRenderContribution,
95
95
  exports.defaultRectBackgroundRenderContribution = base_contribution_render_1.defaultBaseBackgroundRenderContribution;
96
96
  //# sourceMappingURL=rect-contribution-render.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/contributions/rect-contribution-render.ts"],"names":[],"mappings":";;;;;;;;;AAAA,6CAA2C;AAC3C,sEAA+D;AAW/D,kEAAkE;AAClE,yEAGoC;AACpC,wDAA+D;AAC/D,oDAAsE;AAEtE,MAAa,6BAA6B;IAA1C;QACE,SAAI,GAA+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I,MAAM,CAAC,CAAC,CAAC,EAAE;YACb,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC;SACvC;aAAM;YACL,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC;SACvC;QAED,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;YACb,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC;SAC/B;aAAM;YACL,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC;SAC/B;QAED,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;YAEb,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1D,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;SAC5B;aAAM;YACL,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACtB;QAED,OAAO,CAAC,MAAM,EAAE,CAAC;IACnB,CAAC;CACF,CAAA;AAtEY,gCAAgC;IAD5C,IAAA,2BAAU,GAAE;GACA,gCAAgC,CAsE5C;AAtEY,4EAAgC;AAwEhC,QAAA,6BAA6B,GAAG,IAAI,6BAA6B,EAAE,CAAC;AAGpE,QAAA,oCAAoC,GAAG,+DAAoC,CAAC;AAC5E,QAAA,uCAAuC,GAAG,kEAAuC,CAAC","file":"rect-contribution-render.js","sourcesContent":["import { isArray } from '@visactor/vutils';\nimport { injectable } from '../../../../common/inversify-lite';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IRect,\n IRectGraphicAttribute,\n IThemeAttribute,\n IRectRenderContribution,\n IDrawContext\n} from '../../../../interface';\nimport { getScaledStroke } from '../../../../common/canvas-utils';\nimport {\n defaultBaseBackgroundRenderContribution,\n defaultBaseTextureRenderContribution\n} from './base-contribution-render';\nimport { createRectPath } from '../../../../common/shape/rect';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\n\nexport class DefaultRectRenderContribution implements IRectRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n rect: IRect,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n rectAttribute: Required<IRectGraphicAttribute>,\n drawContext: IDrawContext,\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 { outerBorder, innerBorder } = rect.attribute;\n const doOuterBorder = outerBorder && outerBorder.visible !== false;\n const doInnerBorder = innerBorder && innerBorder.visible !== false;\n if (!(doOuterBorder || doInnerBorder)) {\n return;\n }\n const {\n cornerRadius = rectAttribute.cornerRadius,\n opacity = rectAttribute.opacity,\n x: originX = rectAttribute.x,\n y: originY = rectAttribute.y,\n scaleX = rectAttribute.scaleX,\n scaleY = rectAttribute.scaleY,\n x1,\n y1\n } = rect.attribute;\n\n let { width, height } = rect.attribute;\n\n width = (width ?? x1 - x) || 0;\n height = (height ?? y1 - y) || 0;\n\n const doStrokeOuter = !!(outerBorder && outerBorder.stroke);\n const doStrokeInner = !!(innerBorder && innerBorder.stroke);\n\n if (doOuterBorder) {\n const { distance = rectAttribute.outerBorder.distance } = outerBorder;\n const d = getScaledStroke(context, distance as number, context.dpr);\n const nextX = x - d;\n const nextY = y - d;\n const dw = d * 2;\n if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n context.beginPath();\n context.rect(nextX, nextY, width + dw, height + dw);\n } else {\n context.beginPath();\n\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache\n createRectPath(context, nextX, nextY, width + dw, height + dw, cornerRadius);\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute);\n\n if (strokeCb) {\n strokeCb(context, outerBorder, rectAttribute.outerBorder);\n } else if (doStrokeOuter) {\n // 存在stroke\n const lastOpacity = (rectAttribute.outerBorder as any).opacity;\n (rectAttribute.outerBorder as any).opacity = opacity;\n context.setStrokeStyle(\n rect,\n outerBorder,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n rectAttribute.outerBorder as any\n );\n (rectAttribute.outerBorder as any).opacity = lastOpacity;\n context.stroke();\n }\n }\n\n if (doInnerBorder) {\n const { distance = rectAttribute.innerBorder.distance } = innerBorder;\n const d = getScaledStroke(context, distance as number, context.dpr);\n const nextX = x + d;\n const nextY = y + d;\n const dw = d * 2;\n if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n context.beginPath();\n context.rect(nextX, nextY, width - dw, height - dw);\n } else {\n context.beginPath();\n\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache\n createRectPath(context, nextX, nextY, width - dw, height - dw, cornerRadius);\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute);\n\n if (strokeCb) {\n strokeCb(context, innerBorder, rectAttribute.innerBorder);\n } else if (doStrokeInner) {\n // 存在stroke\n const lastOpacity = (rectAttribute.innerBorder as any).opacity;\n (rectAttribute.innerBorder as any).opacity = opacity;\n context.setStrokeStyle(\n rect,\n innerBorder,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n rectAttribute.innerBorder as any\n );\n (rectAttribute.innerBorder as any).opacity = lastOpacity;\n context.stroke();\n }\n }\n }\n}\n\n@injectable()\nexport class SplitRectBeforeRenderContribution implements IRectRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.beforeFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n group: IRect,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n groupAttribute: Required<IRectGraphicAttribute>,\n drawContext: IDrawContext,\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 doFillOrStroke?: { doFill: boolean; doStroke: boolean }\n ) {\n const { stroke = groupAttribute.stroke } = group.attribute as any;\n\n // 数组且存在为false的项目,那就不绘制\n if (Array.isArray(stroke) && stroke.some(s => s === false)) {\n doFillOrStroke.doStroke = false;\n }\n }\n}\n\n@injectable()\nexport class SplitRectAfterRenderContribution implements IRectRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n rect: IRect,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n groupAttribute: Required<IRectGraphicAttribute>,\n drawContext: IDrawContext,\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 {\n width = groupAttribute.width,\n height = groupAttribute.height,\n stroke = groupAttribute.stroke\n } = rect.attribute as any;\n\n // 不是数组\n if (!(Array.isArray(stroke) && stroke.some(s => s === false))) {\n return;\n }\n\n context.setStrokeStyle(rect, rect.attribute, x, y, groupAttribute);\n // 单独处理每条边界,目前不考虑圆角\n context.beginPath();\n context.moveTo(x, y);\n // top\n if (stroke[0]) {\n context.lineTo(x + width, y);\n } else {\n context.moveTo(x + width, y);\n }\n // right\n if (stroke[1]) {\n context.lineTo(x + width, y + height);\n } else {\n context.moveTo(x + width, y + height);\n }\n // bottom\n if (stroke[2]) {\n context.lineTo(x, y + height);\n } else {\n context.moveTo(x, y + height);\n }\n // left\n if (stroke[3]) {\n // 没有close path是,起点和终点不连续,需要调整y保证不出现缺口\n const adjustY = stroke[0] ? y - context.lineWidth / 2 : y;\n context.lineTo(x, adjustY);\n } else {\n context.moveTo(x, y);\n }\n\n context.stroke();\n }\n}\n\nexport const defaultRectRenderContribution = new DefaultRectRenderContribution();\n// export const splitRectBeforeRenderContribution = new SplitRectBeforeRenderContribution();\n// export const splitRectAfterRenderContribution = new SplitRectAfterRenderContribution();\nexport const defaultRectTextureRenderContribution = defaultBaseTextureRenderContribution;\nexport const defaultRectBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/contributions/rect-contribution-render.ts"],"names":[],"mappings":";;;;;;;;;AAAA,6CAA2C;AAC3C,sEAA+D;AAW/D,kEAAkE;AAClE,yEAAqF;AACrF,wDAA+D;AAC/D,oDAAsE;AACtE,yFAA0F;AAE1F,MAAa,6BAA6B;IAA1C;QACE,SAAI,GAA+B,kCAA0B,CAAC,eAAe,CAAC;QAC9E,aAAQ,GAAY,IAAI,CAAC;QACzB,UAAK,GAAW,CAAC,CAAC;IA4HpB,CAAC;IA3HC,SAAS,CACP,IAAW,EACX,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,aAA8C,EAC9C,WAAyB,EACzB,MAIY,EACZ,QAIY;QAEZ,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,C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;aAAM;YACL,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC;SAC/B;QAED,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;YAEb,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1D,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;SAC5B;aAAM;YACL,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACtB;QAED,OAAO,CAAC,MAAM,EAAE,CAAC;IACnB,CAAC;CACF,CAAA;AAtEY,gCAAgC;IAD5C,IAAA,2BAAU,GAAE;GACA,gCAAgC,CAsE5C;AAtEY,4EAAgC;AAwEhC,QAAA,6BAA6B,GAAG,IAAI,6BAA6B,EAAE,CAAC;AAGpE,QAAA,oCAAoC,GAAG,uEAAoC,CAAC;AAC5E,QAAA,uCAAuC,GAAG,kEAAuC,CAAC","file":"rect-contribution-render.js","sourcesContent":["import { isArray } from '@visactor/vutils';\nimport { injectable } from '../../../../common/inversify-lite';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IRect,\n IRectGraphicAttribute,\n IThemeAttribute,\n IRectRenderContribution,\n IDrawContext\n} from '../../../../interface';\nimport { getScaledStroke } from '../../../../common/canvas-utils';\nimport { defaultBaseBackgroundRenderContribution } from './base-contribution-render';\nimport { createRectPath } from '../../../../common/shape/rect';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\nimport { defaultBaseTextureRenderContribution } from './base-texture-contribution-render';\n\nexport class DefaultRectRenderContribution implements IRectRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n rect: IRect,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n rectAttribute: Required<IRectGraphicAttribute>,\n drawContext: IDrawContext,\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 { outerBorder, innerBorder } = rect.attribute;\n const doOuterBorder = outerBorder && outerBorder.visible !== false;\n const doInnerBorder = innerBorder && innerBorder.visible !== false;\n if (!(doOuterBorder || doInnerBorder)) {\n return;\n }\n const {\n cornerRadius = rectAttribute.cornerRadius,\n opacity = rectAttribute.opacity,\n x: originX = rectAttribute.x,\n y: originY = rectAttribute.y,\n scaleX = rectAttribute.scaleX,\n scaleY = rectAttribute.scaleY,\n x1,\n y1\n } = rect.attribute;\n\n let { width, height } = rect.attribute;\n\n width = (width ?? x1 - x) || 0;\n height = (height ?? y1 - y) || 0;\n\n const doStrokeOuter = !!(outerBorder && outerBorder.stroke);\n const doStrokeInner = !!(innerBorder && innerBorder.stroke);\n\n if (doOuterBorder) {\n const { distance = rectAttribute.outerBorder.distance } = outerBorder;\n const d = getScaledStroke(context, distance as number, context.dpr);\n const nextX = x - d;\n const nextY = y - d;\n const dw = d * 2;\n if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n context.beginPath();\n context.rect(nextX, nextY, width + dw, height + dw);\n } else {\n context.beginPath();\n\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache\n createRectPath(context, nextX, nextY, width + dw, height + dw, cornerRadius);\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute);\n\n if (strokeCb) {\n strokeCb(context, outerBorder, rectAttribute.outerBorder);\n } else if (doStrokeOuter) {\n // 存在stroke\n const lastOpacity = (rectAttribute.outerBorder as any).opacity;\n (rectAttribute.outerBorder as any).opacity = opacity;\n context.setStrokeStyle(\n rect,\n outerBorder,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n rectAttribute.outerBorder as any\n );\n (rectAttribute.outerBorder as any).opacity = lastOpacity;\n context.stroke();\n }\n }\n\n if (doInnerBorder) {\n const { distance = rectAttribute.innerBorder.distance } = innerBorder;\n const d = getScaledStroke(context, distance as number, context.dpr);\n const nextX = x + d;\n const nextY = y + d;\n const dw = d * 2;\n if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n context.beginPath();\n context.rect(nextX, nextY, width - dw, height - dw);\n } else {\n context.beginPath();\n\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache\n createRectPath(context, nextX, nextY, width - dw, height - dw, cornerRadius);\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute);\n\n if (strokeCb) {\n strokeCb(context, innerBorder, rectAttribute.innerBorder);\n } else if (doStrokeInner) {\n // 存在stroke\n const lastOpacity = (rectAttribute.innerBorder as any).opacity;\n (rectAttribute.innerBorder as any).opacity = opacity;\n context.setStrokeStyle(\n rect,\n innerBorder,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n rectAttribute.innerBorder as any\n );\n (rectAttribute.innerBorder as any).opacity = lastOpacity;\n context.stroke();\n }\n }\n }\n}\n\n@injectable()\nexport class SplitRectBeforeRenderContribution implements IRectRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.beforeFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n group: IRect,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n groupAttribute: Required<IRectGraphicAttribute>,\n drawContext: IDrawContext,\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 doFillOrStroke?: { doFill: boolean; doStroke: boolean }\n ) {\n const { stroke = groupAttribute.stroke } = group.attribute as any;\n\n // 数组且存在为false的项目,那就不绘制\n if (Array.isArray(stroke) && stroke.some(s => s === false)) {\n doFillOrStroke.doStroke = false;\n }\n }\n}\n\n@injectable()\nexport class SplitRectAfterRenderContribution implements IRectRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n rect: IRect,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n groupAttribute: Required<IRectGraphicAttribute>,\n drawContext: IDrawContext,\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 {\n width = groupAttribute.width,\n height = groupAttribute.height,\n stroke = groupAttribute.stroke\n } = rect.attribute as any;\n\n // 不是数组\n if (!(Array.isArray(stroke) && stroke.some(s => s === false))) {\n return;\n }\n\n context.setStrokeStyle(rect, rect.attribute, x, y, groupAttribute);\n // 单独处理每条边界,目前不考虑圆角\n context.beginPath();\n context.moveTo(x, y);\n // top\n if (stroke[0]) {\n context.lineTo(x + width, y);\n } else {\n context.moveTo(x + width, y);\n }\n // right\n if (stroke[1]) {\n context.lineTo(x + width, y + height);\n } else {\n context.moveTo(x + width, y + height);\n }\n // bottom\n if (stroke[2]) {\n context.lineTo(x, y + height);\n } else {\n context.moveTo(x, y + height);\n }\n // left\n if (stroke[3]) {\n // 没有close path是,起点和终点不连续,需要调整y保证不出现缺口\n const adjustY = stroke[0] ? y - context.lineWidth / 2 : y;\n context.lineTo(x, adjustY);\n } else {\n context.moveTo(x, y);\n }\n\n context.stroke();\n }\n}\n\nexport const defaultRectRenderContribution = new DefaultRectRenderContribution();\n// export const splitRectBeforeRenderContribution = new SplitRectBeforeRenderContribution();\n// export const splitRectAfterRenderContribution = new SplitRectAfterRenderContribution();\nexport const defaultRectTextureRenderContribution = defaultBaseTextureRenderContribution;\nexport const defaultRectBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;\n"]}
@@ -7,5 +7,5 @@ export declare class DefaultSymbolRenderContribution implements ISymbolRenderCon
7
7
  drawShape(symbol: ISymbol, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, symbolAttribute: Required<ISymbolGraphicAttribute>, drawContext: IDrawContext, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
8
8
  }
9
9
  export declare const defaultSymbolRenderContribution: DefaultSymbolRenderContribution;
10
- export declare const defaultSymbolTextureRenderContribution: import("./base-contribution-render").DefaultBaseTextureRenderContribution;
10
+ export declare const defaultSymbolTextureRenderContribution: import("./base-texture-contribution-render").DefaultBaseTextureRenderContribution;
11
11
  export declare const defaultSymbolBackgroundRenderContribution: import("./base-contribution-render").DefaultBaseBackgroundRenderContribution;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.defaultSymbolBackgroundRenderContribution = exports.defaultSymbolTextureRenderContribution = exports.defaultSymbolRenderContribution = exports.DefaultSymbolRenderContribution = void 0;
6
6
 
7
- const canvas_utils_1 = require("../../../../common/canvas-utils"), base_contribution_render_1 = require("./base-contribution-render"), enums_1 = require("../../../../common/enums");
7
+ const canvas_utils_1 = require("../../../../common/canvas-utils"), base_contribution_render_1 = require("./base-contribution-render"), enums_1 = require("../../../../common/enums"), base_texture_contribution_render_1 = require("./base-texture-contribution-render");
8
8
 
9
9
  class DefaultSymbolRenderContribution {
10
10
  constructor() {
@@ -43,6 +43,6 @@ class DefaultSymbolRenderContribution {
43
43
  }
44
44
 
45
45
  exports.DefaultSymbolRenderContribution = DefaultSymbolRenderContribution, exports.defaultSymbolRenderContribution = new DefaultSymbolRenderContribution,
46
- exports.defaultSymbolTextureRenderContribution = base_contribution_render_1.defaultBaseTextureRenderContribution,
46
+ exports.defaultSymbolTextureRenderContribution = base_texture_contribution_render_1.defaultBaseTextureRenderContribution,
47
47
  exports.defaultSymbolBackgroundRenderContribution = base_contribution_render_1.defaultBaseBackgroundRenderContribution;
48
48
  //# sourceMappingURL=symbol-contribution-render.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/contributions/symbol-contribution-render.ts"],"names":[],"mappings":";;;AAWA,kEAAkE;AAClE,yEAGoC;AACpC,oDAAsE;AAEtE,MAAa,+BAA+B;IAA5C;QACE,SAAI,GAA+B,kCAA0B,CAAC,eAAe,CAAC;QAC9E,aAAQ,GAAY,IAAI,CAAC;QACzB,UAAK,GAAW,CAAC,CAAC;IA4GpB,CAAC;IA3GC,SAAS,CACP,MAAe,EACf,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,eAAkD,EAClD,WAAyB,EACzB,MAIY,EACZ,QAIY;QAEZ,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC;QAE1C,IAAI,CAAC,UAAU,EAAE;YACf,OAAO;SACR;QAED,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC;QACtD,MAAM,aAAa,GAAG,WAAW,IAAI,WAAW,CAAC,OAAO,KAAK,KAAK,CAAC;QACnE,MAAM,aAAa,GAA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,EACX,CAAC,OAAO,GAAG,CAAC,CAAC,GAAG,MAAM,EACtB,CAAC,OAAO,GAAG,CAAC,CAAC,GAAG,MAAM,EACtB,eAAe,CAAC,WAAkB,CACnC,CAAC;gBACD,eAAe,CAAC,WAAmB,CAAC,OAAO,GAAG,WAAW,CAAC;gBAC3D,OAAO,CAAC,MAAM,EAAE,CAAC;aAClB;SACF;IACH,CAAC;CACF;AA/GD,0EA+GC;AAEY,QAAA,+BAA+B,GAAG,IAAI,+BAA+B,EAAE,CAAC;AACxE,QAAA,sCAAsC,GAAG,+DAAoC,CAAC;AAC9E,QAAA,yCAAyC,GAAG,kEAAuC,CAAC","file":"symbol-contribution-render.js","sourcesContent":["import { injectable } from '../../../../common/inversify-lite';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n ISymbol,\n ISymbolGraphicAttribute,\n IThemeAttribute,\n ISymbolRenderContribution,\n IDrawContext\n} from '../../../../interface';\nimport { getScaledStroke } from '../../../../common/canvas-utils';\nimport {\n defaultBaseBackgroundRenderContribution,\n defaultBaseTextureRenderContribution\n} from './base-contribution-render';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\n\nexport class DefaultSymbolRenderContribution implements ISymbolRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n symbol: ISymbol,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n symbolAttribute: Required<ISymbolGraphicAttribute>,\n drawContext: IDrawContext,\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 parsedPath = symbol.getParsedPath();\n // todo: 考虑使用path\n if (!parsedPath) {\n return;\n }\n\n const { outerBorder, innerBorder } = symbol.attribute;\n const doOuterBorder = outerBorder && outerBorder.visible !== false;\n const doInnerBorder = innerBorder && innerBorder.visible !== false;\n if (!(doOuterBorder || doInnerBorder)) {\n return;\n }\n\n const {\n size = symbolAttribute.size,\n opacity = symbolAttribute.opacity,\n x: originX = symbolAttribute.x,\n y: originY = symbolAttribute.y,\n scaleX = symbolAttribute.scaleX,\n scaleY = symbolAttribute.scaleY\n } = symbol.attribute;\n\n const doStrokeOuter = !!(outerBorder && outerBorder.stroke);\n const doStrokeInner = !!(innerBorder && innerBorder.stroke);\n\n if (doOuterBorder) {\n const { distance = symbolAttribute.outerBorder.distance } = outerBorder;\n const d = getScaledStroke(context, distance as number, context.dpr);\n\n context.beginPath();\n if (parsedPath.drawOffset(context, size, x, y, d) === false) {\n context.closePath();\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute);\n\n if (strokeCb) {\n strokeCb(context, outerBorder, symbolAttribute.outerBorder);\n } else if (doStrokeOuter) {\n // 存在stroke\n const lastOpacity = (symbolAttribute.outerBorder as any).opacity;\n (symbolAttribute.outerBorder as any).opacity = opacity;\n context.setStrokeStyle(\n symbol,\n outerBorder,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n symbolAttribute.outerBorder as any\n );\n (symbolAttribute.outerBorder as any).opacity = lastOpacity;\n context.stroke();\n }\n }\n\n if (doInnerBorder) {\n const { distance = symbolAttribute.innerBorder.distance } = innerBorder;\n const d = getScaledStroke(context, distance as number, context.dpr);\n\n context.beginPath();\n if (parsedPath.drawOffset(context, size, x, y, -d) === false) {\n context.closePath();\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute);\n\n if (strokeCb) {\n strokeCb(context, innerBorder, symbolAttribute.innerBorder);\n } else if (doStrokeInner) {\n // 存在stroke\n const lastOpacity = (symbolAttribute.innerBorder as any).opacity;\n (symbolAttribute.innerBorder as any).opacity = opacity;\n context.setStrokeStyle(\n symbol,\n innerBorder,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n symbolAttribute.innerBorder as any\n );\n (symbolAttribute.innerBorder as any).opacity = lastOpacity;\n context.stroke();\n }\n }\n }\n}\n\nexport const defaultSymbolRenderContribution = new DefaultSymbolRenderContribution();\nexport const defaultSymbolTextureRenderContribution = defaultBaseTextureRenderContribution;\nexport const defaultSymbolBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/contributions/symbol-contribution-render.ts"],"names":[],"mappings":";;;AAUA,kEAAkE;AAClE,yEAAqF;AACrF,oDAAsE;AACtE,yFAA0F;AAE1F,MAAa,+BAA+B;IAA5C;QACE,SAAI,GAA+B,kCAA0B,CAAC,eAAe,CAAC;QAC9E,aAAQ,GAAY,IAAI,CAAC;QACzB,UAAK,GAAW,CAAC,CAAC;IA4GpB,CAAC;IA3GC,SAAS,CACP,MAAe,EACf,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,eAAkD,EAClD,WAAyB,EACzB,MAIY,EACZ,QAIY;QAEZ,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC;QAE1C,IAAI,CAAC,UAAU,EAAE;YACf,OAAO;SACR;QAED,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC;QACtD,MAAM,aAAa,GAAG,WAAW,IAAI,WAAW,CAAC,OAAO,KAAK,KAAK,CAAC;QACnE,MAAM,aAAa,GAAG,WAAW,IAAI,WAAW,CAAC,OAAO,KAAK,KAAK,CAAC;QACnE,IAAI,CAAC,CAAC,aAAa,IAAI,aAAa,CAAC,EAAE;YACrC,OAAO;SACR;QAED,MAAM,EACJ,IAAI,GAAG,eAAe,CAAC,IAAI,EAC3B,OAAO,GAAG,eAAe,CAAC,OAAO,EACjC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AAM,EAAE,CAAC;aAClB;SACF;IACH,CAAC;CACF;AA/GD,0EA+GC;AAEY,QAAA,+BAA+B,GAAG,IAAI,+BAA+B,EAAE,CAAC;AACxE,QAAA,sCAAsC,GAAG,uEAAoC,CAAC;AAC9E,QAAA,yCAAyC,GAAG,kEAAuC,CAAC","file":"symbol-contribution-render.js","sourcesContent":["import type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n ISymbol,\n ISymbolGraphicAttribute,\n IThemeAttribute,\n ISymbolRenderContribution,\n IDrawContext\n} from '../../../../interface';\nimport { getScaledStroke } from '../../../../common/canvas-utils';\nimport { defaultBaseBackgroundRenderContribution } from './base-contribution-render';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\nimport { defaultBaseTextureRenderContribution } from './base-texture-contribution-render';\n\nexport class DefaultSymbolRenderContribution implements ISymbolRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n symbol: ISymbol,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n symbolAttribute: Required<ISymbolGraphicAttribute>,\n drawContext: IDrawContext,\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 parsedPath = symbol.getParsedPath();\n // todo: 考虑使用path\n if (!parsedPath) {\n return;\n }\n\n const { outerBorder, innerBorder } = symbol.attribute;\n const doOuterBorder = outerBorder && outerBorder.visible !== false;\n const doInnerBorder = innerBorder && innerBorder.visible !== false;\n if (!(doOuterBorder || doInnerBorder)) {\n return;\n }\n\n const {\n size = symbolAttribute.size,\n opacity = symbolAttribute.opacity,\n x: originX = symbolAttribute.x,\n y: originY = symbolAttribute.y,\n scaleX = symbolAttribute.scaleX,\n scaleY = symbolAttribute.scaleY\n } = symbol.attribute;\n\n const doStrokeOuter = !!(outerBorder && outerBorder.stroke);\n const doStrokeInner = !!(innerBorder && innerBorder.stroke);\n\n if (doOuterBorder) {\n const { distance = symbolAttribute.outerBorder.distance } = outerBorder;\n const d = getScaledStroke(context, distance as number, context.dpr);\n\n context.beginPath();\n if (parsedPath.drawOffset(context, size, x, y, d) === false) {\n context.closePath();\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute);\n\n if (strokeCb) {\n strokeCb(context, outerBorder, symbolAttribute.outerBorder);\n } else if (doStrokeOuter) {\n // 存在stroke\n const lastOpacity = (symbolAttribute.outerBorder as any).opacity;\n (symbolAttribute.outerBorder as any).opacity = opacity;\n context.setStrokeStyle(\n symbol,\n outerBorder,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n symbolAttribute.outerBorder as any\n );\n (symbolAttribute.outerBorder as any).opacity = lastOpacity;\n context.stroke();\n }\n }\n\n if (doInnerBorder) {\n const { distance = symbolAttribute.innerBorder.distance } = innerBorder;\n const d = getScaledStroke(context, distance as number, context.dpr);\n\n context.beginPath();\n if (parsedPath.drawOffset(context, size, x, y, -d) === false) {\n context.closePath();\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute);\n\n if (strokeCb) {\n strokeCb(context, innerBorder, symbolAttribute.innerBorder);\n } else if (doStrokeInner) {\n // 存在stroke\n const lastOpacity = (symbolAttribute.innerBorder as any).opacity;\n (symbolAttribute.innerBorder as any).opacity = opacity;\n context.setStrokeStyle(\n symbol,\n innerBorder,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n symbolAttribute.innerBorder as any\n );\n (symbolAttribute.innerBorder as any).opacity = lastOpacity;\n context.stroke();\n }\n }\n }\n}\n\nexport const defaultSymbolRenderContribution = new DefaultSymbolRenderContribution();\nexport const defaultSymbolTextureRenderContribution = defaultBaseTextureRenderContribution;\nexport const defaultSymbolBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;\n"]}
@@ -4,24 +4,39 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.defaultTextBackgroundRenderContribution = exports.DefaultTextBackgroundRenderContribution = void 0;
6
6
 
7
- const enums_1 = require("../../../../common/enums"), base_contribution_render_1 = require("./base-contribution-render");
7
+ const vutils_1 = require("@visactor/vutils"), enums_1 = require("../../../../common/enums"), base_contribution_render_1 = require("./base-contribution-render"), bounds_allocate_1 = require("../../../../allocator/bounds-allocate"), rect_1 = require("../../../../common/shape/rect");
8
8
 
9
9
  class DefaultTextBackgroundRenderContribution extends base_contribution_render_1.DefaultBaseBackgroundRenderContribution {
10
10
  constructor() {
11
11
  super(...arguments), this.time = enums_1.BaseRenderContributionTime.beforeFillStroke;
12
12
  }
13
13
  drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
14
- const {background: background, backgroundMode: backgroundMode = graphicAttribute.backgroundMode} = graphic.attribute;
14
+ var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
15
+ const {backgroundMode: backgroundMode = graphicAttribute.backgroundMode, backgroundFit: backgroundFit = graphicAttribute.backgroundFit} = graphic.attribute;
16
+ let b, {background: background} = graphic.attribute;
15
17
  if (!background) return;
16
- const b = graphic.AABBBounds;
18
+ const shouldReCalBounds = (0, vutils_1.isObject)(background) && background.background, onlyTranslate = graphic.transMatrix.onlyTranslate();
19
+ if (shouldReCalBounds) {
20
+ const _b = graphic.AABBBounds, x = (null !== (_a = background.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = background.dx) && void 0 !== _c ? _c : 0), y = (null !== (_d = background.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = background.dy) && void 0 !== _e ? _e : 0), w = null !== (_f = background.width) && void 0 !== _f ? _f : _b.width(), h = null !== (_g = background.height) && void 0 !== _g ? _g : _b.height();
21
+ if (b = bounds_allocate_1.boundsAllocate.allocate(x, y, x + w, y + h), background = background.background,
22
+ !onlyTranslate) {
23
+ const w = b.width(), h = b.height();
24
+ b.set((null !== (_h = background.x) && void 0 !== _h ? _h : 0) + (null !== (_j = background.dx) && void 0 !== _j ? _j : 0), (null !== (_k = background.y) && void 0 !== _k ? _k : 0) + (null !== (_l = background.dy) && void 0 !== _l ? _l : 0), w, h);
25
+ }
26
+ } else b = graphic.AABBBounds, onlyTranslate || b.set(0, 0, b.width(), b.height());
17
27
  if (graphic.backgroundImg && graphic.resources) {
18
28
  const res = graphic.resources.get(background);
19
29
  if ("success" !== res.state || !res.data) return;
20
- context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0),
21
- this.doDrawImage(context, res.data, b, backgroundMode), context.highPerformanceRestore(),
22
- context.setTransformForCurrent();
23
- } else context.highPerformanceSave(), context.fillStyle = background, context.fillRect(b.x1, b.y1, b.width(), b.height()),
24
- context.highPerformanceRestore();
30
+ context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0),
31
+ context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit),
32
+ context.highPerformanceRestore(), context.setTransformForCurrent();
33
+ } else {
34
+ const {backgroundCornerRadius: backgroundCornerRadius} = graphic.attribute;
35
+ context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute),
36
+ context.fillStyle = background, backgroundCornerRadius ? ((0, rect_1.createRectPath)(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius),
37
+ context.fill()) : context.fillRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore();
38
+ }
39
+ shouldReCalBounds && bounds_allocate_1.boundsAllocate.free(b);
25
40
  }
26
41
  }
27
42
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/contributions/text-contribution-render.ts"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KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;YACpD,OAAO,CAAC,sBAAsB,EAAE,CAAC;SAClC;IACH,CAAC;CACF;AA9CD,0FA8CC;AAEY,QAAA,uCAAuC,GAAG,IAAI,uCAAuC,EAAE,CAAC","file":"text-contribution-render.js","sourcesContent":["import { BaseRenderContributionTime } from '../../../../common/enums';\nimport type {\n IContext2d,\n IDrawContext,\n IGraphicAttribute,\n IText,\n ITextRenderContribution,\n IThemeAttribute\n} from '../../../../interface';\nimport { DefaultBaseBackgroundRenderContribution } from './base-contribution-render';\n\nexport class DefaultTextBackgroundRenderContribution\n extends DefaultBaseBackgroundRenderContribution\n implements ITextRenderContribution\n{\n time: BaseRenderContributionTime = BaseRenderContributionTime.beforeFillStroke;\n\n drawShape(\n graphic: IText,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean\n ) {\n const { background, backgroundMode = graphicAttribute.backgroundMode } = graphic.attribute;\n if (!background) {\n return;\n }\n\n const b = graphic.AABBBounds;\n if (graphic.backgroundImg && graphic.resources) {\n const res = graphic.resources.get(background);\n if (res.state !== 'success' || !res.data) {\n return;\n }\n\n context.highPerformanceSave();\n\n context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);\n\n this.doDrawImage(context, res.data, b, backgroundMode);\n context.highPerformanceRestore();\n context.setTransformForCurrent();\n } else {\n context.highPerformanceSave();\n context.fillStyle = background as string;\n context.fillRect(b.x1, b.y1, b.width(), b.height());\n context.highPerformanceRestore();\n }\n }\n}\n\nexport const defaultTextBackgroundRenderContribution = new DefaultTextBackgroundRenderContribution();\n\n// @injectable()\n// export class DefaultTextPopTipRenderContribution\n// extends DefaultBasePopTipRenderContribution\n// implements ITextRenderContribution\n// {\n// time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n// }\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/contributions/text-contribution-render.ts"],"names":[],"mappings":";;;AACA,6CAA4C;AAC5C,oDAAsE;AAStE,yEAAqF;AACrF,2EAAuE;AAEvE,wDAA+D;AAE/D,MAAa,uCACX,SAAQ,kEAAuC;IADjD;;QAIE,SAAI,GAA+B,kCAA0B,CAAC,gBAAgB,CAAC;IAyFjF,CAAC;IAvFC,SAAS,CACP,OAAc,EACd,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,gBAA6C,EAC7C,WAAyB,EACzB,MAAiH,EACjH,QAAmH;;QAEnH,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAAC,cAAc,EAAE,aAAa,GAAG,gBAAgB,CAAC,aAAa,EAAE,GACxG,OAAO,CAAC,SAAS,CAAC;QACpB,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC;QACvC,IAAI,CAAC,UAAU,EAAE;YACf,OAAO;SACR;QACD,IAAI,CAAc,CAAC;QACnB,MAAM,iBAAiB,GAAG,IAAA,iBAAQ,EAAC,UAAU,CAAC,IAAK,UAAkB,CAAC,UAAU,CAAC;QACjF,MAAM,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC;QAC1D,IAAI,iBAAiB,EAAE;YACrB,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC9B,MAAM,CAAC,GAAG,CAAC,MAAC,UAAkB,CAAC,CAAC,mCAAI,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,MAAC,UAAkB,CAAC,EAAE,mCAAI,CAAC,CAAC,CAAC;YAC3E,MAAM,CAAC,GAAG,CAAC,MAAC,UAAkB,CAA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YACD,OAAO,CAAC,sBAAsB,EAAE,CAAC;SAClC;QAED,IAAI,iBAAiB,EAAE;YACrB,gCAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACxB;IACH,CAAC;CACF;AA7FD,0FA6FC;AAEY,QAAA,uCAAuC,GAAG,IAAI,uCAAuC,EAAE,CAAC","file":"text-contribution-render.js","sourcesContent":["import type { IAABBBounds } from '@visactor/vutils';\nimport { isObject } from '@visactor/vutils';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\nimport type {\n IContext2d,\n IDrawContext,\n IGraphicAttribute,\n IText,\n ITextRenderContribution,\n IThemeAttribute\n} from '../../../../interface';\nimport { DefaultBaseBackgroundRenderContribution } from './base-contribution-render';\nimport { boundsAllocate } from '../../../../allocator/bounds-allocate';\nimport { getTextBounds } from '../../../../graphic';\nimport { createRectPath } from '../../../../common/shape/rect';\n\nexport class DefaultTextBackgroundRenderContribution\n extends DefaultBaseBackgroundRenderContribution\n implements ITextRenderContribution\n{\n time: BaseRenderContributionTime = BaseRenderContributionTime.beforeFillStroke;\n\n drawShape(\n graphic: IText,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean\n ) {\n const { backgroundMode = graphicAttribute.backgroundMode, backgroundFit = graphicAttribute.backgroundFit } =\n graphic.attribute;\n let { background } = graphic.attribute;\n if (!background) {\n return;\n }\n let b: IAABBBounds;\n const shouldReCalBounds = isObject(background) && (background as any).background;\n const onlyTranslate = graphic.transMatrix.onlyTranslate();\n if (shouldReCalBounds) {\n const _b = graphic.AABBBounds;\n const x = ((background as any).x ?? _b.x1) + ((background as any).dx ?? 0);\n const y = ((background as any).y ?? _b.y1) + ((background as any).dy ?? 0);\n const w = (background as any).width ?? _b.width();\n const h = (background as any).height ?? _b.height();\n b = boundsAllocate.allocate(x, y, x + w, y + h);\n background = (background as any).background;\n if (!onlyTranslate) {\n const w = b.width();\n const h = b.height();\n b.set(\n ((background as any).x ?? 0) + ((background as any).dx ?? 0),\n ((background as any).y ?? 0) + ((background as any).dy ?? 0),\n w,\n h\n );\n }\n } else {\n b = graphic.AABBBounds;\n if (!onlyTranslate) {\n b.set(0, 0, b.width(), b.height());\n }\n }\n\n if (graphic.backgroundImg && graphic.resources) {\n const res = graphic.resources.get(background as any);\n if (res.state !== 'success' || !res.data) {\n return;\n }\n\n context.highPerformanceSave();\n // 默认应用旋转\n if (!onlyTranslate) {\n // TODO 性能优化\n // const _b = getTextBounds({ ...graphic.attribute, angle: 0, scaleX: 1, scaleY: 1, x: 0, y: 0, dx: 0, dy: 0 });\n // b.copy(_b);\n } else {\n context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);\n }\n\n context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute);\n this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit);\n context.highPerformanceRestore();\n context.setTransformForCurrent();\n } else {\n const { backgroundCornerRadius } = graphic.attribute;\n context.highPerformanceSave();\n context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute);\n context.fillStyle = background as string;\n if (backgroundCornerRadius) {\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache\n createRectPath(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius);\n context.fill();\n } else {\n context.fillRect(b.x1, b.y1, b.width(), b.height());\n }\n context.highPerformanceRestore();\n }\n\n if (shouldReCalBounds) {\n boundsAllocate.free(b);\n }\n }\n}\n\nexport const defaultTextBackgroundRenderContribution = new DefaultTextBackgroundRenderContribution();\n\n// @injectable()\n// export class DefaultTextPopTipRenderContribution\n// extends DefaultBasePopTipRenderContribution\n// implements ITextRenderContribution\n// {\n// time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n// }\n"]}
@@ -43,6 +43,12 @@ let DefaultDrawContribution = class {
43
43
  this.currentRenderService = renderService;
44
44
  const {context: context, stage: stage, x: x = 0, y: y = 0, width: width, height: height} = drawContext;
45
45
  if (!context) return;
46
+ if (drawContext.keepMatrix) {
47
+ if (context.nativeContext && context.nativeContext.getTransform) {
48
+ const t = context.nativeContext.getTransform();
49
+ context.setTransformFromMatrix(t, !0, 1);
50
+ }
51
+ } else context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0);
46
52
  const dirtyBounds = this.dirtyBounds.setValue(0, 0, width, height);
47
53
  if (stage.dirtyBounds && !stage.dirtyBounds.empty()) {
48
54
  const b = (0, vutils_1.getRectIntersect)(dirtyBounds, stage.dirtyBounds, !1);
@@ -52,8 +58,7 @@ let DefaultDrawContribution = class {
52
58
  const d = context.dpr % 1;
53
59
  (d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr,
54
60
  dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr,
55
- dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds),
56
- context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0);
61
+ dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds);
57
62
  const drawInArea = dirtyBounds.width() * context.dpr < context.canvas.width || dirtyBounds.height() * context.dpr < context.canvas.height;
58
63
  context.save(), context.translate(x, y, !0), drawInArea && (context.beginPath(),
59
64
  context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()),
@@ -64,7 +69,7 @@ let DefaultDrawContribution = class {
64
69
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : graphic_1.DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : graphic_1.DefaultAttribute.zIndex);
65
70
  })).forEach((group => {
66
71
  group.isContainer ? this.renderGroup(group, drawContext, matrix_allocate_1.matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : this.renderItem(group, drawContext);
67
- })), context.restore(), context.restore(), context.draw(), context.inuse = !1;
72
+ })), context.restore(), context.restore(), context.draw(), drawContext.keepMatrix || (context.inuse = !1);
68
73
  }
69
74
  doRegister() {
70
75
  throw new Error("暂不支持");
@@ -175,13 +180,14 @@ let DefaultDrawContribution = class {
175
180
  return this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
176
181
  }
177
182
  clearScreen(renderService, context, drawContext) {
178
- var _a;
183
+ var _a, _b;
179
184
  const {clear: clear} = drawContext;
180
185
  if (clear) {
181
186
  const canvas = context.getCanvas(), {width: width = canvas.width, height: height = canvas.height} = drawContext, x = 0, y = 0;
182
187
  context.clearRect(x, y, width, height);
183
188
  const stage = null === (_a = renderService.drawParams) || void 0 === _a ? void 0 : _a.stage;
184
- if (stage && stage.backgroundImg && stage.resources) {
189
+ if (stage && (context.globalAlpha = null !== (_b = stage.attribute.opacity) && void 0 !== _b ? _b : 1),
190
+ stage && stage.backgroundImg && stage.resources) {
185
191
  const res = stage.resources.get(clear);
186
192
  res && "success" === res.state && res.data && context.drawImage(res.data, x, y, width, height);
187
193
  } else context.fillStyle = (0, canvas_utils_1.createColor)(context, clear, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/draw-contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAAwF;AAgBxF,+CAAgE;AAEhE,iFAA6E;AAC7E,8CAAoD;AAEpD,6CAA2F;AAE3F,kDAA+C;AAC/C,qCAAsF;AACtF,yDAAyD;AACzD,+DAA2D;AAE3D,wEAAoE;AACpE,wEAAoE;AACpE,sDAAmD;AAM5C,IAAM,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":["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 IRenderSelector,\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';\nimport type { IAABBBounds, IBounds, IBoundsLike, IMatrix, IMatrixLike } from '@visactor/vutils';\nimport { Bounds, Logger, getRectIntersect, isRectIntersect, last } from '@visactor/vutils';\nimport { LayerService } from '../../../core/constants';\nimport { container } from '../../../container';\nimport { GraphicRender, IncrementalDrawContribution, RenderSelector } 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 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 this.init();\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, x = 0, y = 0, width, height } = 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, width, 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\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(x, y, true);\n if (drawInArea) {\n context.beginPath();\n context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height());\n context.clip();\n }\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.draw();\n // this.break = false;\n context.inuse = false;\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 (this.useDirtyBounds && !isRectIntersect(group.AABBBounds, this.dirtyBounds, false)) {\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 = this.renderSelector.selector(graphic);\n let renderer;\n if (!renderer) {\n renderer = this.selectRenderByNumberType(graphic.numberType);\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: IAABBBounds;\n\n if (graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n retrans = !!(scrollX || scrollY);\n if (retrans) {\n tempBounds = this.dirtyBounds.clone();\n // 变换dirtyBounds\n const m = graphic.globalTransMatrix.getInverse();\n this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(m);\n this.dirtyBounds.translate(-scrollX, -scrollY);\n }\n }\n\n if (this.useDirtyBounds && !(graphic.isContainer || isRectIntersect(graphic.AABBBounds, this.dirtyBounds, false))) {\n retrans && this.dirtyBounds.copy(tempBounds);\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\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): IGraphicRender | null {\n return this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);\n }\n\n protected clearScreen(renderService: IRenderService, context: IContext2d, drawContext: IDrawContext) {\n const { clear } = drawContext;\n if (clear) {\n const canvas = context.getCanvas();\n const { width = canvas.width, height = canvas.height } = drawContext;\n const x = 0;\n const y = 0;\n context.clearRect(x, y, width, height);\n const stage = renderService.drawParams?.stage;\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;AAgBxF,+CAAgE;AAEhE,iFAA6E;AAC7E,8CAAoD;AAEpD,6CAA2F;AAE3F,kDAA+C;AAC/C,qCAAsF;AACtF,yDAAyD;AACzD,+DAA2D;AAE3D,wEAAoE;AACpE,wEAAoE;AACpE,sDAAmD;AAM5C,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAclC,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,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CAAA;;GAtBlB,uBAAuB,CA4ZnC;AA5ZY,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 IRenderSelector,\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';\nimport type { IAABBBounds, IBounds, IBoundsLike, IMatrix, IMatrixLike } from '@visactor/vutils';\nimport { Bounds, Logger, getRectIntersect, isRectIntersect, last } from '@visactor/vutils';\nimport { LayerService } from '../../../core/constants';\nimport { container } from '../../../container';\nimport { GraphicRender, IncrementalDrawContribution, RenderSelector } 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 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 this.init();\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, x = 0, y = 0, width, height } = drawContext;\n\n if (!context) {\n return;\n }\n // 设置context的transform\n if (drawContext.keepMatrix) {\n if (context.nativeContext && context.nativeContext.getTransform) {\n const t = context.nativeContext.getTransform();\n context.setTransformFromMatrix(t, true, 1);\n }\n } else {\n context.inuse = true;\n // 初始化context\n context.clearMatrix();\n context.setTransformForCurrent(true);\n }\n\n const dirtyBounds: IBounds | undefined = this.dirtyBounds.setValue(0, 0, width, 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\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(x, y, true);\n if (drawInArea) {\n context.beginPath();\n context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height());\n context.clip();\n }\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.draw();\n // this.break = false;\n if (!drawContext.keepMatrix) {\n context.inuse = false;\n }\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 (this.useDirtyBounds && !isRectIntersect(group.AABBBounds, this.dirtyBounds, false)) {\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 = this.renderSelector.selector(graphic);\n let renderer;\n if (!renderer) {\n renderer = this.selectRenderByNumberType(graphic.numberType);\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: IAABBBounds;\n\n if (graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n retrans = !!(scrollX || scrollY);\n if (retrans) {\n tempBounds = this.dirtyBounds.clone();\n // 变换dirtyBounds\n const m = graphic.globalTransMatrix.getInverse();\n this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(m);\n this.dirtyBounds.translate(-scrollX, -scrollY);\n }\n }\n\n if (this.useDirtyBounds && !(graphic.isContainer || isRectIntersect(graphic.AABBBounds, this.dirtyBounds, false))) {\n retrans && this.dirtyBounds.copy(tempBounds);\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\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): IGraphicRender | null {\n return this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);\n }\n\n protected clearScreen(renderService: IRenderService, context: IContext2d, drawContext: IDrawContext) {\n const { clear } = drawContext;\n if (clear) {\n const canvas = context.getCanvas();\n const { width = canvas.width, height = canvas.height } = drawContext;\n const x = 0;\n const y = 0;\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"]}