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

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 (313) 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/render-area.js +15 -3
  4. package/cjs/common/render-area.js.map +1 -1
  5. package/cjs/common/render-curve.js +16 -4
  6. package/cjs/common/render-curve.js.map +1 -1
  7. package/cjs/common/segment/basis.js +3 -2
  8. package/cjs/common/segment/basis.js.map +1 -1
  9. package/cjs/common/segment/common.d.ts +1 -4
  10. package/cjs/common/segment/common.js +3 -13
  11. package/cjs/common/segment/common.js.map +1 -1
  12. package/cjs/common/segment/linear-closed.d.ts +16 -2
  13. package/cjs/common/segment/linear-closed.js +34 -3
  14. package/cjs/common/segment/linear-closed.js.map +1 -1
  15. package/cjs/common/segment/linear.d.ts +1 -1
  16. package/cjs/common/segment/linear.js +3 -2
  17. package/cjs/common/segment/linear.js.map +1 -1
  18. package/cjs/common/segment/monotone.d.ts +2 -2
  19. package/cjs/common/segment/monotone.js +12 -10
  20. package/cjs/common/segment/monotone.js.map +1 -1
  21. package/cjs/common/sort.js +1 -2
  22. package/cjs/common/split-path.js +2 -2
  23. package/cjs/common/split-path.js.map +1 -1
  24. package/cjs/core/application.js +1 -1
  25. package/cjs/core/camera.js +1 -1
  26. package/cjs/core/constants.js +1 -1
  27. package/cjs/core/stage.js +1 -4
  28. package/cjs/core/stage.js.map +1 -1
  29. package/cjs/env-check.js +17 -17
  30. package/cjs/env-check.js.map +1 -1
  31. package/cjs/event/event-system.js +3 -3
  32. package/cjs/event/event-system.js.map +1 -1
  33. package/cjs/graphic/arc.js +1 -1
  34. package/cjs/graphic/arc.js.map +1 -1
  35. package/cjs/graphic/arc3d.js +1 -1
  36. package/cjs/graphic/arc3d.js.map +1 -1
  37. package/cjs/graphic/area.js +1 -1
  38. package/cjs/graphic/area.js.map +1 -1
  39. package/cjs/graphic/bounds.d.ts +2 -2
  40. package/cjs/graphic/bounds.js +1 -1
  41. package/cjs/graphic/bounds.js.map +1 -1
  42. package/cjs/graphic/circle.js +1 -1
  43. package/cjs/graphic/circle.js.map +1 -1
  44. package/cjs/graphic/config.js +0 -4
  45. package/cjs/graphic/config.js.map +1 -1
  46. package/cjs/graphic/glyph.js +1 -1
  47. package/cjs/graphic/glyph.js.map +1 -1
  48. package/cjs/graphic/graphic-service/graphic-service.js +11 -13
  49. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  50. package/cjs/graphic/graphic.js +4 -5
  51. package/cjs/graphic/graphic.js.map +1 -1
  52. package/cjs/graphic/group.js +1 -1
  53. package/cjs/graphic/group.js.map +1 -1
  54. package/cjs/graphic/image.d.ts +1 -3
  55. package/cjs/graphic/image.js +1 -7
  56. package/cjs/graphic/image.js.map +1 -1
  57. package/cjs/graphic/line.js +1 -1
  58. package/cjs/graphic/line.js.map +1 -1
  59. package/cjs/graphic/node-tree.js +1 -4
  60. package/cjs/graphic/node-tree.js.map +1 -1
  61. package/cjs/graphic/path.js +1 -1
  62. package/cjs/graphic/path.js.map +1 -1
  63. package/cjs/graphic/polygon.js +1 -1
  64. package/cjs/graphic/polygon.js.map +1 -1
  65. package/cjs/graphic/pyramid3d.js +1 -1
  66. package/cjs/graphic/pyramid3d.js.map +1 -1
  67. package/cjs/graphic/rect.js +7 -4
  68. package/cjs/graphic/rect.js.map +1 -1
  69. package/cjs/graphic/richtext.d.ts +1 -1
  70. package/cjs/graphic/richtext.js +6 -10
  71. package/cjs/graphic/richtext.js.map +1 -1
  72. package/cjs/graphic/symbol.js +1 -1
  73. package/cjs/graphic/symbol.js.map +1 -1
  74. package/cjs/graphic/text.js +4 -4
  75. package/cjs/graphic/text.js.map +1 -1
  76. package/cjs/interface/event.d.ts +0 -2
  77. package/cjs/interface/event.js.map +1 -1
  78. package/cjs/interface/graphic/richText.d.ts +1 -1
  79. package/cjs/interface/graphic/richText.js.map +1 -1
  80. package/cjs/interface/graphic/symbol.d.ts +1 -1
  81. package/cjs/interface/graphic/symbol.js.map +1 -1
  82. package/cjs/interface/graphic.d.ts +1 -14
  83. package/cjs/interface/graphic.js.map +1 -1
  84. package/cjs/interface/stage.d.ts +0 -4
  85. package/cjs/interface/stage.js.map +1 -1
  86. package/cjs/modules.d.ts +0 -3
  87. package/cjs/modules.js +10 -9
  88. package/cjs/modules.js.map +1 -1
  89. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +7 -6
  90. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  91. package/cjs/render/contributions/render/area-render.js +5 -5
  92. package/cjs/render/contributions/render/area-render.js.map +1 -1
  93. package/cjs/render/contributions/render/contributions/arc-contribution-render.d.ts +1 -1
  94. package/cjs/render/contributions/render/contributions/arc-contribution-render.js +2 -2
  95. package/cjs/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
  96. package/cjs/render/contributions/render/contributions/area-contribution-render.d.ts +9 -1
  97. package/cjs/render/contributions/render/contributions/area-contribution-render.js +55 -3
  98. package/cjs/render/contributions/render/contributions/area-contribution-render.js.map +1 -1
  99. package/cjs/render/contributions/render/contributions/base-contribution-render.d.ts +20 -2
  100. package/cjs/render/contributions/render/contributions/base-contribution-render.js +125 -25
  101. package/cjs/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  102. package/cjs/render/contributions/render/contributions/circle-contribution-render.d.ts +1 -1
  103. package/cjs/render/contributions/render/contributions/circle-contribution-render.js +2 -2
  104. package/cjs/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
  105. package/cjs/render/contributions/render/contributions/group-contribution-render.js +2 -2
  106. package/cjs/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
  107. package/cjs/render/contributions/render/contributions/image-contribution-render.js +2 -3
  108. package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
  109. package/cjs/render/contributions/render/contributions/index.d.ts +0 -2
  110. package/cjs/render/contributions/render/contributions/index.js +1 -2
  111. package/cjs/render/contributions/render/contributions/index.js.map +1 -1
  112. package/cjs/render/contributions/render/contributions/path-contribution-render.d.ts +1 -1
  113. package/cjs/render/contributions/render/contributions/path-contribution-render.js +2 -2
  114. package/cjs/render/contributions/render/contributions/path-contribution-render.js.map +1 -1
  115. package/cjs/render/contributions/render/contributions/polygon-contribution-render.d.ts +1 -1
  116. package/cjs/render/contributions/render/contributions/polygon-contribution-render.js +2 -2
  117. package/cjs/render/contributions/render/contributions/polygon-contribution-render.js.map +1 -1
  118. package/cjs/render/contributions/render/contributions/rect-contribution-render.d.ts +1 -1
  119. package/cjs/render/contributions/render/contributions/rect-contribution-render.js +2 -2
  120. package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  121. package/cjs/render/contributions/render/contributions/symbol-contribution-render.d.ts +1 -1
  122. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js +2 -2
  123. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  124. package/cjs/render/contributions/render/contributions/text-contribution-render.js +8 -23
  125. package/cjs/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
  126. package/cjs/render/contributions/render/draw-contribution.js +7 -6
  127. package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
  128. package/cjs/render/contributions/render/image-render.js +2 -4
  129. package/cjs/render/contributions/render/image-render.js.map +1 -1
  130. package/cjs/render/contributions/render/incremental-draw-contribution.d.ts +1 -0
  131. package/cjs/render/contributions/render/incremental-draw-contribution.js +5 -1
  132. package/cjs/render/contributions/render/incremental-draw-contribution.js.map +1 -1
  133. package/cjs/render/contributions/render/index.d.ts +0 -1
  134. package/cjs/render/contributions/render/index.js +1 -2
  135. package/cjs/render/contributions/render/index.js.map +1 -1
  136. package/cjs/render/contributions/render/utils.d.ts +1 -1
  137. package/cjs/render/contributions/render/utils.js.map +1 -1
  138. package/cjs/resource-loader/loader.d.ts +0 -5
  139. package/cjs/resource-loader/loader.js +15 -56
  140. package/cjs/resource-loader/loader.js.map +1 -1
  141. package/dist/index.js +27707 -0
  142. package/dist/index.min.js +1 -0
  143. package/es/common/canvas-utils.js +1 -3
  144. package/es/common/canvas-utils.js.map +1 -1
  145. package/es/common/render-area.js +12 -2
  146. package/es/common/render-area.js.map +1 -1
  147. package/es/common/render-curve.js +15 -2
  148. package/es/common/render-curve.js.map +1 -1
  149. package/es/common/segment/basis.js +8 -2
  150. package/es/common/segment/basis.js.map +1 -1
  151. package/es/common/segment/common.d.ts +1 -4
  152. package/es/common/segment/common.js +0 -11
  153. package/es/common/segment/common.js.map +1 -1
  154. package/es/common/segment/linear-closed.d.ts +16 -2
  155. package/es/common/segment/linear-closed.js +38 -4
  156. package/es/common/segment/linear-closed.js.map +1 -1
  157. package/es/common/segment/linear.d.ts +1 -1
  158. package/es/common/segment/linear.js +8 -2
  159. package/es/common/segment/linear.js.map +1 -1
  160. package/es/common/segment/monotone.d.ts +2 -2
  161. package/es/common/segment/monotone.js +13 -7
  162. package/es/common/segment/monotone.js.map +1 -1
  163. package/es/common/sort.js +1 -2
  164. package/es/common/split-path.js +1 -3
  165. package/es/common/split-path.js.map +1 -1
  166. package/es/core/application.js +1 -1
  167. package/es/core/camera.js +1 -1
  168. package/es/core/constants.js +1 -1
  169. package/es/core/stage.js +1 -4
  170. package/es/core/stage.js.map +1 -1
  171. package/es/env-check.js +13 -12
  172. package/es/env-check.js.map +1 -1
  173. package/es/event/event-system.js +3 -3
  174. package/es/event/event-system.js.map +1 -1
  175. package/es/graphic/arc.js +1 -1
  176. package/es/graphic/arc.js.map +1 -1
  177. package/es/graphic/arc3d.js +1 -1
  178. package/es/graphic/arc3d.js.map +1 -1
  179. package/es/graphic/area.js +1 -1
  180. package/es/graphic/area.js.map +1 -1
  181. package/es/graphic/bounds.d.ts +2 -2
  182. package/es/graphic/bounds.js +1 -1
  183. package/es/graphic/bounds.js.map +1 -1
  184. package/es/graphic/circle.js +1 -1
  185. package/es/graphic/circle.js.map +1 -1
  186. package/es/graphic/config.js +0 -4
  187. package/es/graphic/config.js.map +1 -1
  188. package/es/graphic/glyph.js +1 -1
  189. package/es/graphic/glyph.js.map +1 -1
  190. package/es/graphic/graphic-service/graphic-service.js +11 -13
  191. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  192. package/es/graphic/graphic.js +5 -6
  193. package/es/graphic/graphic.js.map +1 -1
  194. package/es/graphic/group.js +1 -1
  195. package/es/graphic/group.js.map +1 -1
  196. package/es/graphic/image.d.ts +1 -3
  197. package/es/graphic/image.js +1 -7
  198. package/es/graphic/image.js.map +1 -1
  199. package/es/graphic/line.js +1 -1
  200. package/es/graphic/line.js.map +1 -1
  201. package/es/graphic/node-tree.js +1 -4
  202. package/es/graphic/node-tree.js.map +1 -1
  203. package/es/graphic/path.js +1 -1
  204. package/es/graphic/path.js.map +1 -1
  205. package/es/graphic/polygon.js +1 -1
  206. package/es/graphic/polygon.js.map +1 -1
  207. package/es/graphic/pyramid3d.js +1 -1
  208. package/es/graphic/pyramid3d.js.map +1 -1
  209. package/es/graphic/rect.js +7 -4
  210. package/es/graphic/rect.js.map +1 -1
  211. package/es/graphic/richtext.d.ts +1 -1
  212. package/es/graphic/richtext.js +5 -11
  213. package/es/graphic/richtext.js.map +1 -1
  214. package/es/graphic/symbol.js +1 -1
  215. package/es/graphic/symbol.js.map +1 -1
  216. package/es/graphic/text.js +4 -4
  217. package/es/graphic/text.js.map +1 -1
  218. package/es/interface/event.d.ts +0 -2
  219. package/es/interface/event.js.map +1 -1
  220. package/es/interface/graphic/richText.d.ts +1 -1
  221. package/es/interface/graphic/richText.js.map +1 -1
  222. package/es/interface/graphic/symbol.d.ts +1 -1
  223. package/es/interface/graphic/symbol.js.map +1 -1
  224. package/es/interface/graphic.d.ts +1 -14
  225. package/es/interface/graphic.js.map +1 -1
  226. package/es/interface/stage.d.ts +0 -4
  227. package/es/interface/stage.js.map +1 -1
  228. package/es/modules.d.ts +0 -3
  229. package/es/modules.js +6 -4
  230. package/es/modules.js.map +1 -1
  231. package/es/plugins/builtin-plugin/html-attribute-plugin.js +7 -6
  232. package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  233. package/es/render/contributions/render/area-render.js +5 -5
  234. package/es/render/contributions/render/area-render.js.map +1 -1
  235. package/es/render/contributions/render/contributions/arc-contribution-render.d.ts +1 -1
  236. package/es/render/contributions/render/contributions/arc-contribution-render.js +1 -3
  237. package/es/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
  238. package/es/render/contributions/render/contributions/area-contribution-render.d.ts +9 -1
  239. package/es/render/contributions/render/contributions/area-contribution-render.js +51 -2
  240. package/es/render/contributions/render/contributions/area-contribution-render.js.map +1 -1
  241. package/es/render/contributions/render/contributions/base-contribution-render.d.ts +20 -2
  242. package/es/render/contributions/render/contributions/base-contribution-render.js +123 -23
  243. package/es/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  244. package/es/render/contributions/render/contributions/circle-contribution-render.d.ts +1 -1
  245. package/es/render/contributions/render/contributions/circle-contribution-render.js +1 -3
  246. package/es/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
  247. package/es/render/contributions/render/contributions/group-contribution-render.js +2 -2
  248. package/es/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
  249. package/es/render/contributions/render/contributions/image-contribution-render.js +2 -3
  250. package/es/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
  251. package/es/render/contributions/render/contributions/index.d.ts +0 -2
  252. package/es/render/contributions/render/contributions/index.js +0 -4
  253. package/es/render/contributions/render/contributions/index.js.map +1 -1
  254. package/es/render/contributions/render/contributions/path-contribution-render.d.ts +1 -1
  255. package/es/render/contributions/render/contributions/path-contribution-render.js +1 -3
  256. package/es/render/contributions/render/contributions/path-contribution-render.js.map +1 -1
  257. package/es/render/contributions/render/contributions/polygon-contribution-render.d.ts +1 -1
  258. package/es/render/contributions/render/contributions/polygon-contribution-render.js +1 -3
  259. package/es/render/contributions/render/contributions/polygon-contribution-render.js.map +1 -1
  260. package/es/render/contributions/render/contributions/rect-contribution-render.d.ts +1 -1
  261. package/es/render/contributions/render/contributions/rect-contribution-render.js +1 -3
  262. package/es/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  263. package/es/render/contributions/render/contributions/symbol-contribution-render.d.ts +1 -1
  264. package/es/render/contributions/render/contributions/symbol-contribution-render.js +1 -3
  265. package/es/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  266. package/es/render/contributions/render/contributions/text-contribution-render.js +7 -28
  267. package/es/render/contributions/render/contributions/text-contribution-render.js.map +1 -1
  268. package/es/render/contributions/render/draw-contribution.js +7 -6
  269. package/es/render/contributions/render/draw-contribution.js.map +1 -1
  270. package/es/render/contributions/render/image-render.js +2 -6
  271. package/es/render/contributions/render/image-render.js.map +1 -1
  272. package/es/render/contributions/render/incremental-draw-contribution.d.ts +1 -0
  273. package/es/render/contributions/render/incremental-draw-contribution.js +5 -1
  274. package/es/render/contributions/render/incremental-draw-contribution.js.map +1 -1
  275. package/es/render/contributions/render/index.d.ts +0 -1
  276. package/es/render/contributions/render/index.js +0 -2
  277. package/es/render/contributions/render/index.js.map +1 -1
  278. package/es/render/contributions/render/utils.d.ts +1 -1
  279. package/es/render/contributions/render/utils.js.map +1 -1
  280. package/es/resource-loader/loader.d.ts +0 -5
  281. package/es/resource-loader/loader.js +14 -56
  282. package/es/resource-loader/loader.js.map +1 -1
  283. package/package.json +4 -6
  284. package/cjs/common/color-utils.d.ts +0 -9
  285. package/cjs/common/color-utils.js +0 -231
  286. package/cjs/common/color-utils.js.map +0 -1
  287. package/cjs/common/rect-utils.d.ts +0 -7
  288. package/cjs/common/rect-utils.js +0 -27
  289. package/cjs/common/rect-utils.js.map +0 -1
  290. package/cjs/common/render-utils.d.ts +0 -10
  291. package/cjs/common/render-utils.js +0 -22
  292. package/cjs/common/render-utils.js.map +0 -1
  293. package/cjs/render/contributions/render/contributions/area-texture-contribution-render.d.ts +0 -9
  294. package/cjs/render/contributions/render/contributions/area-texture-contribution-render.js +0 -26
  295. package/cjs/render/contributions/render/contributions/area-texture-contribution-render.js.map +0 -1
  296. package/cjs/render/contributions/render/contributions/base-texture-contribution-render.d.ts +0 -21
  297. package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js +0 -128
  298. package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js.map +0 -1
  299. package/es/common/color-utils.d.ts +0 -9
  300. package/es/common/color-utils.js +0 -224
  301. package/es/common/color-utils.js.map +0 -1
  302. package/es/common/rect-utils.d.ts +0 -7
  303. package/es/common/rect-utils.js +0 -20
  304. package/es/common/rect-utils.js.map +0 -1
  305. package/es/common/render-utils.d.ts +0 -10
  306. package/es/common/render-utils.js +0 -14
  307. package/es/common/render-utils.js.map +0 -1
  308. package/es/render/contributions/render/contributions/area-texture-contribution-render.d.ts +0 -9
  309. package/es/render/contributions/render/contributions/area-texture-contribution-render.js +0 -18
  310. package/es/render/contributions/render/contributions/area-texture-contribution-render.js.map +0 -1
  311. package/es/render/contributions/render/contributions/base-texture-contribution-render.d.ts +0 -21
  312. package/es/render/contributions/render/contributions/base-texture-contribution-render.js +0 -124
  313. package/es/render/contributions/render/contributions/base-texture-contribution-render.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/contributions/image-contribution-render.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,uCAAuC,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,OAAO,wCACX,SAAQ,uCAAuC;IADjD;;QAIE,SAAI,GAA+B,0BAA0B,CAAC,gBAAgB,CAAC;IA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AC/C;IAED,OAAO;QACL,CAAC;QACD,CAAC;QACD,KAAK;QACL,MAAM;KACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,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"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/contributions/image-contribution-render.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,QAAQ,EAAE,MAAM,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I,aAAa,GAAG,CAAC,CAAC;QAC3B,MAAM,IAAI,aAAa,GAAG,CAAC,CAAC;KAC7B;SAAM;QACL,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;AAED,MAAM,CAAC,MAAM,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"]}
