@visactor/vrender-core 0.17.0-alpha.5 → 0.17.0-alpha.7

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 (506) hide show
  1. package/cjs/allocator/canvas-allocate.d.ts +0 -4
  2. package/cjs/allocator/canvas-allocate.js +6 -19
  3. package/cjs/allocator/canvas-allocate.js.map +1 -1
  4. package/cjs/allocator/graphic-allocate.d.ts +1 -56
  5. package/cjs/allocator/graphic-allocate.js +1 -163
  6. package/cjs/allocator/graphic-allocate.js.map +1 -1
  7. package/cjs/animate/Ticker/default-ticker.js +1 -1
  8. package/cjs/animate/Ticker/default-ticker.js.map +1 -1
  9. package/cjs/animate/config.js +2 -1
  10. package/cjs/animate/custom-animate.js +1 -2
  11. package/cjs/common/Reflect-metadata.js +359 -349
  12. package/cjs/common/Reflect-metadata.js.map +1 -1
  13. package/cjs/common/bezier-utils.js +1 -2
  14. package/cjs/common/inversify-lite/annotation/post_construct.d.ts +4 -0
  15. package/cjs/common/{inversify/annotation/injectable.js → inversify-lite/annotation/post_construct.js} +5 -15
  16. package/cjs/common/inversify-lite/annotation/post_construct.js.map +1 -0
  17. package/cjs/common/inversify-lite/container/container.js +3 -1
  18. package/cjs/common/inversify-lite/container/container.js.map +1 -1
  19. package/cjs/common/inversify-lite/index.d.ts +8 -1
  20. package/cjs/common/inversify-lite/index.js +64 -1
  21. package/cjs/common/inversify-lite/index.js.map +1 -1
  22. package/cjs/common/inversify-lite/interfaces/interfaces.d.ts +2 -0
  23. package/cjs/common/inversify-lite/interfaces/interfaces.js.map +1 -1
  24. package/cjs/common/inversify-lite/planning/queryable_string.d.ts +2 -0
  25. package/cjs/common/inversify-lite/planning/queryable_string.js +10 -0
  26. package/cjs/common/inversify-lite/planning/queryable_string.js.map +1 -1
  27. package/cjs/common/inversify-lite/resolution/resolver.js.map +1 -1
  28. package/cjs/common/sort.js +2 -1
  29. package/cjs/common/split-path.js +1 -2
  30. package/cjs/core/contributions/layerHandler/canvas2d-contribution.d.ts +2 -2
  31. package/cjs/core/contributions/layerHandler/canvas2d-contribution.js +9 -4
  32. package/cjs/core/contributions/layerHandler/canvas2d-contribution.js.map +1 -1
  33. package/cjs/core/contributions/layerHandler/empty-contribution.d.ts +2 -2
  34. package/cjs/core/contributions/layerHandler/empty-contribution.js +9 -4
  35. package/cjs/core/contributions/layerHandler/empty-contribution.js.map +1 -1
  36. package/cjs/core/contributions/layerHandler/offscreen2d-contribution.d.ts +2 -2
  37. package/cjs/core/contributions/layerHandler/offscreen2d-contribution.js +9 -4
  38. package/cjs/core/contributions/layerHandler/offscreen2d-contribution.js.map +1 -1
  39. package/cjs/core/contributions/textMeasure/modules.js +2 -1
  40. package/cjs/core/contributions/textMeasure/modules.js.map +1 -1
  41. package/cjs/core/core-modules.js +6 -5
  42. package/cjs/core/core-modules.js.map +1 -1
  43. package/cjs/core/global.d.ts +0 -4
  44. package/cjs/core/global.js +5 -8
  45. package/cjs/core/global.js.map +1 -1
  46. package/cjs/core/graphic-utils.d.ts +4 -7
  47. package/cjs/core/graphic-utils.js +14 -18
  48. package/cjs/core/graphic-utils.js.map +1 -1
  49. package/cjs/core/layer-service.d.ts +2 -2
  50. package/cjs/core/layer-service.js +10 -5
  51. package/cjs/core/layer-service.js.map +1 -1
  52. package/cjs/core/stage.d.ts +4 -7
  53. package/cjs/core/stage.js +33 -37
  54. package/cjs/core/stage.js.map +1 -1
  55. package/cjs/core/window.d.ts +2 -2
  56. package/cjs/core/window.js +12 -7
  57. package/cjs/core/window.js.map +1 -1
  58. package/cjs/event/event-manager.js +2 -3
  59. package/cjs/event/event-manager.js.map +1 -1
  60. package/cjs/graphic/graphic-service/arc-contribution.d.ts +5 -1
  61. package/cjs/graphic/graphic-service/arc-contribution.js +18 -0
  62. package/cjs/graphic/graphic-service/arc-contribution.js.map +1 -1
  63. package/cjs/graphic/graphic-service/area-contribution.d.ts +1 -1
  64. package/cjs/graphic/graphic-service/area-contribution.js +4 -1
  65. package/cjs/graphic/graphic-service/area-contribution.js.map +1 -1
  66. package/cjs/graphic/graphic-service/circle-contribution.d.ts +5 -1
  67. package/cjs/graphic/graphic-service/circle-contribution.js +18 -0
  68. package/cjs/graphic/graphic-service/circle-contribution.js.map +1 -1
  69. package/cjs/graphic/graphic-service/common-contribution.js +11 -2
  70. package/cjs/graphic/graphic-service/common-contribution.js.map +1 -1
  71. package/cjs/graphic/graphic-service/graphic-module.js +17 -2
  72. package/cjs/graphic/graphic-service/graphic-module.js.map +1 -1
  73. package/cjs/graphic/graphic-service/graphic-service.d.ts +7 -2
  74. package/cjs/graphic/graphic-service/graphic-service.js +26 -18
  75. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  76. package/cjs/graphic/graphic-service/path-contribution.d.ts +5 -1
  77. package/cjs/graphic/graphic-service/path-contribution.js +18 -0
  78. package/cjs/graphic/graphic-service/path-contribution.js.map +1 -1
  79. package/cjs/graphic/graphic-service/rect-contribution.d.ts +5 -1
  80. package/cjs/graphic/graphic-service/rect-contribution.js +18 -0
  81. package/cjs/graphic/graphic-service/rect-contribution.js.map +1 -1
  82. package/cjs/graphic/graphic-service/symbol-contribution.d.ts +1 -0
  83. package/cjs/graphic/graphic-service/symbol-contribution.js +13 -4
  84. package/cjs/graphic/graphic-service/symbol-contribution.js.map +1 -1
  85. package/cjs/graphic/graphic.js +2 -3
  86. package/cjs/graphic/graphic.js.map +1 -1
  87. package/cjs/graphic/group.d.ts +0 -1
  88. package/cjs/graphic/group.js +3 -7
  89. package/cjs/graphic/group.js.map +1 -1
  90. package/cjs/graphic/symbol.js +4 -7
  91. package/cjs/graphic/symbol.js.map +1 -1
  92. package/cjs/graphic/theme.d.ts +4 -4
  93. package/cjs/graphic/theme.js +28 -27
  94. package/cjs/graphic/theme.js.map +1 -1
  95. package/cjs/index.d.ts +0 -2
  96. package/cjs/index.js +0 -1
  97. package/cjs/index.js.map +1 -1
  98. package/cjs/interface/allocator.d.ts +0 -1
  99. package/cjs/interface/allocator.js.map +1 -1
  100. package/cjs/interface/global.d.ts +0 -1
  101. package/cjs/interface/global.js.map +1 -1
  102. package/cjs/interface/render.d.ts +2 -2
  103. package/cjs/interface/render.js.map +1 -1
  104. package/cjs/interface/stage.d.ts +1 -2
  105. package/cjs/interface/stage.js.map +1 -1
  106. package/cjs/modules.d.ts +2 -1
  107. package/cjs/modules.js +8 -8
  108. package/cjs/modules.js.map +1 -1
  109. package/cjs/picker/global-picker-service.d.ts +2 -2
  110. package/cjs/picker/global-picker-service.js +9 -4
  111. package/cjs/picker/global-picker-service.js.map +1 -1
  112. package/cjs/picker/pick-modules.js +4 -2
  113. package/cjs/picker/pick-modules.js.map +1 -1
  114. package/cjs/picker/picker-service.d.ts +2 -2
  115. package/cjs/picker/picker-service.js +6 -6
  116. package/cjs/picker/picker-service.js.map +1 -1
  117. package/cjs/plugins/plugin-modules.js +2 -1
  118. package/cjs/plugins/plugin-modules.js.map +1 -1
  119. package/cjs/render/contributions/render/arc-render.js +1 -2
  120. package/cjs/render/contributions/render/arc-render.js.map +1 -1
  121. package/cjs/render/contributions/render/area-render.d.ts +0 -1
  122. package/cjs/render/contributions/render/area-render.js +6 -44
  123. package/cjs/render/contributions/render/area-render.js.map +1 -1
  124. package/cjs/render/contributions/render/base-render.d.ts +1 -1
  125. package/cjs/render/contributions/render/base-render.js +18 -15
  126. package/cjs/render/contributions/render/base-render.js.map +1 -1
  127. package/cjs/render/contributions/render/circle-render.js +1 -2
  128. package/cjs/render/contributions/render/circle-render.js.map +1 -1
  129. package/cjs/render/contributions/render/contributions/arc-contribution-render.d.ts +7 -3
  130. package/cjs/render/contributions/render/contributions/arc-contribution-render.js +30 -7
  131. package/cjs/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
  132. package/cjs/render/contributions/render/contributions/area-contribution-render.d.ts +4 -3
  133. package/cjs/render/contributions/render/contributions/area-contribution-render.js +21 -7
  134. package/cjs/render/contributions/render/contributions/area-contribution-render.js.map +1 -1
  135. package/cjs/render/contributions/render/contributions/base-contribution-render.d.ts +0 -2
  136. package/cjs/render/contributions/render/contributions/base-contribution-render.js +9 -9
  137. package/cjs/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  138. package/cjs/render/contributions/render/contributions/circle-contribution-render.d.ts +7 -3
  139. package/cjs/render/contributions/render/contributions/circle-contribution-render.js +30 -7
  140. package/cjs/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
  141. package/cjs/render/contributions/render/contributions/constants.d.ts +0 -1
  142. package/cjs/render/contributions/render/contributions/constants.js +2 -2
  143. package/cjs/render/contributions/render/contributions/constants.js.map +1 -1
  144. package/cjs/render/contributions/render/contributions/group-contribution-render.d.ts +0 -1
  145. package/cjs/render/contributions/render/contributions/group-contribution-render.js +12 -6
  146. package/cjs/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
  147. package/cjs/render/contributions/render/contributions/image-contribution-render.d.ts +0 -1
  148. package/cjs/render/contributions/render/contributions/image-contribution-render.js +12 -6
  149. package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
  150. package/cjs/render/contributions/render/contributions/path-contribution-render.d.ts +9 -2
  151. package/cjs/render/contributions/render/contributions/path-contribution-render.js +25 -4
  152. package/cjs/render/contributions/render/contributions/path-contribution-render.js.map +1 -1
  153. package/cjs/render/contributions/render/contributions/polygon-contribution-render.d.ts +9 -2
  154. package/cjs/render/contributions/render/contributions/polygon-contribution-render.js +25 -4
  155. package/cjs/render/contributions/render/contributions/polygon-contribution-render.js.map +1 -1
  156. package/cjs/render/contributions/render/contributions/rect-contribution-render.d.ts +7 -5
  157. package/cjs/render/contributions/render/contributions/rect-contribution-render.js +36 -13
  158. package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  159. package/cjs/render/contributions/render/contributions/symbol-contribution-render.d.ts +7 -3
  160. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js +27 -6
  161. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  162. package/cjs/render/contributions/render/draw-contribution.d.ts +6 -7
  163. package/cjs/render/contributions/render/draw-contribution.js +22 -31
  164. package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
  165. package/cjs/render/contributions/render/draw-interceptor.d.ts +1 -9
  166. package/cjs/render/contributions/render/draw-interceptor.js +27 -41
  167. package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
  168. package/cjs/render/contributions/render/group-render.js +2 -3
  169. package/cjs/render/contributions/render/group-render.js.map +1 -1
  170. package/cjs/render/contributions/render/image-render.js +1 -2
  171. package/cjs/render/contributions/render/image-render.js.map +1 -1
  172. package/cjs/render/contributions/render/incremental-draw-contribution.d.ts +6 -2
  173. package/cjs/render/contributions/render/incremental-draw-contribution.js +11 -8
  174. package/cjs/render/contributions/render/incremental-draw-contribution.js.map +1 -1
  175. package/cjs/render/contributions/render/line-render.d.ts +0 -1
  176. package/cjs/render/contributions/render/line-render.js +6 -21
  177. package/cjs/render/contributions/render/line-render.js.map +1 -1
  178. package/cjs/render/contributions/render/module.js +87 -32
  179. package/cjs/render/contributions/render/module.js.map +1 -1
  180. package/cjs/render/contributions/render/path-render.d.ts +1 -2
  181. package/cjs/render/contributions/render/path-render.js +5 -8
  182. package/cjs/render/contributions/render/path-render.js.map +1 -1
  183. package/cjs/render/contributions/render/polygon-render.js +1 -2
  184. package/cjs/render/contributions/render/polygon-render.js.map +1 -1
  185. package/cjs/render/contributions/render/rect-render.d.ts +1 -2
  186. package/cjs/render/contributions/render/rect-render.js +4 -8
  187. package/cjs/render/contributions/render/rect-render.js.map +1 -1
  188. package/cjs/render/contributions/render/render-slector.d.ts +4 -1
  189. package/cjs/render/contributions/render/render-slector.js +20 -0
  190. package/cjs/render/contributions/render/render-slector.js.map +1 -1
  191. package/cjs/render/contributions/render/symbol-render.js +1 -2
  192. package/cjs/render/contributions/render/symbol-render.js.map +1 -1
  193. package/cjs/render/contributions/render/text-render.js +8 -10
  194. package/cjs/render/contributions/render/text-render.js.map +1 -1
  195. package/cjs/render/render-modules.js +1 -1
  196. package/cjs/render/render-modules.js.map +1 -1
  197. package/cjs/render/render-service.js +1 -1
  198. package/cjs/render/render-service.js.map +1 -1
  199. package/dist/index.js +6447 -5470
  200. package/dist/index.min.js +1 -1
  201. package/es/allocator/canvas-allocate.d.ts +0 -4
  202. package/es/allocator/canvas-allocate.js +6 -19
  203. package/es/allocator/canvas-allocate.js.map +1 -1
  204. package/es/allocator/graphic-allocate.d.ts +1 -56
  205. package/es/allocator/graphic-allocate.js +1 -155
  206. package/es/allocator/graphic-allocate.js.map +1 -1
  207. package/es/animate/Ticker/default-ticker.js +1 -1
  208. package/es/animate/Ticker/default-ticker.js.map +1 -1
  209. package/es/animate/config.js +2 -1
  210. package/es/animate/custom-animate.js +1 -2
  211. package/es/common/Reflect-metadata.js +359 -349
  212. package/es/common/Reflect-metadata.js.map +1 -1
  213. package/es/common/bezier-utils.js +1 -2
  214. package/es/common/inversify-lite/annotation/post_construct.d.ts +4 -0
  215. package/es/common/inversify-lite/annotation/post_construct.js +10 -0
  216. package/es/common/inversify-lite/annotation/post_construct.js.map +1 -0
  217. package/es/common/inversify-lite/container/container.js +4 -2
  218. package/es/common/inversify-lite/container/container.js.map +1 -1
  219. package/es/common/inversify-lite/index.d.ts +8 -1
  220. package/es/common/inversify-lite/index.js +15 -1
  221. package/es/common/inversify-lite/index.js.map +1 -1
  222. package/es/common/inversify-lite/interfaces/interfaces.d.ts +2 -0
  223. package/es/common/inversify-lite/interfaces/interfaces.js.map +1 -1
  224. package/es/common/inversify-lite/planning/queryable_string.d.ts +2 -0
  225. package/es/common/inversify-lite/planning/queryable_string.js +10 -0
  226. package/es/common/inversify-lite/planning/queryable_string.js.map +1 -1
  227. package/es/common/inversify-lite/resolution/resolver.js.map +1 -1
  228. package/es/common/sort.js +2 -1
  229. package/es/common/split-path.js +1 -2
  230. package/es/core/contributions/layerHandler/canvas2d-contribution.d.ts +2 -2
  231. package/es/core/contributions/layerHandler/canvas2d-contribution.js +9 -5
  232. package/es/core/contributions/layerHandler/canvas2d-contribution.js.map +1 -1
  233. package/es/core/contributions/layerHandler/empty-contribution.d.ts +2 -2
  234. package/es/core/contributions/layerHandler/empty-contribution.js +9 -5
  235. package/es/core/contributions/layerHandler/empty-contribution.js.map +1 -1
  236. package/es/core/contributions/layerHandler/offscreen2d-contribution.d.ts +2 -2
  237. package/es/core/contributions/layerHandler/offscreen2d-contribution.js +9 -5
  238. package/es/core/contributions/layerHandler/offscreen2d-contribution.js.map +1 -1
  239. package/es/core/contributions/textMeasure/modules.js +1 -1
  240. package/es/core/contributions/textMeasure/modules.js.map +1 -1
  241. package/es/core/core-modules.js +6 -4
  242. package/es/core/core-modules.js.map +1 -1
  243. package/es/core/global.d.ts +0 -4
  244. package/es/core/global.js +4 -8
  245. package/es/core/global.js.map +1 -1
  246. package/es/core/graphic-utils.d.ts +4 -7
  247. package/es/core/graphic-utils.js +15 -20
  248. package/es/core/graphic-utils.js.map +1 -1
  249. package/es/core/layer-service.d.ts +2 -2
  250. package/es/core/layer-service.js +10 -6
  251. package/es/core/layer-service.js.map +1 -1
  252. package/es/core/stage.d.ts +4 -7
  253. package/es/core/stage.js +35 -41
  254. package/es/core/stage.js.map +1 -1
  255. package/es/core/window.d.ts +2 -2
  256. package/es/core/window.js +12 -8
  257. package/es/core/window.js.map +1 -1
  258. package/es/event/event-manager.js +2 -3
  259. package/es/event/event-manager.js.map +1 -1
  260. package/es/graphic/graphic-service/arc-contribution.d.ts +5 -1
  261. package/es/graphic/graphic-service/arc-contribution.js +15 -0
  262. package/es/graphic/graphic-service/arc-contribution.js.map +1 -1
  263. package/es/graphic/graphic-service/area-contribution.d.ts +1 -1
  264. package/es/graphic/graphic-service/area-contribution.js +1 -2
  265. package/es/graphic/graphic-service/area-contribution.js.map +1 -1
  266. package/es/graphic/graphic-service/circle-contribution.d.ts +5 -1
  267. package/es/graphic/graphic-service/circle-contribution.js +15 -0
  268. package/es/graphic/graphic-service/circle-contribution.js.map +1 -1
  269. package/es/graphic/graphic-service/common-contribution.js +14 -2
  270. package/es/graphic/graphic-service/common-contribution.js.map +1 -1
  271. package/es/graphic/graphic-service/graphic-module.js +23 -1
  272. package/es/graphic/graphic-service/graphic-module.js.map +1 -1
  273. package/es/graphic/graphic-service/graphic-service.d.ts +7 -2
  274. package/es/graphic/graphic-service/graphic-service.js +28 -19
  275. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  276. package/es/graphic/graphic-service/path-contribution.d.ts +5 -1
  277. package/es/graphic/graphic-service/path-contribution.js +15 -0
  278. package/es/graphic/graphic-service/path-contribution.js.map +1 -1
  279. package/es/graphic/graphic-service/rect-contribution.d.ts +5 -1
  280. package/es/graphic/graphic-service/rect-contribution.js +15 -0
  281. package/es/graphic/graphic-service/rect-contribution.js.map +1 -1
  282. package/es/graphic/graphic-service/symbol-contribution.d.ts +1 -0
  283. package/es/graphic/graphic-service/symbol-contribution.js +16 -2
  284. package/es/graphic/graphic-service/symbol-contribution.js.map +1 -1
  285. package/es/graphic/graphic.js +2 -3
  286. package/es/graphic/graphic.js.map +1 -1
  287. package/es/graphic/group.d.ts +0 -1
  288. package/es/graphic/group.js +1 -8
  289. package/es/graphic/group.js.map +1 -1
  290. package/es/graphic/symbol.js +4 -6
  291. package/es/graphic/symbol.js.map +1 -1
  292. package/es/graphic/theme.d.ts +4 -4
  293. package/es/graphic/theme.js +29 -26
  294. package/es/graphic/theme.js.map +1 -1
  295. package/es/index.d.ts +0 -2
  296. package/es/index.js +0 -4
  297. package/es/index.js.map +1 -1
  298. package/es/interface/allocator.d.ts +0 -1
  299. package/es/interface/allocator.js.map +1 -1
  300. package/es/interface/global.d.ts +0 -1
  301. package/es/interface/global.js.map +1 -1
  302. package/es/interface/render.d.ts +2 -2
  303. package/es/interface/render.js.map +1 -1
  304. package/es/interface/stage.d.ts +1 -2
  305. package/es/interface/stage.js.map +1 -1
  306. package/es/modules.d.ts +2 -1
  307. package/es/modules.js +4 -0
  308. package/es/modules.js.map +1 -1
  309. package/es/picker/global-picker-service.d.ts +2 -2
  310. package/es/picker/global-picker-service.js +9 -5
  311. package/es/picker/global-picker-service.js.map +1 -1
  312. package/es/picker/pick-modules.js +4 -1
  313. package/es/picker/pick-modules.js.map +1 -1
  314. package/es/picker/picker-service.d.ts +2 -2
  315. package/es/picker/picker-service.js +5 -5
  316. package/es/picker/picker-service.js.map +1 -1
  317. package/es/plugins/plugin-modules.js +2 -1
  318. package/es/plugins/plugin-modules.js.map +1 -1
  319. package/es/render/contributions/render/arc-render.js +0 -3
  320. package/es/render/contributions/render/arc-render.js.map +1 -1
  321. package/es/render/contributions/render/area-render.d.ts +0 -1
  322. package/es/render/contributions/render/area-render.js +5 -45
  323. package/es/render/contributions/render/area-render.js.map +1 -1
  324. package/es/render/contributions/render/base-render.d.ts +1 -1
  325. package/es/render/contributions/render/base-render.js +22 -15
  326. package/es/render/contributions/render/base-render.js.map +1 -1
  327. package/es/render/contributions/render/circle-render.js +0 -3
  328. package/es/render/contributions/render/circle-render.js.map +1 -1
  329. package/es/render/contributions/render/contributions/arc-contribution-render.d.ts +7 -3
  330. package/es/render/contributions/render/contributions/arc-contribution-render.js +32 -6
  331. package/es/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
  332. package/es/render/contributions/render/contributions/area-contribution-render.d.ts +4 -3
  333. package/es/render/contributions/render/contributions/area-contribution-render.js +23 -5
  334. package/es/render/contributions/render/contributions/area-contribution-render.js.map +1 -1
  335. package/es/render/contributions/render/contributions/base-contribution-render.d.ts +0 -2
  336. package/es/render/contributions/render/contributions/base-contribution-render.js +10 -6
  337. package/es/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  338. package/es/render/contributions/render/contributions/circle-contribution-render.d.ts +7 -3
  339. package/es/render/contributions/render/contributions/circle-contribution-render.js +32 -6
  340. package/es/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
  341. package/es/render/contributions/render/contributions/constants.d.ts +0 -1
  342. package/es/render/contributions/render/contributions/constants.js +0 -2
  343. package/es/render/contributions/render/contributions/constants.js.map +1 -1
  344. package/es/render/contributions/render/contributions/group-contribution-render.d.ts +0 -1
  345. package/es/render/contributions/render/contributions/group-contribution-render.js +13 -3
  346. package/es/render/contributions/render/contributions/group-contribution-render.js.map +1 -1
  347. package/es/render/contributions/render/contributions/image-contribution-render.d.ts +0 -1
  348. package/es/render/contributions/render/contributions/image-contribution-render.js +14 -4
  349. package/es/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
  350. package/es/render/contributions/render/contributions/path-contribution-render.d.ts +9 -2
  351. package/es/render/contributions/render/contributions/path-contribution-render.js +29 -3
  352. package/es/render/contributions/render/contributions/path-contribution-render.js.map +1 -1
  353. package/es/render/contributions/render/contributions/polygon-contribution-render.d.ts +9 -2
  354. package/es/render/contributions/render/contributions/polygon-contribution-render.js +29 -3
  355. package/es/render/contributions/render/contributions/polygon-contribution-render.js.map +1 -1
  356. package/es/render/contributions/render/contributions/rect-contribution-render.d.ts +7 -5
  357. package/es/render/contributions/render/contributions/rect-contribution-render.js +45 -15
  358. package/es/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  359. package/es/render/contributions/render/contributions/symbol-contribution-render.d.ts +7 -3
  360. package/es/render/contributions/render/contributions/symbol-contribution-render.js +24 -6
  361. package/es/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  362. package/es/render/contributions/render/draw-contribution.d.ts +6 -7
  363. package/es/render/contributions/render/draw-contribution.js +24 -35
  364. package/es/render/contributions/render/draw-contribution.js.map +1 -1
  365. package/es/render/contributions/render/draw-interceptor.d.ts +1 -9
  366. package/es/render/contributions/render/draw-interceptor.js +35 -38
  367. package/es/render/contributions/render/draw-interceptor.js.map +1 -1
  368. package/es/render/contributions/render/group-render.js +1 -4
  369. package/es/render/contributions/render/group-render.js.map +1 -1
  370. package/es/render/contributions/render/image-render.js +1 -3
  371. package/es/render/contributions/render/image-render.js.map +1 -1
  372. package/es/render/contributions/render/incremental-draw-contribution.d.ts +6 -2
  373. package/es/render/contributions/render/incremental-draw-contribution.js +11 -5
  374. package/es/render/contributions/render/incremental-draw-contribution.js.map +1 -1
  375. package/es/render/contributions/render/line-render.d.ts +0 -1
  376. package/es/render/contributions/render/line-render.js +6 -21
  377. package/es/render/contributions/render/line-render.js.map +1 -1
  378. package/es/render/contributions/render/module.js +83 -29
  379. package/es/render/contributions/render/module.js.map +1 -1
  380. package/es/render/contributions/render/path-render.d.ts +1 -2
  381. package/es/render/contributions/render/path-render.js +4 -8
  382. package/es/render/contributions/render/path-render.js.map +1 -1
  383. package/es/render/contributions/render/polygon-render.js +0 -3
  384. package/es/render/contributions/render/polygon-render.js.map +1 -1
  385. package/es/render/contributions/render/rect-render.d.ts +1 -2
  386. package/es/render/contributions/render/rect-render.js +3 -8
  387. package/es/render/contributions/render/rect-render.js.map +1 -1
  388. package/es/render/contributions/render/render-slector.d.ts +4 -1
  389. package/es/render/contributions/render/render-slector.js +15 -0
  390. package/es/render/contributions/render/render-slector.js.map +1 -1
  391. package/es/render/contributions/render/symbol-render.js +0 -3
  392. package/es/render/contributions/render/symbol-render.js.map +1 -1
  393. package/es/render/contributions/render/text-render.js +8 -10
  394. package/es/render/contributions/render/text-render.js.map +1 -1
  395. package/es/render/render-modules.js +1 -1
  396. package/es/render/render-modules.js.map +1 -1
  397. package/es/render/render-service.js +1 -1
  398. package/es/render/render-service.js.map +1 -1
  399. package/package.json +3 -5
  400. package/cjs/allocator/bounds-allocate.d.ts +0 -13
  401. package/cjs/allocator/bounds-allocate.js +0 -38
  402. package/cjs/allocator/bounds-allocate.js.map +0 -1
  403. package/cjs/common/inversify/annotation/inject.d.ts +0 -1
  404. package/cjs/common/inversify/annotation/inject.js +0 -10
  405. package/cjs/common/inversify/annotation/inject.js.map +0 -1
  406. package/cjs/common/inversify/annotation/inject_base.d.ts +0 -14
  407. package/cjs/common/inversify/annotation/inject_base.js +0 -39
  408. package/cjs/common/inversify/annotation/inject_base.js.map +0 -1
  409. package/cjs/common/inversify/annotation/injectable.d.ts +0 -1
  410. package/cjs/common/inversify/annotation/injectable.js.map +0 -1
  411. package/cjs/common/inversify/annotation/multi_inject.d.ts +0 -1
  412. package/cjs/common/inversify/annotation/multi_inject.js +0 -10
  413. package/cjs/common/inversify/annotation/multi_inject.js.map +0 -1
  414. package/cjs/common/inversify/annotation/named.d.ts +0 -1
  415. package/cjs/common/inversify/annotation/named.js +0 -14
  416. package/cjs/common/inversify/annotation/named.js.map +0 -1
  417. package/cjs/common/inversify/binding.d.ts +0 -18
  418. package/cjs/common/inversify/binding.js +0 -26
  419. package/cjs/common/inversify/binding.js.map +0 -1
  420. package/cjs/common/inversify/container.d.ts +0 -28
  421. package/cjs/common/inversify/container.js +0 -155
  422. package/cjs/common/inversify/container.js.map +0 -1
  423. package/cjs/common/inversify/cotainer-module.d.ts +0 -6
  424. package/cjs/common/inversify/cotainer-module.js +0 -16
  425. package/cjs/common/inversify/cotainer-module.js.map +0 -1
  426. package/cjs/common/inversify/index.d.ts +0 -7
  427. package/cjs/common/inversify/index.js +0 -75
  428. package/cjs/common/inversify/index.js.map +0 -1
  429. package/cjs/common/inversify/interfaces.d.ts +0 -218
  430. package/cjs/common/inversify/interfaces.js +0 -6
  431. package/cjs/common/inversify/interfaces.js.map +0 -1
  432. package/cjs/common/inversify/literal_types.d.ts +0 -5
  433. package/cjs/common/inversify/literal_types.js +0 -34
  434. package/cjs/common/inversify/literal_types.js.map +0 -1
  435. package/cjs/common/inversify/meta-data.d.ts +0 -6
  436. package/cjs/common/inversify/meta-data.js +0 -19
  437. package/cjs/common/inversify/meta-data.js.map +0 -1
  438. package/cjs/common/inversify/metadata_keys.d.ts +0 -12
  439. package/cjs/common/inversify/metadata_keys.js +0 -15
  440. package/cjs/common/inversify/metadata_keys.js.map +0 -1
  441. package/cjs/common/inversify/metadata_reader.d.ts +0 -6
  442. package/cjs/common/inversify/metadata_reader.js +0 -28
  443. package/cjs/common/inversify/metadata_reader.js.map +0 -1
  444. package/cjs/common/inversify/syntax/binding_in_syntax.d.ts +0 -10
  445. package/cjs/common/inversify/syntax/binding_in_syntax.js +0 -29
  446. package/cjs/common/inversify/syntax/binding_in_syntax.js.map +0 -1
  447. package/cjs/common/inversify/syntax/binding_to_syntax.d.ts +0 -12
  448. package/cjs/common/inversify/syntax/binding_to_syntax.js +0 -40
  449. package/cjs/common/inversify/syntax/binding_to_syntax.js.map +0 -1
  450. package/cjs/common/inversify/syntax/constraint_helpers.d.ts +0 -2
  451. package/cjs/common/inversify/syntax/constraint_helpers.js +0 -18
  452. package/cjs/common/inversify/syntax/constraint_helpers.js.map +0 -1
  453. package/es/allocator/bounds-allocate.d.ts +0 -13
  454. package/es/allocator/bounds-allocate.js +0 -32
  455. package/es/allocator/bounds-allocate.js.map +0 -1
  456. package/es/common/inversify/annotation/inject.d.ts +0 -1
  457. package/es/common/inversify/annotation/inject.js +0 -6
  458. package/es/common/inversify/annotation/inject.js.map +0 -1
  459. package/es/common/inversify/annotation/inject_base.d.ts +0 -14
  460. package/es/common/inversify/annotation/inject_base.js +0 -29
  461. package/es/common/inversify/annotation/inject_base.js.map +0 -1
  462. package/es/common/inversify/annotation/injectable.d.ts +0 -1
  463. package/es/common/inversify/annotation/injectable.js +0 -10
  464. package/es/common/inversify/annotation/injectable.js.map +0 -1
  465. package/es/common/inversify/annotation/multi_inject.d.ts +0 -1
  466. package/es/common/inversify/annotation/multi_inject.js +0 -6
  467. package/es/common/inversify/annotation/multi_inject.js.map +0 -1
  468. package/es/common/inversify/annotation/named.d.ts +0 -1
  469. package/es/common/inversify/annotation/named.js +0 -10
  470. package/es/common/inversify/annotation/named.js.map +0 -1
  471. package/es/common/inversify/binding.d.ts +0 -18
  472. package/es/common/inversify/binding.js +0 -22
  473. package/es/common/inversify/binding.js.map +0 -1
  474. package/es/common/inversify/container.d.ts +0 -28
  475. package/es/common/inversify/container.js +0 -155
  476. package/es/common/inversify/container.js.map +0 -1
  477. package/es/common/inversify/cotainer-module.d.ts +0 -6
  478. package/es/common/inversify/cotainer-module.js +0 -8
  479. package/es/common/inversify/cotainer-module.js.map +0 -1
  480. package/es/common/inversify/index.d.ts +0 -7
  481. package/es/common/inversify/index.js +0 -14
  482. package/es/common/inversify/index.js.map +0 -1
  483. package/es/common/inversify/interfaces.d.ts +0 -218
  484. package/es/common/inversify/interfaces.js +0 -2
  485. package/es/common/inversify/interfaces.js.map +0 -1
  486. package/es/common/inversify/literal_types.d.ts +0 -5
  487. package/es/common/inversify/literal_types.js +0 -20
  488. package/es/common/inversify/literal_types.js.map +0 -1
  489. package/es/common/inversify/meta-data.d.ts +0 -6
  490. package/es/common/inversify/meta-data.js +0 -11
  491. package/es/common/inversify/meta-data.js.map +0 -1
  492. package/es/common/inversify/metadata_keys.d.ts +0 -12
  493. package/es/common/inversify/metadata_keys.js +0 -28
  494. package/es/common/inversify/metadata_keys.js.map +0 -1
  495. package/es/common/inversify/metadata_reader.d.ts +0 -6
  496. package/es/common/inversify/metadata_reader.js +0 -18
  497. package/es/common/inversify/metadata_reader.js.map +0 -1
  498. package/es/common/inversify/syntax/binding_in_syntax.d.ts +0 -10
  499. package/es/common/inversify/syntax/binding_in_syntax.js +0 -24
  500. package/es/common/inversify/syntax/binding_in_syntax.js.map +0 -1
  501. package/es/common/inversify/syntax/binding_to_syntax.d.ts +0 -12
  502. package/es/common/inversify/syntax/binding_to_syntax.js +0 -36
  503. package/es/common/inversify/syntax/binding_to_syntax.js.map +0 -1
  504. package/es/common/inversify/syntax/constraint_helpers.d.ts +0 -2
  505. package/es/common/inversify/syntax/constraint_helpers.js +0 -16
  506. package/es/common/inversify/syntax/constraint_helpers.js.map +0 -1