@@ -5,5 +5,3 @@ 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';
@@ -11,8 +11,4 @@ export * from "./image-contribution-render";
11
11
  export * from "./rect-contribution-render";
12
12
 
13
13
  export * from "./symbol-contribution-render";
14
-
15
- export * from "./base-texture-contribution-render";
16
-
17
- export * from "./area-texture-contribution-render";
18
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/contributions/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAE7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC","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
+ {"version":3,"sources":["../src/render/contributions/render/contributions/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC","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,2 +1,2 @@
1
- export declare const defaultPathTextureRenderContribution: import("./base-texture-contribution-render").DefaultBaseTextureRenderContribution;
1
+ export declare const defaultPathTextureRenderContribution: import("./base-contribution-render").DefaultBaseTextureRenderContribution;
2
2
  export declare const defaultPathBackgroundRenderContribution: import("./base-contribution-render").DefaultBaseBackgroundRenderContribution;
@@ -1,6 +1,4 @@
1
- import { defaultBaseBackgroundRenderContribution } from "./base-contribution-render";
2
-
3
- import { defaultBaseTextureRenderContribution } from "./base-texture-contribution-render";
1
+ import { defaultBaseBackgroundRenderContribution, defaultBaseTextureRenderContribution } from "./base-contribution-render";
4
2
 
5
3
  export const defaultPathTextureRenderContribution = defaultBaseTextureRenderContribution;
6
4
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/contributions/path-contribution-render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uCAAuC,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAE1F,MAAM,CAAC,MAAM,oCAAoC,GAAG,oCAAoC,CAAC;AACzF,MAAM,CAAC,MAAM,uCAAuC,GAAG,uCAAuC,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
+ {"version":3,"sources":["../src/render/contributions/render/contributions/path-contribution-render.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uCAAuC,EACvC,oCAAoC,EACrC,MAAM,4BAA4B,CAAC;AAEpC,MAAM,CAAC,MAAM,oCAAoC,GAAG,oCAAoC,CAAC;AACzF,MAAM,CAAC,MAAM,uCAAuC,GAAG,uCAAuC,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,2 +1,2 @@
1
- export declare const defaultPolygonTextureRenderContribution: import("./base-texture-contribution-render").DefaultBaseTextureRenderContribution;
1
+ export declare const defaultPolygonTextureRenderContribution: import("./base-contribution-render").DefaultBaseTextureRenderContribution;
2
2
  export declare const defaultPolygonBackgroundRenderContribution: import("./base-contribution-render").DefaultBaseBackgroundRenderContribution;
@@ -1,6 +1,4 @@
1
- import { defaultBaseBackgroundRenderContribution } from "./base-contribution-render";
2
-
3
- import { defaultBaseTextureRenderContribution } from "./base-texture-contribution-render";
1
+ import { defaultBaseBackgroundRenderContribution, defaultBaseTextureRenderContribution } from "./base-contribution-render";
4
2
 
5
3
  export const defaultPolygonTextureRenderContribution = defaultBaseTextureRenderContribution;
6
4
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/contributions/polygon-contribution-render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uCAAuC,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAE1F,MAAM,CAAC,MAAM,uCAAuC,GAAG,oCAAoC,CAAC;AAC5F,MAAM,CAAC,MAAM,0CAA0C,GAAG,uCAAuC,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"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/contributions/polygon-contribution-render.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uCAAuC,EACvC,oCAAoC,EACrC,MAAM,4BAA4B,CAAC;AAEpC,MAAM,CAAC,MAAM,uCAAuC,GAAG,oCAAoC,CAAC;AAC5F,MAAM,CAAC,MAAM,0CAA0C,GAAG,uCAAuC,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"]}
@@ -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-texture-contribution-render").DefaultBaseTextureRenderContribution;
25
+ export declare const defaultRectTextureRenderContribution: import("./base-contribution-render").DefaultBaseTextureRenderContribution;
26
26
  export declare const defaultRectBackgroundRenderContribution: import("./base-contribution-render").DefaultBaseBackgroundRenderContribution;
@@ -10,14 +10,12 @@ import { injectable } from "../../../../common/inversify-lite";
10
10
 
11
11
  import { getScaledStroke } from "../../../../common/canvas-utils";
12
12
 
13
- import { defaultBaseBackgroundRenderContribution } from "./base-contribution-render";
13
+ import { defaultBaseBackgroundRenderContribution, defaultBaseTextureRenderContribution } from "./base-contribution-render";
14
14
 
15
15
  import { createRectPath } from "../../../../common/shape/rect";
16
16
 
17
17
  import { BaseRenderContributionTime } from "../../../../common/enums";
18
18
 
19
- import { defaultBaseTextureRenderContribution } from "./base-texture-contribution-render";
20
-
21
19
  export class DefaultRectRenderContribution {
22
20
  constructor() {
23
21
  this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/contributions/rect-contribution-render.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAW/D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,uCAAuC,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAE1F,MAAM,OAAO,6BAA6B;IAA1C;QACE,SAAI,GAA+B,0BAA0B,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,CAAC;QACpD,MAAM,aAAa,GAAG,WAAW,IAAI,WAAW,CAAC,OAAO,KAAK,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,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,UAAU,EAAE;GACA,gCAAgC,CAsE5C;SAtEY,gCAAgC;AAwE7C,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,6BAA6B,EAAE,CAAC;AAGjF,MAAM,CAAC,MAAM,oCAAoC,GAAG,oCAAoC,CAAC;AACzF,MAAM,CAAC,MAAM,uCAAuC,GAAG,uCAAuC,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"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/contributions/rect-contribution-render.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAW/D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EACL,uCAAuC,EACvC,oCAAoC,EACrC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAEtE,MAAM,OAAO,6BAA6B;IAA1C;QACE,SAAI,GAA+B,0BAA0B,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,CAAC;QACpD,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,EAA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C1D,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,UAAU,EAAE;GACA,gCAAgC,CAsE5C;SAtEY,gCAAgC;AAwE7C,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,6BAA6B,EAAE,CAAC;AAGjF,MAAM,CAAC,MAAM,oCAAoC,GAAG,oCAAoC,CAAC;AACzF,MAAM,CAAC,MAAM,uCAAuC,GAAG,uCAAuC,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"]}
@@ -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-texture-contribution-render").DefaultBaseTextureRenderContribution;
10
+ export declare const defaultSymbolTextureRenderContribution: import("./base-contribution-render").DefaultBaseTextureRenderContribution;
11
11
  export declare const defaultSymbolBackgroundRenderContribution: import("./base-contribution-render").DefaultBaseBackgroundRenderContribution;
@@ -1,11 +1,9 @@
1
1
  import { getScaledStroke } from "../../../../common/canvas-utils";
2
2
 
3
- import { defaultBaseBackgroundRenderContribution } from "./base-contribution-render";
3
+ import { defaultBaseBackgroundRenderContribution, defaultBaseTextureRenderContribution } from "./base-contribution-render";
4
4
 
5
5
  import { BaseRenderContributionTime } from "../../../../common/enums";
6
6
 
7
- import { defaultBaseTextureRenderContribution } from "./base-texture-contribution-render";
8
-
9
7
  export class DefaultSymbolRenderContribution {
10
8
  constructor() {
11
9
  this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/contributions/symbol-contribution-render.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,uCA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emeAttribute,\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"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/contributions/symbol-contribution-render.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EACL,uCAAuC,EACvC,oCAAoC,EACrC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,0B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AAC,SAAS,EAAE,CAAC;YACpB,IAAI,UAAU,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE;gBAC5D,OAAO,CAAC,SAAS,EAAE,CAAC;aACrB;YAGD,OAAO,CAAC,mBAAmB,IAAI,OAAO,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;YAEtG,IAAI,QAAQ,EAAE;gBACZ,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;aAC7D;iBAAM,IAAI,aAAa,EAAE;gBAExB,MAAM,WAAW,GAAI,eAAe,CAAC,WAAmB,CAAC,OAAO,CAAC;gBAChE,eAAe,CAAC,WAAmB,CAAC,OAAO,GAAG,OAAO,CAAC;gBACvD,OAAO,CAAC,cAAc,CACpB,MAAM,EACN,WAAW,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;AAED,MAAM,CAAC,MAAM,+BAA+B,GAAG,IAAI,+BAA+B,EAAE,CAAC;AACrF,MAAM,CAAC,MAAM,sCAAsC,GAAG,oCAAoC,CAAC;AAC3F,MAAM,CAAC,MAAM,yCAAyC,GAAG,uCAAuC,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,44 +1,23 @@
1
- import { isObject } from "@visactor/vutils";
2
-
3
1
  import { BaseRenderContributionTime } from "../../../../common/enums";
4
2
 
5
3
  import { DefaultBaseBackgroundRenderContribution } from "./base-contribution-render";
6
4
 
7
- import { boundsAllocate } from "../../../../allocator/bounds-allocate";
8
-
9
- import { createRectPath } from "../../../../common/shape/rect";
10
-
11
5
  export class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRenderContribution {
12
6
  constructor() {
13
7
  super(...arguments), this.time = BaseRenderContributionTime.beforeFillStroke;
14
8
  }
15
9
  drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
16
- var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
17
- const {backgroundMode: backgroundMode = graphicAttribute.backgroundMode, backgroundFit: backgroundFit = graphicAttribute.backgroundFit} = graphic.attribute;
18
- let b, {background: background} = graphic.attribute;
10
+ const {background: background, backgroundMode: backgroundMode = graphicAttribute.backgroundMode} = graphic.attribute;
19
11
  if (!background) return;
20
- const shouldReCalBounds = isObject(background) && background.background, onlyTranslate = graphic.transMatrix.onlyTranslate();
21
- if (shouldReCalBounds) {
22
- 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();
23
- if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = background.background,
24
- !onlyTranslate) {
25
- const w = b.width(), h = b.height();
26
- 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);
27
- }
28
- } else b = graphic.AABBBounds, onlyTranslate || b.set(0, 0, b.width(), b.height());
12
+ const b = graphic.AABBBounds;
29
13
  if (graphic.backgroundImg && graphic.resources) {
30
14
  const res = graphic.resources.get(background);
31
15
  if ("success" !== res.state || !res.data) return;
32
- context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0),
33
- context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit),
34
- context.highPerformanceRestore(), context.setTransformForCurrent();
35
- } else {
36
- const {backgroundCornerRadius: backgroundCornerRadius} = graphic.attribute;
37
- context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute),
38
- context.fillStyle = background, backgroundCornerRadius ? (createRectPath(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius),
39
- context.fill()) : context.fillRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore();
40
- }
41
- shouldReCalBounds && boundsAllocate.free(b);
16
+ context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0),
17
+ this.doDrawImage(context, res.data, b, backgroundMode), context.highPerformanceRestore(),
18
+ context.setTransformForCurrent();
19
+ } else context.highPerformanceSave(), context.fillStyle = background, context.fillRect(b.x1, b.y1, b.width(), b.height()),
20
+ context.highPerformanceRestore();
42
21
  }
43
22
  }
44
23
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/contributions/text-contribution-render.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAStE,OAAO,EAAE,uCAAuC,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAEvE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,OAAO,uCACX,SAAQ,uCAAuC;IADjD;;QAIE,SAAI,GAA+B,0BAA0B,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,c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AM;YACL,MAAM,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC;YACrD,OAAO,CAAC,mBAAmB,EAAE,CAAC;YAC9B,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,gBAAgB,CAAC,CAAC;YAC3E,OAAO,CAAC,SAAS,GAAG,UAAoB,CAAC;YACzC,IAAI,sBAAsB,EAAE;gBAE1B,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,sBAAsB,CAAC,CAAC;gBACnF,OAAO,CAAC,IAAI,EAAE,CAAC;aAChB;iBAAM;gBACL,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;aACrD;YACD,OAAO,CAAC,sBAAsB,EAAE,CAAC;SAClC;QAED,IAAI,iBAAiB,EAAE;YACrB,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACxB;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,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"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/contributions/text-contribution-render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAStE,OAAO,EAAE,uCAAuC,EAAE,MAAM,4BAA4B,CAAC;AAErF,MAAM,OAAO,uCACX,SAAQ,uCAAuC;IADjD;;QAIE,SAAI,GAA+B,0BAA0B,CAAC,gBAAgB,CAAC;IA0CjF,CAAC;IAxCC,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,UAAU,EAAE,cAAc,GAAG,gBAAgB,CAAC,cAAc,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC;QAC3F,IAAI,CAAC,UAAU,EAAE;YACf,OAAO;SACR;QAED,MAAM,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;QAC7B,IAAI,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,SAAS,EAAE;YAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC9C,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;gBACxC,OAAO;aACR;YAED,OAAO,CAAC,mBAAmB,EAAE,CAAC;YAE9B,OAAO,CAAC,sBAAsB,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;YAEvE,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,cAAc,CAAC,CAAC;YACvD,OAAO,CAAC,sBAAsB,EAAE,CAAC;YACjC,OAAO,CAAC,sBAAsB,EAAE,CAAC;SAClC;aAAM;YACL,OAAO,CAAC,mBAAmB,EAAE,CAAC;YAC9B,OAAO,CAAC,SAAS,GAAG,UAAoB,CAAC;YACzC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;YACpD,OAAO,CAAC,sBAAsB,EAAE,CAAC;SAClC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,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"]}
@@ -72,8 +72,9 @@ let DefaultDrawContribution = class {
72
72
  const drawInArea = dirtyBounds.width() * context.dpr < context.canvas.width || dirtyBounds.height() * context.dpr < context.canvas.height;
73
73
  context.save(), context.translate(x, y, !0), drawInArea && (context.beginPath(),
74
74
  context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()),
75
- context.clip()), stage.camera && (this.dirtyBounds.clear(), this.backupDirtyBounds.clear()),
76
- this.clearScreen(renderService, context, drawContext), context.save(), renderService.renderTreeRoots.sort(((a, b) => {
75
+ context.clip()), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0),
76
+ this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext),
77
+ context.save(), renderService.renderTreeRoots.sort(((a, b) => {
77
78
  var _a, _b;
78
79
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
79
80
  })).forEach((group => {
@@ -125,7 +126,8 @@ let DefaultDrawContribution = class {
125
126
  group: group
126
127
  }, subLayers.set(group._uid, incrementalLayer));
127
128
  const incrementalContext = incrementalLayer.layer.getNativeHandler().getContext(), idc = incrementalLayer.drawContribution || container.get(IncrementalDrawContribution);
128
- idc.dirtyBounds.clear(), idc.backupDirtyBounds.clear(), idc.draw(this.currentRenderService, Object.assign(Object.assign({}, drawContext), {
129
+ idc.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), idc.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0),
130
+ idc.draw(this.currentRenderService, Object.assign(Object.assign({}, drawContext), {
129
131
  drawContribution: idc,
130
132
  clear: "transparent",
131
133
  layer: incrementalLayer.layer,
@@ -188,14 +190,13 @@ let DefaultDrawContribution = class {
188
190
  return this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
189
191
  }
190
192
  clearScreen(renderService, context, drawContext) {
191
- var _a, _b;
193
+ var _a;
192
194
  const {clear: clear} = drawContext;
193
195
  if (clear) {
194
196
  const canvas = context.getCanvas(), {width: width = canvas.width, height: height = canvas.height} = drawContext, x = 0, y = 0;
195
197
  context.clearRect(x, y, width, height);
196
198
  const stage = null === (_a = renderService.drawParams) || void 0 === _a ? void 0 : _a.stage;
197
- if (stage && (context.globalAlpha = null !== (_b = stage.attribute.opacity) && void 0 !== _b ? _b : 1),
198
- stage && stage.backgroundImg && stage.resources) {
199
+ if (stage && stage.backgroundImg && stage.resources) {
199
200
  const res = stage.resources.get(clear);
200
201
  res && "success" === res.state && res.data && context.drawImage(res.data, x, y, width, height);
201
202
  } else context.fillStyle = createColor(context, clear, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/draw-contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAgBxF,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,eAAe,EAAQ,MAAM,kBAAkB,CAAC;AAE3F,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAkB,MAAM,UAAU,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;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,IA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IAAI,GAAG,CAAC,IAAI,EAAE;oBAC9C,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;iBAClD;aACF;iBAAM;gBACL,OAAO,CAAC,SAAS,GAAG,WAAW,CAC7B,OAAO,EACP,KAAK,EACL;oBACE,UAAU,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,EAAE;iBAC5D,EACD,CAAC,EACD,CAAC,CACF,CAAC;gBACF,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;aACvC;SACF;IACH,CAAC;IAED,SAAS,CAAC,aAA6B,EAAE,UAAwB;QAC/D,OAAO;IACT,CAAC;CACF,CAAA;AApZY,uBAAuB;IADnC,UAAU,EAAE;IAmBR,WAAA,WAAW,CAAC,aAAa,CAAC,CAAA;IAG1B,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,mBAAmB,CAAC,CAAA;;GAtBlB,uBAAuB,CAoZnC;SApZY,uBAAuB","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 // 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.clear();\n this.backupDirtyBounds.clear();\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.clear();\n idc.backupDirtyBounds.clear();\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"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/draw-contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAgBxF,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,eAAe,EAAQ,MAAM,kBAAkB,CAAC;AAE3F,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAkB,MAAM,UAAU,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;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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KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE;oBAC9C,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;iBAClD;aACF;iBAAM;gBACL,OAAO,CAAC,SAAS,GAAG,WAAW,CAC7B,OAAO,EACP,KAAK,EACL;oBACE,UAAU,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,EAAE;iBAC5D,EACD,CAAC,EACD,CAAC,CACF,CAAC;gBACF,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;aACvC;SACF;IACH,CAAC;IAED,SAAS,CAAC,aAA6B,EAAE,UAAwB;QAC/D,OAAO;IACT,CAAC;CACF,CAAA;AAnZY,uBAAuB;IADnC,UAAU,EAAE;IAmBR,WAAA,WAAW,CAAC,aAAa,CAAC,CAAA;IAG1B,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC5B,WAAA,KAAK,CAAC,mBAAmB,CAAC,CAAA;;GAtBlB,uBAAuB,CAmZnC;SAnZY,uBAAuB","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 // 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"]}
@@ -20,7 +20,7 @@ import { ImageRenderContribution } from "./contributions/constants";
20
20
 
21
21
  import { IMAGE_NUMBER_TYPE } from "../../../graphic/constants";
22
22
 
23
- import { isArray, isString } from "@visactor/vutils";
23
+ import { isArray } from "@visactor/vutils";
24
24
 
25
25
  import { createRectPath } from "../../../common/shape/rect";
26
26
 
@@ -28,8 +28,6 @@ import { BaseRender } from "./base-render";
28
28
 
29
29
  import { defaultImageBackgroundRenderContribution } from "./contributions";
30
30
 
31
- import { ResourceLoader } from "../../../resource-loader/loader";
32
-
33
31
  const repeatStr = [ "", "repeat-x", "repeat-y", "repeat" ];
34
32
 
35
33
  let DefaultCanvasImageRender = class extends BaseRender {
@@ -65,9 +63,7 @@ let DefaultCanvasImageRender = class extends BaseRender {
65
63
  draw(image, renderService, drawContext) {
66
64
  const {image: url} = image.attribute;
67
65
  if (!url || !image.resources) return;
68
- const res = image.resources.get(url);
69
- if ("loading" === res.state && isString(url)) return void ResourceLoader.improveImageLoading(url);
70
- if ("success" !== res.state) return;
66
+ if ("success" !== image.resources.get(url).state) return;
71
67
  const {context: context} = renderService.drawParams;
72
68
  if (!context) return;
73
69
  const imageAttribute = getTheme(image).image;