@@ -1,10 +1,9 @@
1
- import type { IPath, IContext2d, IThemeAttribute, IGraphicAttribute, IMarkAttribute, IPathRenderContribution, IGraphicRender, IContributionProvider, IDrawContext, IGraphicRenderDrawParams, IRenderService, IPathGraphicAttribute } from '../../../interface';
1
+ import type { IPath, IContext2d, IThemeAttribute, IGraphicAttribute, IMarkAttribute, IPathRenderContribution, IGraphicRender, IContributionProvider, IDrawContext, IGraphicRenderDrawParams, IRenderService } from '../../../interface';
2
2
  import { BaseRender } from './base-render';
3
3
  export declare class DefaultCanvasPathRender extends BaseRender<IPath> implements IGraphicRender {
4
4
  protected readonly pathRenderContribitions: IContributionProvider<IPathRenderContribution>;
5
5
  type: 'path';
6
6
  numberType: number;
7
- tempTheme: Required<IPathGraphicAttribute>;
8
7
  constructor(pathRenderContribitions: IContributionProvider<IPathRenderContribution>);
9
8
  drawShape(path: IPath, context: IContext2d, x: number, y: number, drawContext: IDrawContext, params?: IGraphicRenderDrawParams, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
10
9
  draw(path: IPath, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams): void;
@@ -16,22 +16,20 @@ Object.defineProperty(exports, "__esModule", {
16
16
  value: !0
17
17
  }), exports.DefaultCanvasPathRender = void 0;
18
18
 
19
- const inversify_lite_1 = require("../../../common/inversify-lite"), contribution_provider_1 = require("../../../common/contribution-provider"), render_command_list_1 = require("../../../common/render-command-list"), theme_1 = require("../../../graphic/theme"), constants_1 = require("../../../graphic/constants"), constants_2 = require("./contributions/constants"), base_render_1 = require("./base-render"), path_contribution_render_1 = require("./contributions/path-contribution-render");
19
+ const inversify_lite_1 = require("../../../common/inversify-lite"), contribution_provider_1 = require("../../../common/contribution-provider"), render_command_list_1 = require("../../../common/render-command-list"), theme_1 = require("../../../graphic/theme"), constants_1 = require("../../../graphic/constants"), constants_2 = require("./contributions/constants"), base_render_1 = require("./base-render");
20
20
 
21
21
  let DefaultCanvasPathRender = class extends base_render_1.BaseRender {
22
22
  constructor(pathRenderContribitions) {
23
23
  super(), this.pathRenderContribitions = pathRenderContribitions, this.numberType = constants_1.PATH_NUMBER_TYPE,
24
- this.builtinContributions = [ path_contribution_render_1.defaultPathBackgroundRenderContribution, path_contribution_render_1.defaultPathTextureRenderContribution ],
25
24
  this.init(pathRenderContribitions);
26
25
  }
27
26
  drawShape(path, context, x, y, drawContext, params, fillCb, strokeCb) {
28
- var _a, _b, _c;
29
- const pathAttribute = null !== (_a = this.tempTheme) && void 0 !== _a ? _a : (0,
30
- theme_1.getTheme)(path, null == params ? void 0 : params.theme).path, {x: originX = pathAttribute.x, y: originY = pathAttribute.y} = path.attribute, z = null !== (_b = this.z) && void 0 !== _b ? _b : 0, data = this.valid(path, pathAttribute, fillCb, strokeCb);
27
+ var _a, _b;
28
+ const pathAttribute = (0, theme_1.getTheme)(path, null == params ? void 0 : params.theme).path, {x: originX = pathAttribute.x, y: originY = pathAttribute.y} = path.attribute, z = null !== (_a = this.z) && void 0 !== _a ? _a : 0, data = this.valid(path, pathAttribute, fillCb, strokeCb);
31
29
  if (!data) return;
32
30
  const {fVisible: fVisible, sVisible: sVisible, doFill: doFill, doStroke: doStroke} = data;
33
31
  if (context.beginPath(), path.pathShape) (0, render_command_list_1.renderCommandList)(path.pathShape.commandList, context, x, y, 1, 1, z); else {
34
- const path2D = null !== (_c = path.attribute.path) && void 0 !== _c ? _c : pathAttribute.path;
32
+ const path2D = null !== (_b = path.attribute.path) && void 0 !== _b ? _b : pathAttribute.path;
35
33
  (0, render_command_list_1.renderCommandList)(path2D.commandList, context, x, y, 1, 1, z);
36
34
  }
37
35
  context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute),
@@ -42,8 +40,7 @@ let DefaultCanvasPathRender = class extends base_render_1.BaseRender {
42
40
  }
43
41
  draw(path, renderService, drawContext, params) {
44
42
  const pathAttribute = (0, theme_1.getTheme)(path, null == params ? void 0 : params.theme).path;
45
- this.tempTheme = pathAttribute, this._draw(path, pathAttribute, !1, drawContext, params),
46
- this.tempTheme = null;
43
+ this._draw(path, pathAttribute, !1, drawContext, params);
47
44
  }
48
45
  };
49
46
 
@@ -1 +1 @@
1
- {"version":3,"sources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AAc,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,aAAa,CAAC,CAAC;gBACtF,OAAO,CAAC,IAAI,EAAE,CAAC;aAChB;SACF;QAED,IAAI,CAAC,eAAe,CAClB,IAAI,EACJ,OAAO,EACP,CAAC,EACD,CAAC,EACD,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,WAAW,EACX,MAAM,EACN,QAAQ,CACT,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,IAAW,EAAE,aAA6B,EAAE,WAAyB,EAAE,MAAiC;QAC3G,MAAM,aAAa,GAAG,IAAA,gBAAQ,EAAC,IAAI,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,IAAI,CAAC;QACzD,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC;QAC/B,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QAC5D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;CACF,CAAA;AA9GY,uBAAuB;IADnC,IAAA,2BAAU,GAAE;IAOR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,kCAAsB,CAAC,CAAA;;GAPrB,uBAAuB,CA8GnC;AA9GY,0DAAuB","file":"path-render.js","sourcesContent":["import { inject, injectable, named } from '../../../common/inversify-lite';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { renderCommandList } from '../../../common/render-command-list';\nimport type {\n IPath,\n ICustomPath2D,\n IContext2d,\n IThemeAttribute,\n IGraphicAttribute,\n IMarkAttribute,\n IPathRenderContribution,\n IGraphicRender,\n IContributionProvider,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService,\n IPathGraphicAttribute\n} from '../../../interface';\nimport { getTheme } from '../../../graphic/theme';\nimport { PATH_NUMBER_TYPE } from '../../../graphic/constants';\nimport { drawPathProxy, fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { PathRenderContribution } from './contributions/constants';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { BaseRender } from './base-render';\nimport { mat4Allocate } from '../../../allocator/matrix-allocate';\nimport {\n defaultPathBackgroundRenderContribution,\n defaultPathTextureRenderContribution\n} from './contributions/path-contribution-render';\n\n@injectable()\nexport class DefaultCanvasPathRender extends BaseRender<IPath> implements IGraphicRender {\n type: 'path';\n numberType: number = PATH_NUMBER_TYPE;\n tempTheme: Required<IPathGraphicAttribute>;\n\n constructor(\n @inject(ContributionProvider)\n @named(PathRenderContribution)\n protected readonly pathRenderContribitions: IContributionProvider<IPathRenderContribution>\n ) {\n super();\n this.builtinContributions = [defaultPathBackgroundRenderContribution, defaultPathTextureRenderContribution];\n this.init(pathRenderContribitions);\n }\n\n drawShape(\n path: IPath,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n // const pathAttribute = graphicService.themeService.getCurrentTheme().pathAttribute;\n const pathAttribute = this.tempTheme ?? getTheme(path, params?.theme).path;\n const { x: originX = pathAttribute.x, y: originY = pathAttribute.y } = path.attribute;\n\n const z = this.z ?? 0;\n\n const data = this.valid(path, pathAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n context.beginPath();\n if (path.pathShape) {\n renderCommandList((path.pathShape as ICustomPath2D).commandList, context, x, y, 1, 1, z);\n } else {\n const path2D = path.attribute.path ?? pathAttribute.path;\n renderCommandList((path2D as ICustomPath2D).commandList, context, x, y, 1, 1, z);\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute);\n\n this.beforeRenderStep(\n path,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n pathAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, path.attribute, pathAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(path, path.attribute, originX - x, originY - y, pathAttribute);\n context.stroke();\n }\n }\n if (doFill) {\n if (fillCb) {\n fillCb(context, path.attribute, pathAttribute);\n } else if (fVisible) {\n context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute);\n context.fill();\n }\n }\n\n this.afterRenderStep(\n path,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n pathAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(path: IPath, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const pathAttribute = getTheme(path, params?.theme).path;\n this.tempTheme = pathAttribute;\n this._draw(path, pathAttribute, false, drawContext, params);\n this.tempTheme = null;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/path-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAA2E;AAE3E,iFAA6E;AAC7E,6EAAwE;AAexE,kDAAkD;AAClD,0DAA8D;AAE9D,yDAAmE;AAEnE,+CAA2C;AAIpC,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,wBAAiB;IAI5D,YAGqB,uBAAuE;QAE1F,KAAK,EAAE,CAAC;QAFW,4BAAuB,GAAvB,uBAAuB,CAAgD;QAL5F,eAAU,GAAW,4BAAgB,CAAC;QAQpC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACrC,CAAC;IAED,SAAS,CACP,IAAW,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,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;CACF,CAAA;AA1GY,uBAAuB;IADnC,IAAA,2BAAU,GAAE;IAMR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,kCAAsB,CAAC,CAAA;;GANrB,uBAAuB,CA0GnC;AA1GY,0DAAuB","file":"path-render.js","sourcesContent":["import { inject, injectable, named } from '../../../common/inversify-lite';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { renderCommandList } from '../../../common/render-command-list';\nimport type {\n IPath,\n ICustomPath2D,\n IContext2d,\n IThemeAttribute,\n IGraphicAttribute,\n IMarkAttribute,\n IPathRenderContribution,\n IGraphicRender,\n IContributionProvider,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService\n} from '../../../interface';\nimport { getTheme } from '../../../graphic/theme';\nimport { PATH_NUMBER_TYPE } from '../../../graphic/constants';\nimport { drawPathProxy, fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { PathRenderContribution } from './contributions/constants';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { BaseRender } from './base-render';\nimport { mat4Allocate } from '../../../allocator/matrix-allocate';\n\n@injectable()\nexport class DefaultCanvasPathRender extends BaseRender<IPath> implements IGraphicRender {\n type: 'path';\n numberType: number = PATH_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(PathRenderContribution)\n protected readonly pathRenderContribitions: IContributionProvider<IPathRenderContribution>\n ) {\n super();\n this.init(pathRenderContribitions);\n }\n\n drawShape(\n path: IPath,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n // const pathAttribute = graphicService.themeService.getCurrentTheme().pathAttribute;\n const pathAttribute = getTheme(path, params?.theme).path;\n const { x: originX = pathAttribute.x, y: originY = pathAttribute.y } = path.attribute;\n\n const z = this.z ?? 0;\n\n const data = this.valid(path, pathAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n context.beginPath();\n if (path.pathShape) {\n renderCommandList((path.pathShape as ICustomPath2D).commandList, context, x, y, 1, 1, z);\n } else {\n const path2D = path.attribute.path ?? pathAttribute.path;\n renderCommandList((path2D as ICustomPath2D).commandList, context, x, y, 1, 1, z);\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute);\n\n this.beforeRenderStep(\n path,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n pathAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, path.attribute, pathAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(path, path.attribute, originX - x, originY - y, pathAttribute);\n context.stroke();\n }\n }\n if (doFill) {\n if (fillCb) {\n fillCb(context, path.attribute, pathAttribute);\n } else if (fVisible) {\n context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute);\n context.fill();\n }\n }\n\n this.afterRenderStep(\n path,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n pathAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(path: IPath, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const pathAttribute = getTheme(path, params?.theme).path;\n this._draw(path, pathAttribute, false, drawContext, params);\n }\n}\n"]}
@@ -16,12 +16,11 @@ Object.defineProperty(exports, "__esModule", {
16
16
  value: !0
17
17
  }), exports.DefaultCanvasPolygonRender = void 0;
18
18
 
19
- const vutils_1 = require("@visactor/vutils"), inversify_lite_1 = require("../../../common/inversify-lite"), theme_1 = require("../../../graphic/theme"), constants_1 = require("../../../graphic/constants"), polygon_1 = require("../../../common/polygon"), constants_2 = require("./contributions/constants"), contribution_provider_1 = require("../../../common/contribution-provider"), base_render_1 = require("./base-render"), polygon_contribution_render_1 = require("./contributions/polygon-contribution-render");
19
+ const vutils_1 = require("@visactor/vutils"), inversify_lite_1 = require("../../../common/inversify-lite"), theme_1 = require("../../../graphic/theme"), constants_1 = require("../../../graphic/constants"), polygon_1 = require("../../../common/polygon"), constants_2 = require("./contributions/constants"), contribution_provider_1 = require("../../../common/contribution-provider"), base_render_1 = require("./base-render");
20
20
 
21
21
  let DefaultCanvasPolygonRender = class extends base_render_1.BaseRender {
22
22
  constructor(polygonRenderContribitions) {
23
23
  super(), this.polygonRenderContribitions = polygonRenderContribitions, this.numberType = constants_1.POLYGON_NUMBER_TYPE,
24
- this.builtinContributions = [ polygon_contribution_render_1.defaultPolygonBackgroundRenderContribution, polygon_contribution_render_1.defaultPolygonTextureRenderContribution ],
25
24
  this.init(polygonRenderContribitions);
26
25
  }
27
26
  drawShape(polygon, context, x, y, drawContext, params, fillCb, strokeCb) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/polygon-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA2C;AAC3C,mEAA2E;AAC3E,kDAAkD;AAClD,0DAAiE;AAcjE,qDAA0E;AAE1E,yDAAsE;AAEtE,iFAA6E;AAE7E,+CAA2C;AAC3C,6FAGqD;AAG9C,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,wBAAoB;IAIlE,YAGqB,0BAA6E;QAEhG,KAAK,EAAE,CAAC;QAFW,+BAA0B,GAA1B,0BAA0B,CAAmD;QALlG,eAAU,GAAW,+BAAmB,CAAC;QAQvC,IAAI,CAAC,oBAAoB,GAAG,CA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OAAO,EACP,CAAC,EACD,CAAC,EACD,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,MAAM,EACN,QAAQ,CACT,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,OAAiB,EAAE,aAA6B,EAAE,WAAyB,EAAE,MAAiC;QACjH,MAAM,gBAAgB,GAAG,IAAA,gBAAQ,EAAC,OAAO,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,OAAO,CAAC;QAClE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC;CACF,CAAA;AApHY,0BAA0B;IADtC,IAAA,2BAAU,GAAE;IAMR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,qCAAyB,CAAC,CAAA;;GANxB,0BAA0B,CAoHtC;AApHY,gEAA0B","file":"polygon-render.js","sourcesContent":["import { isArray } from '@visactor/vutils';\nimport { inject, injectable, named } from '../../../common/inversify-lite';\nimport { getTheme } from '../../../graphic/theme';\nimport { POLYGON_NUMBER_TYPE } from '../../../graphic/constants';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IPolygon,\n IThemeAttribute,\n IGraphicRender,\n IPolygonRenderContribution,\n IContributionProvider,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService\n} from '../../../interface';\nimport { drawPolygon, drawRoundedPolygon } from '../../../common/polygon';\nimport { drawPathProxy, fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { PolygonRenderContribution } from './contributions/constants';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { BaseRender } from './base-render';\nimport {\n defaultPolygonBackgroundRenderContribution,\n defaultPolygonTextureRenderContribution\n} from './contributions/polygon-contribution-render';\n\n@injectable()\nexport class DefaultCanvasPolygonRender extends BaseRender<IPolygon> implements IGraphicRender {\n type: 'polygon';\n numberType: number = POLYGON_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(PolygonRenderContribution)\n protected readonly polygonRenderContribitions: IContributionProvider<IPolygonRenderContribution>\n ) {\n super();\n this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution];\n this.init(polygonRenderContribitions);\n }\n\n drawShape(\n polygon: IPolygon,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n // const polygonAttribute = graphicService.themeService.getCurrentTheme().polygonAttribute;\n const polygonAttribute = getTheme(polygon, params?.theme).polygon;\n const {\n points = polygonAttribute.points,\n cornerRadius = polygonAttribute.cornerRadius,\n x: originX = polygonAttribute.x,\n y: originY = polygonAttribute.y,\n closePath = polygonAttribute.closePath\n } = polygon.attribute;\n\n const data = this.valid(polygon, polygonAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n context.beginPath();\n\n if ((cornerRadius as number) <= 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n drawPolygon(context.camera ? context : context.nativeContext, points, x, y);\n } else {\n // FIXME: type\n drawRoundedPolygon(context.camera ? context : context.nativeContext, points, x, y, cornerRadius, closePath);\n }\n // polygon 默认闭合\n closePath && context.closePath();\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(polygon, polygon.attribute, polygonAttribute);\n\n this.beforeRenderStep(\n polygon,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n polygonAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n\n if (doFill) {\n if (fillCb) {\n fillCb(context, polygon.attribute, polygonAttribute);\n } else if (fVisible) {\n // 存在fill\n context.setCommonStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute);\n context.fill();\n }\n }\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, polygon.attribute, polygonAttribute);\n } else if (sVisible) {\n // 存在stroke\n context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute);\n context.stroke();\n }\n }\n\n this.afterRenderStep(\n polygon,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n polygonAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(polygon: IPolygon, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const polygonAttribute = getTheme(polygon, params?.theme).polygon;\n this._draw(polygon, polygonAttribute, false, drawContext, params);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/polygon-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA2C;AAC3C,mEAA2E;AAC3E,kDAAkD;AAClD,0DAAiE;AAcjE,qDAA0E;AAE1E,yDAAsE;AAEtE,iFAA6E;AAE7E,+CAA2C;AAGpC,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,wBAAoB;IAIlE,YAGqB,0BAA6E;QAEhG,KAAK,EAAE,CAAC;QAFW,+BAA0B,GAA1B,0BAA0B,CAAmD;QALlG,eAAU,GAAW,+BAAmB,CAAC;QAQvC,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IACxC,CAAC;IAED,SAAS,CACP,OAAiB,EACjB,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ,QAIY;QAGZ,MAAM,gBAAgB,GAAG,IAAA,gBAAQ,E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AC,OAAO,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,OAAO,CAAC;QAClE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC;CACF,CAAA;AAnHY,0BAA0B;IADtC,IAAA,2BAAU,GAAE;IAMR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,qCAAyB,CAAC,CAAA;;GANxB,0BAA0B,CAmHtC;AAnHY,gEAA0B","file":"polygon-render.js","sourcesContent":["import { isArray } from '@visactor/vutils';\nimport { inject, injectable, named } from '../../../common/inversify-lite';\nimport { getTheme } from '../../../graphic/theme';\nimport { POLYGON_NUMBER_TYPE } from '../../../graphic/constants';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IPolygon,\n IThemeAttribute,\n IGraphicRender,\n IPolygonRenderContribution,\n IContributionProvider,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService\n} from '../../../interface';\nimport { drawPolygon, drawRoundedPolygon } from '../../../common/polygon';\nimport { drawPathProxy, fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport { PolygonRenderContribution } from './contributions/constants';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { BaseRender } from './base-render';\n\n@injectable()\nexport class DefaultCanvasPolygonRender extends BaseRender<IPolygon> implements IGraphicRender {\n type: 'polygon';\n numberType: number = POLYGON_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(PolygonRenderContribution)\n protected readonly polygonRenderContribitions: IContributionProvider<IPolygonRenderContribution>\n ) {\n super();\n this.init(polygonRenderContribitions);\n }\n\n drawShape(\n polygon: IPolygon,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n // const polygonAttribute = graphicService.themeService.getCurrentTheme().polygonAttribute;\n const polygonAttribute = getTheme(polygon, params?.theme).polygon;\n const {\n points = polygonAttribute.points,\n cornerRadius = polygonAttribute.cornerRadius,\n x: originX = polygonAttribute.x,\n y: originY = polygonAttribute.y,\n closePath = polygonAttribute.closePath\n } = polygon.attribute;\n\n const data = this.valid(polygon, polygonAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n context.beginPath();\n\n if ((cornerRadius as number) <= 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n drawPolygon(context.camera ? context : context.nativeContext, points, x, y);\n } else {\n // FIXME: type\n drawRoundedPolygon(context.camera ? context : context.nativeContext, points, x, y, cornerRadius, closePath);\n }\n // polygon 默认闭合\n closePath && context.closePath();\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(polygon, polygon.attribute, polygonAttribute);\n\n this.beforeRenderStep(\n polygon,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n polygonAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n\n if (doFill) {\n if (fillCb) {\n fillCb(context, polygon.attribute, polygonAttribute);\n } else if (fVisible) {\n // 存在fill\n context.setCommonStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute);\n context.fill();\n }\n }\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, polygon.attribute, polygonAttribute);\n } else if (sVisible) {\n // 存在stroke\n context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute);\n context.stroke();\n }\n }\n\n this.afterRenderStep(\n polygon,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n polygonAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(polygon: IPolygon, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const polygonAttribute = getTheme(polygon, params?.theme).polygon;\n this._draw(polygon, polygonAttribute, false, drawContext, params);\n }\n}\n"]}
@@ -1,10 +1,9 @@
1
- import type { IGraphicAttribute, IContext2d, IMarkAttribute, IRect, IThemeAttribute, IGraphicRender, IDrawContext, IGraphicRenderDrawParams, IRenderService, IRectRenderContribution, IContributionProvider, IRectGraphicAttribute } from '../../../interface';
1
+ import type { IGraphicAttribute, IContext2d, IMarkAttribute, IRect, IThemeAttribute, IGraphicRender, IDrawContext, IGraphicRenderDrawParams, IRenderService, IRectRenderContribution, IContributionProvider } from '../../../interface';
2
2
  import { BaseRender } from './base-render';
3
3
  export declare class DefaultCanvasRectRender extends BaseRender<IRect> implements IGraphicRender {
4
4
  protected readonly rectRenderContribitions: IContributionProvider<IRectRenderContribution>;
5
5
  type: string;
6
6
  numberType: number;
7
- tempTheme: Required<IRectGraphicAttribute>;
8
7
  constructor(rectRenderContribitions: IContributionProvider<IRectRenderContribution>);
9
8
  drawShape(rect: IRect, context: IContext2d, x: number, y: number, drawContext: IDrawContext, params?: IGraphicRenderDrawParams, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
10
9
  draw(rect: IRect, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams): void;
@@ -16,18 +16,15 @@ Object.defineProperty(exports, "__esModule", {
16
16
  value: !0
17
17
  }), exports.DefaultCanvasRectRender = void 0;
18
18
 
19
- const vutils_1 = require("@visactor/vutils"), inversify_lite_1 = require("../../../common/inversify-lite"), theme_1 = require("../../../graphic/theme"), constants_1 = require("../../../graphic/constants"), rect_1 = require("../../../common/shape/rect"), contribution_provider_1 = require("../../../common/contribution-provider"), constants_2 = require("./contributions/constants"), utils_1 = require("./utils"), base_render_1 = require("./base-render"), contributions_1 = require("./contributions");
19
+ const vutils_1 = require("@visactor/vutils"), inversify_lite_1 = require("../../../common/inversify-lite"), theme_1 = require("../../../graphic/theme"), constants_1 = require("../../../graphic/constants"), rect_1 = require("../../../common/shape/rect"), contribution_provider_1 = require("../../../common/contribution-provider"), constants_2 = require("./contributions/constants"), utils_1 = require("./utils"), base_render_1 = require("./base-render");
20
20
 
21
21
  let DefaultCanvasRectRender = class extends base_render_1.BaseRender {
22
22
  constructor(rectRenderContribitions) {
23
23
  super(), this.rectRenderContribitions = rectRenderContribitions, this.type = "rect",
24
- this.numberType = constants_1.RECT_NUMBER_TYPE, this.builtinContributions = [ contributions_1.defaultRectRenderContribution, contributions_1.defaultRectBackgroundRenderContribution, contributions_1.defaultRectTextureRenderContribution, contributions_1.splitRectAfterRenderContribution, contributions_1.splitRectBeforeRenderContribution ],
25
- this.init(rectRenderContribitions);
24
+ this.numberType = constants_1.RECT_NUMBER_TYPE, this.init(rectRenderContribitions);
26
25
  }
27
26
  drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
28
- var _a;
29
- const rectAttribute = null !== (_a = this.tempTheme) && void 0 !== _a ? _a : (0,
30
- theme_1.getTheme)(rect, null == params ? void 0 : params.theme).rect, {fill: fill = rectAttribute.fill, background: background, stroke: stroke = rectAttribute.stroke, width: width = rectAttribute.width, height: height = rectAttribute.height, cornerRadius: cornerRadius = rectAttribute.cornerRadius, opacity: opacity = rectAttribute.opacity, fillOpacity: fillOpacity = rectAttribute.fillOpacity, lineWidth: lineWidth = rectAttribute.lineWidth, strokeOpacity: strokeOpacity = rectAttribute.strokeOpacity, visible: visible = rectAttribute.visible, x: originX = rectAttribute.x, y: originY = rectAttribute.y} = rect.attribute, fVisible = (0,
27
+ const rectAttribute = (0, theme_1.getTheme)(rect, null == params ? void 0 : params.theme).rect, {fill: fill = rectAttribute.fill, background: background, stroke: stroke = rectAttribute.stroke, width: width = rectAttribute.width, height: height = rectAttribute.height, cornerRadius: cornerRadius = rectAttribute.cornerRadius, opacity: opacity = rectAttribute.opacity, fillOpacity: fillOpacity = rectAttribute.fillOpacity, lineWidth: lineWidth = rectAttribute.lineWidth, strokeOpacity: strokeOpacity = rectAttribute.strokeOpacity, visible: visible = rectAttribute.visible, x: originX = rectAttribute.x, y: originY = rectAttribute.y} = rect.attribute, fVisible = (0,
31
28
  utils_1.rectFillVisible)(opacity, fillOpacity, width, height, fill), sVisible = (0,
32
29
  utils_1.rectStrokeVisible)(opacity, strokeOpacity, width, height), doFill = (0,
33
30
  utils_1.runFill)(fill, background), doStroke = (0, utils_1.runStroke)(stroke, lineWidth);
@@ -48,8 +45,7 @@ let DefaultCanvasRectRender = class extends base_render_1.BaseRender {
48
45
  }
49
46
  draw(rect, renderService, drawContext, params) {
50
47
  const rectAttribute = (0, theme_1.getTheme)(rect, null == params ? void 0 : params.theme).rect;
51
- this.tempTheme = rectAttribute, this._draw(rect, rectAttribute, !1, drawContext, params),
52
- this.tempTheme = null;
48
+ this._draw(rect, rectAttribute, !1, drawContext, params);
53
49
  }
54
50
  };
55
51
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/rect-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA2C;AAC3C,mEAA2E;AAC3E,kDAAkD;AAClD,0DAA8D;AAC9D,qDAA4D;AAE5D,iFAA6E;AAe7E,yDAAmE;AACnE,mCAAiF;AACjF,+CAA2C;AAC3C,mDAMyB;AAGlB,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,wBAAiB;IAK5D,YAGqB,uBAAuE;QAE1F,KAAK,EAAE,CAAC;QAFW,4BAAuB,GAAvB,uBAAuB,CAAgD;QAP5F,SAAI,GAAG,MAAM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,CAAC;CACF,CAAA;AAvJY,uBAAuB;IADnC,IAAA,2BAAU,GAAE;IAOR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,kCAAsB,CAAC,CAAA;;GAPrB,uBAAuB,CAuJnC;AAvJY,0DAAuB","file":"rect-render.js","sourcesContent":["import { isArray } from '@visactor/vutils';\nimport { inject, injectable, named } from '../../../common/inversify-lite';\nimport { getTheme } from '../../../graphic/theme';\nimport { RECT_NUMBER_TYPE } from '../../../graphic/constants';\nimport { createRectPath } from '../../../common/shape/rect';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IRect,\n IThemeAttribute,\n IGraphicRender,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService,\n IRectRenderContribution,\n IContributionProvider,\n IRectGraphicAttribute\n} from '../../../interface';\nimport { RectRenderContribution } from './contributions/constants';\nimport { rectFillVisible, rectStrokeVisible, runFill, runStroke } from './utils';\nimport { BaseRender } from './base-render';\nimport {\n defaultRectBackgroundRenderContribution,\n defaultRectRenderContribution,\n defaultRectTextureRenderContribution,\n splitRectAfterRenderContribution,\n splitRectBeforeRenderContribution\n} from './contributions';\n\n@injectable()\nexport class DefaultCanvasRectRender extends BaseRender<IRect> implements IGraphicRender {\n type = 'rect';\n numberType: number = RECT_NUMBER_TYPE;\n tempTheme: Required<IRectGraphicAttribute>;\n\n constructor(\n @inject(ContributionProvider)\n @named(RectRenderContribution)\n protected readonly rectRenderContribitions: IContributionProvider<IRectRenderContribution>\n ) {\n super();\n this.builtinContributions = [\n defaultRectRenderContribution,\n defaultRectBackgroundRenderContribution,\n defaultRectTextureRenderContribution,\n splitRectAfterRenderContribution,\n splitRectBeforeRenderContribution\n ];\n this.init(rectRenderContribitions);\n }\n\n drawShape(\n rect: IRect,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n const rectAttribute = this.tempTheme ?? getTheme(rect, params?.theme).rect;\n const {\n fill = rectAttribute.fill,\n background,\n stroke = rectAttribute.stroke,\n width = rectAttribute.width,\n height = rectAttribute.height,\n cornerRadius = rectAttribute.cornerRadius,\n opacity = rectAttribute.opacity,\n fillOpacity = rectAttribute.fillOpacity,\n lineWidth = rectAttribute.lineWidth,\n strokeOpacity = rectAttribute.strokeOpacity,\n visible = rectAttribute.visible,\n x: originX = rectAttribute.x,\n y: originY = rectAttribute.y\n } = rect.attribute;\n\n // 不绘制或者透明\n const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill);\n const sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height);\n const doFill = runFill(fill, background);\n const doStroke = runStroke(stroke, lineWidth);\n\n if (!(rect.valid && visible)) {\n return;\n }\n\n if (!(doFill || doStroke)) {\n return;\n }\n\n // 如果存在fillCb和strokeCb,那就不直接跳过\n if (!(fVisible || sVisible || fillCb || strokeCb || background)) {\n return;\n }\n\n if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n context.beginPath();\n context.rect(x, y, width, height);\n } else {\n context.beginPath();\n\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache\n createRectPath(context, x, y, width, height, cornerRadius);\n }\n\n const doFillOrStroke = {\n doFill,\n doStroke\n };\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute);\n\n this.beforeRenderStep(\n rect,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n rectAttribute,\n drawContext,\n fillCb,\n strokeCb,\n doFillOrStroke\n );\n\n if (doFillOrStroke.doFill) {\n if (fillCb) {\n fillCb(context, rect.attribute, rectAttribute);\n } else if (fVisible) {\n // 存在fill\n context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute);\n context.fill();\n }\n }\n if (doFillOrStroke.doStroke) {\n if (strokeCb) {\n strokeCb(context, rect.attribute, rectAttribute);\n } else if (sVisible) {\n // 存在stroke\n context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute);\n context.stroke();\n }\n }\n\n this.afterRenderStep(\n rect,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n rectAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(rect: IRect, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const rectAttribute = getTheme(rect, params?.theme).rect;\n this.tempTheme = rectAttribute;\n this._draw(rect, rectAttribute, false, drawContext, params);\n this.tempTheme = null;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/rect-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA2C;AAC3C,mEAA2E;AAC3E,kDAAkD;AAClD,0DAA8D;AAC9D,qDAA4D;AAE5D,iFAA6E;AAc7E,yDAAmE;AACnE,mCAAiF;AACjF,+CAA2C;AAGpC,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,wBAAiB;IAI5D,YAGqB,uBAAuE;QAE1F,KAAK,EAAE,CAAC;QAFW,4BAAuB,GAAvB,uBAAuB,CAAgD;QAN5F,SAAI,GAAG,MAAM,CAAC;QACd,eAAU,GAAW,4BAAgB,CAAC;QAQpC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACrC,CAAC;IAED,SAAS,CACP,IAAW,EACX,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ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,EAAE;YAC3B,IAAI,QAAQ,EAAE;gBACZ,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;aAClD;iBAAM,IAAI,QAAQ,EAAE;gBAEnB,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,aAAa,CAAC,CAAC;gBACtF,OAAO,CAAC,MAAM,EAAE,CAAC;aAClB;SACF;QAED,IAAI,CAAC,eAAe,CAClB,IAAI,EACJ,OAAO,EACP,CAAC,EACD,CAAC,EACD,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,WAAW,EACX,MAAM,EACN,QAAQ,CACT,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,IAAW,EAAE,aAA6B,EAAE,WAAyB,EAAE,MAAiC;QAC3G,MAAM,aAAa,GAAG,IAAA,gBAAQ,EAAC,IAAI,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,IAAI,CAAC;QACzD,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;CACF,CAAA;AA9IY,uBAAuB;IADnC,IAAA,2BAAU,GAAE;IAMR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,kCAAsB,CAAC,CAAA;;GANrB,uBAAuB,CA8InC;AA9IY,0DAAuB","file":"rect-render.js","sourcesContent":["import { isArray } from '@visactor/vutils';\nimport { inject, injectable, named } from '../../../common/inversify-lite';\nimport { getTheme } from '../../../graphic/theme';\nimport { RECT_NUMBER_TYPE } from '../../../graphic/constants';\nimport { createRectPath } from '../../../common/shape/rect';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IRect,\n IThemeAttribute,\n IGraphicRender,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService,\n IRectRenderContribution,\n IContributionProvider\n} from '../../../interface';\nimport { RectRenderContribution } from './contributions/constants';\nimport { rectFillVisible, rectStrokeVisible, runFill, runStroke } from './utils';\nimport { BaseRender } from './base-render';\n\n@injectable()\nexport class DefaultCanvasRectRender extends BaseRender<IRect> implements IGraphicRender {\n type = 'rect';\n numberType: number = RECT_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(RectRenderContribution)\n protected readonly rectRenderContribitions: IContributionProvider<IRectRenderContribution>\n ) {\n super();\n this.init(rectRenderContribitions);\n }\n\n drawShape(\n rect: IRect,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n // const rectAttribute = graphicService.themeService.getCurrentTheme().rectAttribute;\n const rectAttribute = getTheme(rect, params?.theme).rect;\n const {\n fill = rectAttribute.fill,\n background,\n stroke = rectAttribute.stroke,\n width = rectAttribute.width,\n height = rectAttribute.height,\n cornerRadius = rectAttribute.cornerRadius,\n opacity = rectAttribute.opacity,\n fillOpacity = rectAttribute.fillOpacity,\n lineWidth = rectAttribute.lineWidth,\n strokeOpacity = rectAttribute.strokeOpacity,\n visible = rectAttribute.visible,\n x: originX = rectAttribute.x,\n y: originY = rectAttribute.y\n } = rect.attribute;\n\n // 不绘制或者透明\n const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill);\n const sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height);\n const doFill = runFill(fill, background);\n const doStroke = runStroke(stroke, lineWidth);\n\n if (!(rect.valid && visible)) {\n return;\n }\n\n if (!(doFill || doStroke)) {\n return;\n }\n\n // 如果存在fillCb和strokeCb,那就不直接跳过\n if (!(fVisible || sVisible || fillCb || strokeCb || background)) {\n return;\n }\n\n if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n context.beginPath();\n context.rect(x, y, width, height);\n } else {\n context.beginPath();\n\n // 测试后,cache对于重绘性能提升不大,但是在首屏有一定性能损耗,因此rect不再使用cache\n createRectPath(context, x, y, width, height, cornerRadius);\n }\n\n const doFillOrStroke = {\n doFill,\n doStroke\n };\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute);\n\n this.beforeRenderStep(\n rect,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n rectAttribute,\n drawContext,\n fillCb,\n strokeCb,\n doFillOrStroke\n );\n\n if (doFillOrStroke.doFill) {\n if (fillCb) {\n fillCb(context, rect.attribute, rectAttribute);\n } else if (fVisible) {\n // 存在fill\n context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute);\n context.fill();\n }\n }\n if (doFillOrStroke.doStroke) {\n if (strokeCb) {\n strokeCb(context, rect.attribute, rectAttribute);\n } else if (sVisible) {\n // 存在stroke\n context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute);\n context.stroke();\n }\n }\n\n this.afterRenderStep(\n rect,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n rectAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(rect: IRect, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const rectAttribute = getTheme(rect, params?.theme).rect;\n this._draw(rect, rectAttribute, false, drawContext, params);\n }\n}\n"]}
@@ -1 +1,4 @@
1
-
1
+ import type { IGraphic, IGraphicRender, IRenderSelector } from '../../../interface';
2
+ export declare abstract class DefaultRenderSelector implements IRenderSelector {
3
+ selector(graphic: IGraphic): IGraphicRender | null;
4
+ }
@@ -1,3 +1,23 @@
1
+ "use strict";
1
2
 
3
+ var __decorate = this && this.__decorate || function(decorators, target, key, desc) {
4
+ var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
5
+ if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
 
9
+ Object.defineProperty(exports, "__esModule", {
10
+ value: !0
11
+ }), exports.DefaultRenderSelector = void 0;
12
+
13
+ const inversify_lite_1 = require("../../../common/inversify-lite");
14
+
15
+ let DefaultRenderSelector = class {
16
+ selector(graphic) {
17
+ return null;
18
+ }
19
+ };
20
+
21
+ DefaultRenderSelector = __decorate([ (0, inversify_lite_1.injectable)() ], DefaultRenderSelector),
22
+ exports.DefaultRenderSelector = DefaultRenderSelector;
3
23
  //# sourceMappingURL=render-slector.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/render-slector.ts"],"names":[],"mappings":"","file":"render-slector.js","sourcesContent":["// import { injectable } from '../../../common/inversify-lite';\n// import type { IGraphic, IGraphicRender, IRenderSelector } from '../../../interface';\n\n// @injectable()\n// export class DefaultRenderSelector implements IRenderSelector {\n// selector(graphic: IGraphic): IGraphicRender | null {\n// return null;\n// }\n// }\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/render-slector.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mEAA4D;AAIrD,IAAe,qBAAqB,GAApC,MAAe,qBAAqB;IACzC,QAAQ,CAAC,OAAiB;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAJqB,qBAAqB;IAD1C,IAAA,2BAAU,GAAE;GACS,qBAAqB,CAI1C;AAJqB,sDAAqB","file":"render-slector.js","sourcesContent":["import { injectable } from '../../../common/inversify-lite';\nimport type { IGraphic, IGraphicRender, IRenderSelector } from '../../../interface';\n\n@injectable()\nexport abstract class DefaultRenderSelector implements IRenderSelector {\n selector(graphic: IGraphic): IGraphicRender | null {\n return null;\n }\n}\n"]}
@@ -16,12 +16,11 @@ Object.defineProperty(exports, "__esModule", {
16
16
  value: !0
17
17
  }), exports.DefaultCanvasSymbolRender = void 0;
18
18
 
19
- const inversify_lite_1 = require("../../../common/inversify-lite"), contribution_provider_1 = require("../../../common/contribution-provider"), theme_1 = require("../../../graphic/theme"), constants_1 = require("../../../graphic/constants"), base_render_1 = require("./base-render"), constants_2 = require("./contributions/constants"), contributions_1 = require("./contributions");
19
+ const inversify_lite_1 = require("../../../common/inversify-lite"), contribution_provider_1 = require("../../../common/contribution-provider"), theme_1 = require("../../../graphic/theme"), constants_1 = require("../../../graphic/constants"), base_render_1 = require("./base-render"), constants_2 = require("./contributions/constants");
20
20
 
21
21
  let DefaultCanvasSymbolRender = class extends base_render_1.BaseRender {
22
22
  constructor(symbolRenderContribitions) {
23
23
  super(), this.symbolRenderContribitions = symbolRenderContribitions, this.numberType = constants_1.SYMBOL_NUMBER_TYPE,
24
- this.builtinContributions = [ contributions_1.defaultSymbolRenderContribution, contributions_1.defaultSymbolBackgroundRenderContribution, contributions_1.defaultSymbolTextureRenderContribution ],
25
24
  this.init(symbolRenderContribitions);
26
25
  }
27
26
  drawShape(symbol, context, x, y, drawContext, params, fillCb, strokeCb) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/symbol-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,mEAA2E;AAE3E,iFAA6E;AAC7E,kDAAkD;AAClD,0DAAgE;AAehE,+CAA2C;AAE3C,yDAAqE;AAErE,mDAIyB;AAGlB,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ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;CACF,CAAA;AAzLY,yBAAyB;IADrC,IAAA,2BAAU,GAAE;IAMR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,oCAAwB,CAAC,CAAA;;GANvB,yBAAyB,CAyLrC;AAzLY,8DAAyB","file":"symbol-render.js","sourcesContent":["import { mat4Allocate } from '../../../allocator/matrix-allocate';\nimport { inject, injectable, named } from '../../../common/inversify-lite';\n// eslint-disable-next-line\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { getTheme } from '../../../graphic/theme';\nimport { SYMBOL_NUMBER_TYPE } from '../../../graphic/constants';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n ISymbol,\n IThemeAttribute,\n ISymbolRenderContribution,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider\n} from '../../../interface';\nimport type {} from '../../render-service';\nimport { BaseRender } from './base-render';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { SymbolRenderContribution } from './contributions/constants';\nimport { drawPathProxy, fillVisible, runFill, runStroke, strokeVisible } from './utils';\nimport {\n defaultSymbolBackgroundRenderContribution,\n defaultSymbolRenderContribution,\n defaultSymbolTextureRenderContribution\n} from './contributions';\n\n@injectable()\nexport class DefaultCanvasSymbolRender extends BaseRender<ISymbol> implements IGraphicRender {\n type: 'symbol';\n numberType: number = SYMBOL_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(SymbolRenderContribution)\n protected readonly symbolRenderContribitions: IContributionProvider<ISymbolRenderContribution>\n ) {\n super();\n this.builtinContributions = [\n defaultSymbolRenderContribution,\n defaultSymbolBackgroundRenderContribution,\n defaultSymbolTextureRenderContribution\n ];\n this.init(symbolRenderContribitions);\n }\n\n drawShape(\n symbol: ISymbol,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n // const symbolAttribute = graphicService.themeService.getCurrentTheme().symbolAttribute;\n const symbolAttribute = getTheme(symbol, params?.theme).symbol;\n\n const {\n size = symbolAttribute.size,\n x: originX = symbolAttribute.x,\n y: originY = symbolAttribute.y,\n scaleX = symbolAttribute.scaleX,\n scaleY = symbolAttribute.scaleY\n } = symbol.attribute;\n\n const data = this.valid(symbol, symbolAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n const parsedPath = symbol.getParsedPath();\n // todo: 考虑使用path\n if (!parsedPath) {\n return;\n }\n\n const { keepDirIn3d = symbolAttribute.keepDirIn3d } = symbol.attribute;\n const z = this.z ?? 0;\n context.beginPath();\n if (keepDirIn3d && context.camera && context.project) {\n const p = context.project(x, y, z);\n const camera = context.camera;\n context.camera = null;\n if (\n parsedPath.draw(context, size, p.x, p.y, undefined, (p, a) => {\n if (a.fill) {\n if (fillCb) {\n fillCb(context, symbol.attribute, symbolAttribute);\n } else {\n context.setCommonStyle(symbol, a, originX - x, originY - y);\n context.fill();\n }\n }\n if (a.stroke) {\n if (strokeCb) {\n strokeCb(context, symbol.attribute, symbolAttribute);\n } else {\n context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY);\n context.stroke();\n }\n }\n }) === false\n ) {\n context.closePath();\n }\n context.camera = camera;\n } else {\n if (\n parsedPath.draw(context, size, x, y, z, (p, a) => {\n if (a.fill) {\n if (fillCb) {\n fillCb(context, symbol.attribute, symbolAttribute);\n } else {\n context.setCommonStyle(symbol, a, originX - x, originY - y);\n context.fill();\n }\n }\n if (a.stroke) {\n if (strokeCb) {\n strokeCb(context, symbol.attribute, symbolAttribute);\n } else {\n context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY);\n context.stroke();\n }\n }\n }) === false\n ) {\n context.closePath();\n }\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute);\n\n this.beforeRenderStep(\n symbol,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n symbolAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n\n // if (fill !== false) {\n // context.setCommonStyle(symbol.attribute, symbolAttribute);\n // context.fill();\n // }\n // if (stroke !== false) {\n // context.setStrokeStyle(symbol.attribute, symbolAttribute);\n // context.stroke();\n // }\n\n // svg就不用fill和stroke了\n if (doFill && !parsedPath.isSvg) {\n if (fillCb) {\n fillCb(context, symbol.attribute, symbolAttribute);\n } else if (fVisible) {\n context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute);\n context.fill();\n }\n }\n if (doStroke && !parsedPath.isSvg) {\n if (strokeCb) {\n strokeCb(context, symbol.attribute, symbolAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(\n symbol,\n symbol.attribute,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n symbolAttribute\n );\n context.stroke();\n }\n }\n\n this.afterRenderStep(\n symbol,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n symbolAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(symbol: ISymbol, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const symbolAttribute = getTheme(symbol, params?.theme).symbol;\n this._draw(symbol, symbolAttribute, false, drawContext, params);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/symbol-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,mEAA2E;AAE3E,iFAA6E;AAC7E,kDAAkD;AAClD,0DAAgE;AAehE,+CAA2C;AAE3C,yDAAqE;AAI9D,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,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4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,oCAAwB,CAAC,CAAA;;GANvB,yBAAyB,CAoLrC;AApLY,8DAAyB","file":"symbol-render.js","sourcesContent":["import { mat4Allocate } from '../../../allocator/matrix-allocate';\nimport { inject, injectable, named } from '../../../common/inversify-lite';\n// eslint-disable-next-line\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { getTheme } from '../../../graphic/theme';\nimport { SYMBOL_NUMBER_TYPE } from '../../../graphic/constants';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n ISymbol,\n IThemeAttribute,\n ISymbolRenderContribution,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider\n} from '../../../interface';\nimport type {} from '../../render-service';\nimport { BaseRender } from './base-render';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { SymbolRenderContribution } from './contributions/constants';\nimport { drawPathProxy, fillVisible, runFill, runStroke, strokeVisible } from './utils';\n\n@injectable()\nexport class DefaultCanvasSymbolRender extends BaseRender<ISymbol> implements IGraphicRender {\n type: 'symbol';\n numberType: number = SYMBOL_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(SymbolRenderContribution)\n protected readonly symbolRenderContribitions: IContributionProvider<ISymbolRenderContribution>\n ) {\n super();\n this.init(symbolRenderContribitions);\n }\n\n drawShape(\n symbol: ISymbol,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n // const symbolAttribute = graphicService.themeService.getCurrentTheme().symbolAttribute;\n const symbolAttribute = getTheme(symbol, params?.theme).symbol;\n\n const {\n size = symbolAttribute.size,\n x: originX = symbolAttribute.x,\n y: originY = symbolAttribute.y,\n scaleX = symbolAttribute.scaleX,\n scaleY = symbolAttribute.scaleY\n } = symbol.attribute;\n\n const data = this.valid(symbol, symbolAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n const parsedPath = symbol.getParsedPath();\n // todo: 考虑使用path\n if (!parsedPath) {\n return;\n }\n\n const { keepDirIn3d = symbolAttribute.keepDirIn3d } = symbol.attribute;\n const z = this.z ?? 0;\n context.beginPath();\n if (keepDirIn3d && context.camera && context.project) {\n const p = context.project(x, y, z);\n const camera = context.camera;\n context.camera = null;\n if (\n parsedPath.draw(context, size, p.x, p.y, undefined, (p, a) => {\n if (a.fill) {\n if (fillCb) {\n fillCb(context, symbol.attribute, symbolAttribute);\n } else {\n context.setCommonStyle(symbol, a, originX - x, originY - y);\n context.fill();\n }\n }\n if (a.stroke) {\n if (strokeCb) {\n strokeCb(context, symbol.attribute, symbolAttribute);\n } else {\n context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY);\n context.stroke();\n }\n }\n }) === false\n ) {\n context.closePath();\n }\n context.camera = camera;\n } else {\n if (\n parsedPath.draw(context, size, x, y, z, (p, a) => {\n if (a.fill) {\n if (fillCb) {\n fillCb(context, symbol.attribute, symbolAttribute);\n } else {\n context.setCommonStyle(symbol, a, originX - x, originY - y);\n context.fill();\n }\n }\n if (a.stroke) {\n if (strokeCb) {\n strokeCb(context, symbol.attribute, symbolAttribute);\n } else {\n context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY);\n context.stroke();\n }\n }\n }) === false\n ) {\n context.closePath();\n }\n }\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute);\n\n this.beforeRenderStep(\n symbol,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n symbolAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n\n // if (fill !== false) {\n // context.setCommonStyle(symbol.attribute, symbolAttribute);\n // context.fill();\n // }\n // if (stroke !== false) {\n // context.setStrokeStyle(symbol.attribute, symbolAttribute);\n // context.stroke();\n // }\n\n // svg就不用fill和stroke了\n if (doFill && !parsedPath.isSvg) {\n if (fillCb) {\n fillCb(context, symbol.attribute, symbolAttribute);\n } else if (fVisible) {\n context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute);\n context.fill();\n }\n }\n if (doStroke && !parsedPath.isSvg) {\n if (strokeCb) {\n strokeCb(context, symbol.attribute, symbolAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(\n symbol,\n symbol.attribute,\n (originX - x) / scaleX,\n (originY - y) / scaleY,\n symbolAttribute\n );\n context.stroke();\n }\n }\n\n this.afterRenderStep(\n symbol,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n symbolAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(symbol: ISymbol, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const symbolAttribute = getTheme(symbol, params?.theme).symbol;\n this._draw(symbol, symbolAttribute, false, drawContext, params);\n }\n}\n"]}
@@ -25,7 +25,7 @@ let DefaultCanvasTextRender = class extends base_render_1.BaseRender {
25
25
  }
26
26
  drawShape(text, context, x, y, drawContext, params, fillCb, strokeCb) {
27
27
  var _a, _b, _c;
28
- const textAttribute = (0, theme_1.getTheme)(text, null == params ? void 0 : params.theme).text, {text: str, underline: underline = textAttribute.underline, lineThrough: lineThrough = textAttribute.lineThrough, keepDirIn3d: keepDirIn3d = textAttribute.keepDirIn3d, direction: direction = textAttribute.direction, fontSize: fontSize = textAttribute.fontSize, verticalMode: verticalMode = textAttribute.verticalMode, x: originX = textAttribute.x, y: originY = textAttribute.y} = text.attribute;
28
+ const textAttribute = (0, theme_1.getTheme)(text, null == params ? void 0 : params.theme).text, {text: str, fill: fill = textAttribute.fill, stroke: stroke = textAttribute.stroke, fillOpacity: fillOpacity = textAttribute.fillOpacity, strokeOpacity: strokeOpacity = textAttribute.strokeOpacity, opacity: opacity = textAttribute.opacity, lineWidth: lineWidth = textAttribute.lineWidth, visible: visible = textAttribute.visible, underline: underline = textAttribute.underline, lineThrough: lineThrough = textAttribute.lineThrough, keepDirIn3d: keepDirIn3d = textAttribute.keepDirIn3d, direction: direction = textAttribute.direction, fontSize: fontSize = textAttribute.fontSize, verticalMode: verticalMode = textAttribute.verticalMode, x: originX = textAttribute.x, y: originY = textAttribute.y} = text.attribute;
29
29
  let {textAlign: textAlign = textAttribute.textAlign, textBaseline: textBaseline = textAttribute.textBaseline} = text.attribute;
30
30
  if (!verticalMode && "vertical" === direction) {
31
31
  const t = textAlign;
@@ -66,7 +66,6 @@ let DefaultCanvasTextRender = class extends base_render_1.BaseRender {
66
66
  this.drawMultiUnderLine(underline, lineThrough, text, (line.leftOffset || 0) + x, (line.topOffset || 0) + yOffset + y, z, line.width, textAttribute, context);
67
67
  }))));
68
68
  } else {
69
- text.tryUpdateAABBBounds();
70
69
  const cache = text.cache, {verticalList: verticalList} = cache;
71
70
  context.textAlign = "left", context.textBaseline = "top";
72
71
  const totalHeight = lineHeight * verticalList.length;
@@ -88,16 +87,15 @@ let DefaultCanvasTextRender = class extends base_render_1.BaseRender {
88
87
  currentOffsetY += width;
89
88
  }));
90
89
  }));
91
- } else if ("horizontal" === direction) {
92
- context.setTextStyle(text.attribute, textAttribute, z);
93
- const t = text.clipedText;
94
- let dy = 0;
95
- lineHeight !== fontSize && ("top" === textBaseline ? dy = (lineHeight - fontSize) / 2 : "middle" === textBaseline || "bottom" === textBaseline && (dy = -(lineHeight - fontSize) / 2)),
96
- drawText(t, 0, dy, 0);
97
90
  } else {
98
- text.tryUpdateAABBBounds();
99
91
  const cache = text.cache;
100
- if (cache) {
92
+ if ("horizontal" === direction) {
93
+ context.setTextStyle(text.attribute, textAttribute, z);
94
+ const t = text.clipedText;
95
+ let dy = 0;
96
+ lineHeight !== fontSize && ("top" === textBaseline ? dy = (lineHeight - fontSize) / 2 : "middle" === textBaseline || "bottom" === textBaseline && (dy = -(lineHeight - fontSize) / 2)),
97
+ drawText(t, 0, dy, 0);
98
+ } else if (cache) {
101
99
  context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);
102
100
  const {verticalList: verticalList} = cache;
103
101
  let offsetY = 0;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/contributions/render/text-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAA2E;AAC3E,kDAAkD;AAClD,0DAA8D;AAa9D,+CAA0E;AAE1E,+CAA2C;AAC3C,iFAA6E;AAC7E,yDAAmE;AACnE,wEAAoE;AACpE,6CAAuC;AACvC,iDAA4D;AAGrD,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,wBAAiB;IAI5D,YAGqB,uBAAuE;QAE1F,KAAK,EAAE,CAAC;QAFW,4BAAuB,GAAvB,uBAAuB,CAAgD;QAL5F,eAAU,GAAW,4BAAgB,CAAC;QAQpC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACrC,CAAC;IAED,SAAS,CACP,IAAW,EACX,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ,QAIY;;QAEZ,MAAM,aAAa,GAAG,IAAA,gBAAQ,EAAC,IAAI,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,IAAI,CAAC;QACzD,MAAM,EACJ,IAAI,EAAE,GAAG,EACT,SAAS,GAAG,aAAa,CAAC,SAAS,EACnC,WAAW,GAAG,aAAa,CAAC,WAAW,EACvC,WAAW,GAAG,aAAa,CAAC,WAAW,EACvC,SAAS,GAAG,aAAa,CAAC,SAAS,EAEnC,QAAQ,GAAG,aAAa,CAAC,QAAQ,EACjC,YAAY,GAAG,aAAa,CAAC,YAAY,EACzC,CAAC,EA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AO,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YACvC,OAAO,CAAC,MAAM,EAAE,CAAC;SAClB;QACD,MAAM,GAAG,CAAC,CAAC,CAAC;QACZ,IAAI,WAAW,EAAE;YACf,SAAS,CAAC,SAAS,GAAG,WAAW,CAAC;YAClC,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;YAC7D,OAAO,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,GAAG,QAAQ,GAAG,CAAC,GAAG,MAAM,CAAC;YAC/C,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YACnC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YACvC,OAAO,CAAC,MAAM,EAAE,CAAC;SAClB;IACH,CAAC;CACF,CAAA;AArXY,uBAAuB;IADnC,IAAA,2BAAU,GAAE;IAMR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,kCAAsB,CAAC,CAAA;;GANrB,uBAAuB,CAqXnC;AArXY,0DAAuB","file":"text-render.js","sourcesContent":["import { inject, injectable, named } from '../../../common/inversify-lite';\nimport { getTheme } from '../../../graphic/theme';\nimport { TEXT_NUMBER_TYPE } from '../../../graphic/constants';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IThemeAttribute,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n ITextRenderContribution,\n IContributionProvider\n} from '../../../interface';\nimport { textDrawOffsetX, textLayoutOffsetY } from '../../../common/text';\nimport type { IText, ITextGraphicAttribute } from '../../../interface/graphic/text';\nimport { BaseRender } from './base-render';\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { TextRenderContribution } from './contributions/constants';\nimport { matrixAllocate } from '../../../allocator/matrix-allocate';\nimport { max } from '@visactor/vutils';\nimport { calculateLineHeight } from '../../../common/utils';\n\n@injectable()\nexport class DefaultCanvasTextRender extends BaseRender<IText> implements IGraphicRender {\n type: 'text';\n numberType: number = TEXT_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(TextRenderContribution)\n protected readonly textRenderContribitions: IContributionProvider<ITextRenderContribution>\n ) {\n super();\n this.init(textRenderContribitions);\n }\n\n drawShape(\n text: IText,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n const textAttribute = getTheme(text, params?.theme).text;\n const {\n text: str,\n underline = textAttribute.underline,\n lineThrough = textAttribute.lineThrough,\n keepDirIn3d = textAttribute.keepDirIn3d,\n direction = textAttribute.direction,\n // lineHeight = textAttribute.lineHeight,\n fontSize = textAttribute.fontSize,\n verticalMode = textAttribute.verticalMode,\n x: originX = textAttribute.x,\n y: originY = textAttribute.y\n } = text.attribute;\n\n let { textAlign = textAttribute.textAlign, textBaseline = textAttribute.textBaseline } = text.attribute;\n if (!verticalMode && direction === 'vertical') {\n const t = textAlign;\n textAlign = text.getBaselineMapAlign()[textBaseline] ?? ('left' as any);\n textBaseline = text.getAlignMapBaseline()[t] ?? ('top' as any);\n }\n const lineHeight = calculateLineHeight(text.attribute.lineHeight, fontSize) ?? fontSize;\n\n const data = this.valid(text, textAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n // 文字如果需要变换,那就需要将3dmatrix转成context的2dmatrix\n const transform3dMatrixToContextMatrix = !keepDirIn3d;\n\n const z = this.z || 0;\n\n context.beginPath();\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(text, text.attribute, textAttribute);\n\n this.beforeRenderStep(\n text,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n textAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n\n transform3dMatrixToContextMatrix && this.transformUseContext2d(text, textAttribute, z, context);\n\n const drawText = (t: string, offsetX: number, offsetY: number, direction: number) => {\n let _x = x + offsetX;\n const _y = y + offsetY;\n if (direction) {\n context.highPerformanceSave();\n _x += fontSize;\n const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);\n // matrix.translate(fontSize, 0);\n matrix.rotateByCenter(Math.PI / 2, _x, _y);\n context.transformFromMatrix(matrix, true);\n matrixAllocate.free(matrix);\n }\n\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, text.attribute, textAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute);\n context.strokeText(t, _x, _y, z);\n }\n }\n if (doFill) {\n if (fillCb) {\n fillCb(context, text.attribute, textAttribute);\n } else if (fVisible) {\n context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute);\n context.fillText(t, _x, _y, z);\n this.drawUnderLine(underline, lineThrough, text, _x, _y, z, textAttribute, context);\n }\n }\n\n if (direction) {\n context.highPerformanceRestore();\n context.setTransformForCurrent();\n }\n };\n if (Array.isArray(str)) {\n context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);\n if (direction === 'horizontal') {\n const { multilineLayout } = text;\n if (!multilineLayout) {\n context.highPerformanceRestore();\n return;\n } // 如果不存在的话,需要render层自行布局\n const { xOffset, yOffset } = multilineLayout.bbox;\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, text.attribute, textAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute);\n multilineLayout.lines.forEach(line => {\n context.strokeText(\n line.str,\n (line.leftOffset || 0) + xOffset + x,\n (line.topOffset || 0) + yOffset + y,\n z\n );\n });\n }\n }\n if (doFill) {\n if (fillCb) {\n fillCb(context, text.attribute, textAttribute);\n } else if (fVisible) {\n context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute);\n multilineLayout.lines.forEach(line => {\n context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);\n this.drawMultiUnderLine(\n underline,\n lineThrough,\n text,\n (line.leftOffset || 0) + x, // 中下划线都是从文字左侧开始,因此不需要+xOffset\n (line.topOffset || 0) + yOffset + y,\n z,\n line.width,\n textAttribute,\n context\n );\n });\n }\n }\n } else {\n text.tryUpdateAABBBounds(); // 更新cache\n const cache = text.cache;\n const { verticalList } = cache;\n context.textAlign = 'left';\n context.textBaseline = 'top';\n const totalHeight = lineHeight * verticalList.length;\n let totalW = 0;\n verticalList.forEach(verticalData => {\n const _w = verticalData.reduce((a, b) => a + (b.width || 0), 0);\n totalW = max(_w, totalW);\n });\n let offsetY = 0;\n let offsetX = 0;\n if (textBaseline === 'bottom') {\n offsetX = -totalHeight;\n } else if (textBaseline === 'middle') {\n offsetX = -totalHeight / 2;\n }\n if (textAlign === 'center') {\n offsetY -= totalW / 2;\n } else if (textAlign === 'right') {\n offsetY -= totalW;\n }\n verticalList.forEach((verticalData, i) => {\n const currentW = verticalData.reduce((a, b) => a + (b.width || 0), 0);\n const dw = totalW - currentW;\n let currentOffsetY = offsetY;\n if (textAlign === 'center') {\n currentOffsetY += dw / 2;\n } else if (textAlign === 'right') {\n currentOffsetY += dw;\n }\n verticalData.forEach(item => {\n const { text, width, direction } = item;\n drawText(text, totalHeight - (i + 1) * lineHeight + offsetX, currentOffsetY, direction);\n currentOffsetY += width;\n });\n });\n }\n } else {\n if (direction === 'horizontal') {\n context.setTextStyle(text.attribute, textAttribute, z);\n const t = text.clipedText as string;\n let dy = 0;\n if (lineHeight !== fontSize) {\n if (textBaseline === 'top') {\n dy = (lineHeight - fontSize) / 2;\n } else if (textBaseline === 'middle') {\n // middle do nothing\n } else if (textBaseline === 'bottom') {\n dy = -(lineHeight - fontSize) / 2;\n } else {\n // alphabetic do nothing\n // dy = (lineHeight - fontSize) / 2 - fontSize * 0.79;\n }\n }\n drawText(t, 0, dy, 0);\n } else {\n text.tryUpdateAABBBounds(); // 更新cache\n const cache = text.cache;\n if (cache) {\n context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);\n const { verticalList } = cache;\n let offsetY = 0;\n const totalW = verticalList[0].reduce((a, b) => a + (b.width || 0), 0);\n let offsetX = 0;\n if (textBaseline === 'bottom') {\n offsetX = -lineHeight;\n } else if (textBaseline === 'middle') {\n offsetX = -lineHeight / 2;\n }\n if (textAlign === 'center') {\n offsetY -= totalW / 2;\n } else if (textAlign === 'right') {\n offsetY -= totalW;\n }\n context.textAlign = 'left';\n context.textBaseline = 'top';\n verticalList[0].forEach(item => {\n const { text, width, direction } = item;\n drawText(text, offsetX, offsetY, direction);\n offsetY += width;\n });\n }\n }\n }\n transform3dMatrixToContextMatrix && this.restoreTransformUseContext2d(text, textAttribute, z, context);\n\n this.afterRenderStep(\n text,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n textAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(text: IText, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const textAttribute = getTheme(text, params?.theme).text;\n const { keepDirIn3d = textAttribute.keepDirIn3d } = text.attribute;\n // 文字如果需要变换,那就一定要计算3d矩阵\n const computed3dMatrix = !keepDirIn3d;\n this._draw(text, textAttribute, computed3dMatrix, drawContext, params);\n }\n\n drawUnderLine(\n underline: number,\n lineThrough: number,\n text: IText,\n x: number,\n y: number,\n z: number,\n textAttribute: Required<ITextGraphicAttribute>,\n context: IContext2d\n ) {\n if (lineThrough + underline <= 0) {\n return;\n }\n\n const {\n textAlign = textAttribute.textAlign,\n textBaseline = textAttribute.textBaseline,\n fontSize = textAttribute.fontSize,\n fill = textAttribute.fill,\n opacity = textAttribute.opacity,\n fillOpacity = textAttribute.fillOpacity\n } = text.attribute;\n const w = text.clipedWidth;\n const offsetX = textDrawOffsetX(textAlign, w);\n const offsetY = textLayoutOffsetY(textBaseline, fontSize, fontSize);\n const attribute = { lineWidth: 0, stroke: fill, opacity, strokeOpacity: fillOpacity };\n if (underline) {\n attribute.lineWidth = underline;\n context.setStrokeStyle(text, attribute, x, y, textAttribute);\n context.beginPath();\n const dy = y + offsetY + fontSize;\n context.moveTo(x + offsetX, dy, z);\n context.lineTo(x + offsetX + w, dy, z);\n context.stroke();\n }\n if (lineThrough) {\n attribute.lineWidth = lineThrough;\n context.setStrokeStyle(text, attribute, x, y, textAttribute);\n context.beginPath();\n const dy = y + offsetY + fontSize / 2;\n context.moveTo(x + offsetX, dy, z);\n context.lineTo(x + offsetX + w, dy, z);\n context.stroke();\n }\n }\n\n drawMultiUnderLine(\n underline: number,\n lineThrough: number,\n text: IText,\n x: number,\n y: number,\n z: number,\n w: number,\n textAttribute: Required<ITextGraphicAttribute>,\n context: IContext2d\n ) {\n if (lineThrough + underline <= 0) {\n return;\n }\n\n const {\n textAlign = textAttribute.textAlign,\n fontSize = textAttribute.fontSize,\n fill = textAttribute.fill,\n opacity = textAttribute.opacity,\n fillOpacity = textAttribute.fillOpacity\n } = text.attribute;\n\n const offsetX = textDrawOffsetX(textAlign, w);\n const offsetY = textLayoutOffsetY('alphabetic', fontSize, fontSize);\n const attribute = { lineWidth: 0, stroke: fill, opacity, strokeOpacity: fillOpacity };\n let deltaY = -3;\n if (underline) {\n attribute.lineWidth = underline;\n context.setStrokeStyle(text, attribute, x, y, textAttribute);\n context.beginPath();\n const dy = y + offsetY + fontSize + deltaY;\n context.moveTo(x + offsetX, dy, z);\n context.lineTo(x + offsetX + w, dy, z);\n context.stroke();\n }\n deltaY = -1;\n if (lineThrough) {\n attribute.lineWidth = lineThrough;\n context.setStrokeStyle(text, attribute, x, y, textAttribute);\n context.beginPath();\n const dy = y + offsetY + fontSize / 2 + deltaY;\n context.moveTo(x + offsetX, dy, z);\n context.lineTo(x + offsetX + w, dy, z);\n context.stroke();\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/render/contributions/render/text-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAA2E;AAC3E,kDAAkD;AAClD,0DAA8D;AAa9D,+CAA0E;AAE1E,+CAA2C;AAC3C,iFAA6E;AAC7E,yDAAmE;AACnE,wEAAoE;AACpE,6CAAuC;AACvC,iDAA4D;AAGrD,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,wBAAiB;IAI5D,YAGqB,uBAAuE;QAE1F,KAAK,EAAE,CAAC;QAFW,4BAAuB,GAAvB,uBAAuB,CAAgD;QAL5F,eAAU,GAAW,4BAAgB,CAAC;QAQpC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACrC,CAAC;IAED,SAAS,CACP,IAAW,EACX,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ,QAIY;;QAEZ,MAAM,aAAa,GAAG,IAAA,gBAAQ,EAAC,IAAI,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,IAAI,CAAC;QACzD,MAAM,EACJ,IAAI,EAAE,GAAG,EACT,IAAI,GAAG,aAAa,CAAC,IAAI,EACzB,MAAM,GAAG,aAAa,CAAC,MAAM,EAC7B,WAAW,GAAG,aAAa,CAAC,WAAW,EACvC,aAAa,GAAG,aAAa,CAAC,aAAa,EAC3C,OAAO,GAAG,aAAa,CAAC,OAAO,EAC/B,SAAS,GAAG,aAAa,CAAC,SAAS,EACnC,OAAO,GAAG,aAAa,CAAC,OAAO,EAC/B,SAAS,GAAG,aAAa,CAAC,SAAS,EACnC,WAA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;YAC3C,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YACnC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YACvC,OAAO,CAAC,MAAM,EAAE,CAAC;SAClB;QACD,MAAM,GAAG,CAAC,CAAC,CAAC;QACZ,IAAI,WAAW,EAAE;YACf,SAAS,CAAC,SAAS,GAAG,WAAW,CAAC;YAClC,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;YAC7D,OAAO,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,GAAG,QAAQ,GAAG,CAAC,GAAG,MAAM,CAAC;YAC/C,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YACnC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YACvC,OAAO,CAAC,MAAM,EAAE,CAAC;SAClB;IACH,CAAC;CACF,CAAA;AAxXY,uBAAuB;IADnC,IAAA,2BAAU,GAAE;IAMR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,kCAAsB,CAAC,CAAA;;GANrB,uBAAuB,CAwXnC;AAxXY,0DAAuB","file":"text-render.js","sourcesContent":["import { inject, injectable, named } from '../../../common/inversify-lite';\nimport { getTheme } from '../../../graphic/theme';\nimport { TEXT_NUMBER_TYPE } from '../../../graphic/constants';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IThemeAttribute,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n ITextRenderContribution,\n IContributionProvider\n} from '../../../interface';\nimport { textDrawOffsetX, textLayoutOffsetY } from '../../../common/text';\nimport type { IText, ITextGraphicAttribute } from '../../../interface/graphic/text';\nimport { BaseRender } from './base-render';\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { TextRenderContribution } from './contributions/constants';\nimport { matrixAllocate } from '../../../allocator/matrix-allocate';\nimport { max } from '@visactor/vutils';\nimport { calculateLineHeight } from '../../../common/utils';\n\n@injectable()\nexport class DefaultCanvasTextRender extends BaseRender<IText> implements IGraphicRender {\n type: 'text';\n numberType: number = TEXT_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(TextRenderContribution)\n protected readonly textRenderContribitions: IContributionProvider<ITextRenderContribution>\n ) {\n super();\n this.init(textRenderContribitions);\n }\n\n drawShape(\n text: IText,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n const textAttribute = getTheme(text, params?.theme).text;\n const {\n text: str,\n fill = textAttribute.fill,\n stroke = textAttribute.stroke,\n fillOpacity = textAttribute.fillOpacity,\n strokeOpacity = textAttribute.strokeOpacity,\n opacity = textAttribute.opacity,\n lineWidth = textAttribute.lineWidth,\n visible = textAttribute.visible,\n underline = textAttribute.underline,\n lineThrough = textAttribute.lineThrough,\n keepDirIn3d = textAttribute.keepDirIn3d,\n direction = textAttribute.direction,\n // lineHeight = textAttribute.lineHeight,\n fontSize = textAttribute.fontSize,\n verticalMode = textAttribute.verticalMode,\n x: originX = textAttribute.x,\n y: originY = textAttribute.y\n } = text.attribute;\n\n let { textAlign = textAttribute.textAlign, textBaseline = textAttribute.textBaseline } = text.attribute;\n if (!verticalMode && direction === 'vertical') {\n const t = textAlign;\n textAlign = text.getBaselineMapAlign()[textBaseline] ?? ('left' as any);\n textBaseline = text.getAlignMapBaseline()[t] ?? ('top' as any);\n }\n const lineHeight = calculateLineHeight(text.attribute.lineHeight, fontSize) ?? fontSize;\n\n const data = this.valid(text, textAttribute, fillCb, strokeCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n // 文字如果需要变换,那就需要将3dmatrix转成context的2dmatrix\n const transform3dMatrixToContextMatrix = !keepDirIn3d;\n\n const z = this.z || 0;\n\n context.beginPath();\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(text, text.attribute, textAttribute);\n\n this.beforeRenderStep(\n text,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n textAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n\n transform3dMatrixToContextMatrix && this.transformUseContext2d(text, textAttribute, z, context);\n\n const drawText = (t: string, offsetX: number, offsetY: number, direction: number) => {\n let _x = x + offsetX;\n const _y = y + offsetY;\n if (direction) {\n context.highPerformanceSave();\n _x += fontSize;\n const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);\n // matrix.translate(fontSize, 0);\n matrix.rotateByCenter(Math.PI / 2, _x, _y);\n context.transformFromMatrix(matrix, true);\n matrixAllocate.free(matrix);\n }\n\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, text.attribute, textAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute);\n context.strokeText(t, _x, _y, z);\n }\n }\n if (doFill) {\n if (fillCb) {\n fillCb(context, text.attribute, textAttribute);\n } else if (fVisible) {\n context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute);\n context.fillText(t, _x, _y, z);\n this.drawUnderLine(underline, lineThrough, text, _x, _y, z, textAttribute, context);\n }\n }\n\n if (direction) {\n context.highPerformanceRestore();\n context.setTransformForCurrent();\n }\n };\n if (Array.isArray(str)) {\n context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);\n if (direction === 'horizontal') {\n const { multilineLayout } = text;\n if (!multilineLayout) {\n context.highPerformanceRestore();\n return;\n } // 如果不存在的话,需要render层自行布局\n const { xOffset, yOffset } = multilineLayout.bbox;\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, text.attribute, textAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute);\n multilineLayout.lines.forEach(line => {\n context.strokeText(\n line.str,\n (line.leftOffset || 0) + xOffset + x,\n (line.topOffset || 0) + yOffset + y,\n z\n );\n });\n }\n }\n if (doFill) {\n if (fillCb) {\n fillCb(context, text.attribute, textAttribute);\n } else if (fVisible) {\n context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute);\n multilineLayout.lines.forEach(line => {\n context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);\n this.drawMultiUnderLine(\n underline,\n lineThrough,\n text,\n (line.leftOffset || 0) + x, // 中下划线都是从文字左侧开始,因此不需要+xOffset\n (line.topOffset || 0) + yOffset + y,\n z,\n line.width,\n textAttribute,\n context\n );\n });\n }\n }\n } else {\n const cache = text.cache;\n const { verticalList } = cache;\n context.textAlign = 'left';\n context.textBaseline = 'top';\n const totalHeight = lineHeight * verticalList.length;\n let totalW = 0;\n verticalList.forEach(verticalData => {\n const _w = verticalData.reduce((a, b) => a + (b.width || 0), 0);\n totalW = max(_w, totalW);\n });\n let offsetY = 0;\n let offsetX = 0;\n if (textBaseline === 'bottom') {\n offsetX = -totalHeight;\n } else if (textBaseline === 'middle') {\n offsetX = -totalHeight / 2;\n }\n if (textAlign === 'center') {\n offsetY -= totalW / 2;\n } else if (textAlign === 'right') {\n offsetY -= totalW;\n }\n verticalList.forEach((verticalData, i) => {\n const currentW = verticalData.reduce((a, b) => a + (b.width || 0), 0);\n const dw = totalW - currentW;\n let currentOffsetY = offsetY;\n if (textAlign === 'center') {\n currentOffsetY += dw / 2;\n } else if (textAlign === 'right') {\n currentOffsetY += dw;\n }\n verticalData.forEach(item => {\n const { text, width, direction } = item;\n drawText(text, totalHeight - (i + 1) * lineHeight + offsetX, currentOffsetY, direction);\n currentOffsetY += width;\n });\n });\n }\n } else {\n const cache = text.cache;\n if (direction === 'horizontal') {\n context.setTextStyle(text.attribute, textAttribute, z);\n const t = text.clipedText as string;\n let dy = 0;\n if (lineHeight !== fontSize) {\n if (textBaseline === 'top') {\n dy = (lineHeight - fontSize) / 2;\n } else if (textBaseline === 'middle') {\n // middle do nothing\n } else if (textBaseline === 'bottom') {\n dy = -(lineHeight - fontSize) / 2;\n } else {\n // alphabetic do nothing\n // dy = (lineHeight - fontSize) / 2 - fontSize * 0.79;\n }\n }\n drawText(t, 0, dy, 0);\n } else if (cache) {\n context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);\n const { verticalList } = cache;\n let offsetY = 0;\n const totalW = verticalList[0].reduce((a, b) => a + (b.width || 0), 0);\n let offsetX = 0;\n if (textBaseline === 'bottom') {\n offsetX = -lineHeight;\n } else if (textBaseline === 'middle') {\n offsetX = -lineHeight / 2;\n }\n if (textAlign === 'center') {\n offsetY -= totalW / 2;\n } else if (textAlign === 'right') {\n offsetY -= totalW;\n }\n context.textAlign = 'left';\n context.textBaseline = 'top';\n verticalList[0].forEach(item => {\n const { text, width, direction } = item;\n drawText(text, offsetX, offsetY, direction);\n offsetY += width;\n });\n }\n }\n transform3dMatrixToContextMatrix && this.restoreTransformUseContext2d(text, textAttribute, z, context);\n\n this.afterRenderStep(\n text,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n textAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n\n draw(text: IText, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const textAttribute = getTheme(text, params?.theme).text;\n const { keepDirIn3d = textAttribute.keepDirIn3d } = text.attribute;\n // 文字如果需要变换,那就一定要计算3d矩阵\n const computed3dMatrix = !keepDirIn3d;\n this._draw(text, textAttribute, computed3dMatrix, drawContext, params);\n }\n\n drawUnderLine(\n underline: number,\n lineThrough: number,\n text: IText,\n x: number,\n y: number,\n z: number,\n textAttribute: Required<ITextGraphicAttribute>,\n context: IContext2d\n ) {\n if (lineThrough + underline <= 0) {\n return;\n }\n\n const {\n textAlign = textAttribute.textAlign,\n textBaseline = textAttribute.textBaseline,\n fontSize = textAttribute.fontSize,\n fill = textAttribute.fill,\n opacity = textAttribute.opacity,\n fillOpacity = textAttribute.fillOpacity\n } = text.attribute;\n const w = text.clipedWidth;\n const offsetX = textDrawOffsetX(textAlign, w);\n const offsetY = textLayoutOffsetY(textBaseline, fontSize, fontSize);\n const attribute = { lineWidth: 0, stroke: fill, opacity, strokeOpacity: fillOpacity };\n if (underline) {\n attribute.lineWidth = underline;\n context.setStrokeStyle(text, attribute, x, y, textAttribute);\n context.beginPath();\n const dy = y + offsetY + fontSize;\n context.moveTo(x + offsetX, dy, z);\n context.lineTo(x + offsetX + w, dy, z);\n context.stroke();\n }\n if (lineThrough) {\n attribute.lineWidth = lineThrough;\n context.setStrokeStyle(text, attribute, x, y, textAttribute);\n context.beginPath();\n const dy = y + offsetY + fontSize / 2;\n context.moveTo(x + offsetX, dy, z);\n context.lineTo(x + offsetX + w, dy, z);\n context.stroke();\n }\n }\n\n drawMultiUnderLine(\n underline: number,\n lineThrough: number,\n text: IText,\n x: number,\n y: number,\n z: number,\n w: number,\n textAttribute: Required<ITextGraphicAttribute>,\n context: IContext2d\n ) {\n if (lineThrough + underline <= 0) {\n return;\n }\n\n const {\n textAlign = textAttribute.textAlign,\n fontSize = textAttribute.fontSize,\n fill = textAttribute.fill,\n opacity = textAttribute.opacity,\n fillOpacity = textAttribute.fillOpacity\n } = text.attribute;\n\n const offsetX = textDrawOffsetX(textAlign, w);\n const offsetY = textLayoutOffsetY('alphabetic', fontSize, fontSize);\n const attribute = { lineWidth: 0, stroke: fill, opacity, strokeOpacity: fillOpacity };\n let deltaY = -3;\n if (underline) {\n attribute.lineWidth = underline;\n context.setStrokeStyle(text, attribute, x, y, textAttribute);\n context.beginPath();\n const dy = y + offsetY + fontSize + deltaY;\n context.moveTo(x + offsetX, dy, z);\n context.lineTo(x + offsetX + w, dy, z);\n context.stroke();\n }\n deltaY = -1;\n if (lineThrough) {\n attribute.lineWidth = lineThrough;\n context.setStrokeStyle(text, attribute, x, y, textAttribute);\n context.beginPath();\n const dy = y + offsetY + fontSize / 2 + deltaY;\n context.moveTo(x + offsetX, dy, z);\n context.lineTo(x + offsetX + w, dy, z);\n context.stroke();\n }\n }\n}\n"]}
@@ -7,6 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  const inversify_lite_1 = require("../common/inversify-lite"), render_service_1 = require("./render-service");
8
8
 
9
9
  exports.default = new inversify_lite_1.ContainerModule((bind => {
10
- bind(render_service_1.RenderService).to(render_service_1.DefaultRenderService).inSingletonScope();
10
+ bind(render_service_1.DefaultRenderService).toSelf(), bind(render_service_1.RenderService).toService(render_service_1.DefaultRenderService);
11
11
  }));
12
12
  //# sourceMappingURL=render-modules.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/render-modules.ts"],"names":[],"mappings":";;AAAA,6DAA2D;AAC3D,qDAAuE;AAEvE,kBAAe,IAAI,gCAAe,CAAC,IAAI,CAAC,EAAE;IACxC,IAAI,CAAC,8BAAa,CAAC,CAAC,EAAE,CAAC,qCAAoB,CAAC,CAAC,gBAAgB,EAAE,CAAC;AAClE,CAAC,CAAC,CAAC","file":"render-modules.js","sourcesContent":["import { ContainerModule } from '../common/inversify-lite';\nimport { DefaultRenderService, RenderService } from './render-service';\n\nexport default new ContainerModule(bind => {\n bind(RenderService).to(DefaultRenderService).inSingletonScope();\n});\n"]}
1
+ {"version":3,"sources":["../src/render/render-modules.ts"],"names":[],"mappings":";;AAAA,6DAA2D;AAC3D,qDAAuE;AAEvE,kBAAe,IAAI,gCAAe,CAAC,IAAI,CAAC,EAAE;IACxC,IAAI,CAAC,qCAAoB,CAAC,CAAC,MAAM,EAAE,CAAC;IACpC,IAAI,CAAC,8BAAa,CAAC,CAAC,SAAS,CAAC,qCAAoB,CAAC,CAAC;AACtD,CAAC,CAAC,CAAC","file":"render-modules.js","sourcesContent":["import { ContainerModule } from '../common/inversify-lite';\nimport { DefaultRenderService, RenderService } from './render-service';\n\nexport default new ContainerModule(bind => {\n bind(DefaultRenderService).toSelf();\n bind(RenderService).toService(DefaultRenderService);\n});\n"]}
@@ -25,7 +25,7 @@ let DefaultRenderService = class {
25
25
  this.drawContribution = drawContribution;
26
26
  }
27
27
  prepare(updateBounds) {
28
- updateBounds && this.renderTreeRoots.forEach((g => {
28
+ this.renderTreeRoots.forEach((g => {
29
29
  this._prepare(g, updateBounds);
30
30
  }));
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/render/render-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAA8D;AAG9D,mDAA0D;AAE7C,QAAA,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC5C,QAAA,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AAO1E,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAO/B,YAEmB,gBAAmC;QAAnC,qBAAgB,GAAhB,gBAAgB,CAAmB;IACnD,CAAC;IAGJ,OAAO,CAAC,YAAqB;QAG3B,IAAI,CAAC,YAAY,EAAE;YACjB,OAAO;SACR;QACD,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YAC/B,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IACS,QAAQ,CAAC,CAAW,EAAE,YAAqB;QACnD,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE;YACpB,IAAI,CAAC,QAAQ,CAAC,CAAa,EAAE,YAAY,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,iBAAiB;QACf,OAAO;IACT,CAAC;IAED,UAAU,CAAC,MAAgC;QACzC,OAAO;IACT,CAAC;IAED,IAAI,CAAC,MAAgC;QACnC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,oBAAO,IAAI,CAAC,UAAU,EAAG,CAAC;IAC3D,CAAC;IAED,SAAS,CAAC,MAAgC;QACxC,IAAI,CAAC,gBAAgB,CAAC,SAAS,IAAI,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,IAAI,oBAAO,IAAI,CAAC,UAAU,EAAG,CAAC;QACjG,OAAO;IACT,CAAC;IAED,MAAM,CAAC,MAAgB,EAAE,MAAgC;QACvD,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;QACzB,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC3B,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;CACF,CAAA;AA1DY,oBAAoB;IADhC,IAAA,2BAAU,GAAE;IASR,WAAA,IAAA,uBAAM,EAAC,yBAAgB,CAAC,CAAA;;GARhB,oBAAoB,CA0DhC;AA1DY,oDAAoB","file":"render-service.js","sourcesContent":["import { injectable, inject } from '../common/inversify-lite';\nimport type { IAABBBounds, IBounds } from '@visactor/vutils';\nimport type { IGroup, IGraphic, IRenderService, IRenderServiceDrawParams, IDrawContribution } from '../interface';\nimport { DrawContribution } from './contributions/render';\n\nexport const RenderService = Symbol.for('RenderService');\nexport const BeforeRenderConstribution = Symbol.for('BeforeRenderConstribution');\n\n/**\n * 渲染用的service,通常和stage一一绑定,\n * 并不是单例模式,所以会绑定此次渲染的一些数据\n */\n@injectable()\nexport class DefaultRenderService implements IRenderService {\n // 每次render都会变的数据\n dirtyBounds: IBounds;\n renderTreeRoots: IGraphic[]; // 此次render的数组\n renderLists: IGraphic[];\n drawParams: IRenderServiceDrawParams;\n\n constructor(\n @inject(DrawContribution)\n private readonly drawContribution: IDrawContribution\n ) {}\n\n // 渲染前准备工作,计算bounds等逻辑\n prepare(updateBounds: boolean): void {\n // 如果不需要计算Bounds,那么transMatrix也不需要计算\n // TODO 后期可能存在依赖transMatrix的插件,但目前不存在\n if (!updateBounds) {\n return;\n }\n this.renderTreeRoots.forEach(g => {\n this._prepare(g, updateBounds);\n });\n return;\n }\n protected _prepare(g: IGraphic, updateBounds: boolean) {\n g.forEachChildren(g => {\n this._prepare(g as IGraphic, updateBounds);\n });\n g.update({ bounds: updateBounds, trans: true });\n }\n // 获取要渲染的list,可能存在一些不用渲染的内容,以及外描边\n prepareRenderList(): void {\n return;\n }\n // 渲染前流程\n beforeDraw(params: IRenderServiceDrawParams): void {\n return;\n }\n // 具体渲染\n draw(params: IRenderServiceDrawParams): void {\n this.drawContribution.draw(this, { ...this.drawParams });\n }\n // 渲染后流程\n afterDraw(params: IRenderServiceDrawParams): void {\n this.drawContribution.afterDraw && this.drawContribution.afterDraw(this, { ...this.drawParams });\n return;\n }\n // 对外暴露的绘制方法\n render(groups: IGroup[], params: IRenderServiceDrawParams): void {\n this.renderTreeRoots = groups;\n this.drawParams = params;\n const updateBounds = params.updateBounds;\n this.prepare(updateBounds);\n this.prepareRenderList();\n this.beforeDraw(params);\n this.draw(params);\n this.afterDraw(params);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/render/render-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAA8D;AA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AG,MAAM,CAAC;QACzB,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC3B,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;CACF,CAAA;AArDY,oBAAoB;IADhC,IAAA,2BAAU,GAAE;IASR,WAAA,IAAA,uBAAM,EAAC,yBAAgB,CAAC,CAAA;;GARhB,oBAAoB,CAqDhC;AArDY,oDAAoB","file":"render-service.js","sourcesContent":["import { injectable, inject } from '../common/inversify-lite';\nimport type { IAABBBounds, IBounds } from '@visactor/vutils';\nimport type { IGroup, IGraphic, IRenderService, IRenderServiceDrawParams, IDrawContribution } from '../interface';\nimport { DrawContribution } from './contributions/render';\n\nexport const RenderService = Symbol.for('RenderService');\nexport const BeforeRenderConstribution = Symbol.for('BeforeRenderConstribution');\n\n/**\n * 渲染用的service,通常和stage一一绑定,\n * 并不是单例模式,所以会绑定此次渲染的一些数据\n */\n@injectable()\nexport class DefaultRenderService implements IRenderService {\n // 每次render都会变的数据\n dirtyBounds: IBounds;\n renderTreeRoots: IGraphic[]; // 此次render的数组\n renderLists: IGraphic[];\n drawParams: IRenderServiceDrawParams;\n\n constructor(\n @inject(DrawContribution)\n private readonly drawContribution: IDrawContribution\n ) {}\n\n // 渲染前准备工作,计算bounds等逻辑\n prepare(updateBounds: boolean): void {\n this.renderTreeRoots.forEach(g => {\n this._prepare(g, updateBounds);\n });\n return;\n }\n protected _prepare(g: IGraphic, updateBounds: boolean) {\n g.forEachChildren(g => {\n this._prepare(g as IGraphic, updateBounds);\n });\n g.update({ bounds: updateBounds, trans: true });\n }\n // 获取要渲染的list,可能存在一些不用渲染的内容,以及外描边\n prepareRenderList(): void {\n return;\n }\n // 渲染前流程\n beforeDraw(params: IRenderServiceDrawParams): void {\n return;\n }\n // 具体渲染\n draw(params: IRenderServiceDrawParams): void {\n this.drawContribution.draw(this, { ...this.drawParams });\n }\n // 渲染后流程\n afterDraw(params: IRenderServiceDrawParams): void {\n this.drawContribution.afterDraw && this.drawContribution.afterDraw(this, { ...this.drawParams });\n return;\n }\n // 对外暴露的绘制方法\n render(groups: IGroup[], params: IRenderServiceDrawParams): void {\n this.renderTreeRoots = groups;\n this.drawParams = params;\n const updateBounds = params.updateBounds;\n this.prepare(updateBounds);\n this.prepareRenderList();\n this.beforeDraw(params);\n this.draw(params);\n this.afterDraw(params);\n }\n}\n"]}