@antv/g6 5.0.0-beta.27 → 5.0.0-beta.28

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 (464) hide show
  1. package/LICENSE +21 -0
  2. package/dist/g6.min.js +2 -2
  3. package/esm/constant/shape.d.ts +1 -1
  4. package/esm/index.d.ts +4 -2
  5. package/esm/index.js +1 -1
  6. package/esm/index.js.map +1 -1
  7. package/esm/item/combo.js +3 -1
  8. package/esm/item/combo.js.map +1 -1
  9. package/esm/item/edge.js +7 -2
  10. package/esm/item/edge.js.map +1 -1
  11. package/esm/item/item.d.ts +2 -2
  12. package/esm/item/item.js +13 -6
  13. package/esm/item/item.js.map +1 -1
  14. package/esm/item/node.d.ts +1 -0
  15. package/esm/item/node.js +12 -2
  16. package/esm/item/node.js.map +1 -1
  17. package/esm/runtime/controller/data.js +15 -10
  18. package/esm/runtime/controller/data.js.map +1 -1
  19. package/esm/runtime/controller/interaction.js +4 -3
  20. package/esm/runtime/controller/interaction.js.map +1 -1
  21. package/esm/runtime/controller/item.d.ts +3 -2
  22. package/esm/runtime/controller/item.js +45 -22
  23. package/esm/runtime/controller/item.js.map +1 -1
  24. package/esm/runtime/controller/layout.js +7 -10
  25. package/esm/runtime/controller/layout.js.map +1 -1
  26. package/esm/runtime/controller/plugin.js +1 -1
  27. package/esm/runtime/controller/plugin.js.map +1 -1
  28. package/esm/runtime/graph.d.ts +19 -6
  29. package/esm/runtime/graph.js +62 -27
  30. package/esm/runtime/graph.js.map +1 -1
  31. package/esm/runtime/hooks.d.ts +2 -2
  32. package/esm/runtime/hooks.js +2 -2
  33. package/esm/stdlib/behavior/create-edge.d.ts +1 -1
  34. package/esm/stdlib/behavior/drag-canvas.d.ts +1 -1
  35. package/esm/stdlib/behavior/drag-node.d.ts +1 -1
  36. package/esm/stdlib/behavior/drag-node.js +1 -1
  37. package/esm/stdlib/behavior/drag-node.js.map +1 -1
  38. package/esm/stdlib/behavior/hover-activate.d.ts +1 -1
  39. package/esm/stdlib/behavior/orbit-canvas-3d.d.ts +1 -1
  40. package/esm/stdlib/behavior/rotate-canvas-3d.d.ts +2 -2
  41. package/esm/stdlib/behavior/scroll-canvas.js +5 -5
  42. package/esm/stdlib/behavior/scroll-canvas.js.map +1 -1
  43. package/esm/stdlib/behavior/track-canvas-3d.d.ts +1 -1
  44. package/esm/stdlib/behavior/zoom-canvas-3d.d.ts +1 -1
  45. package/esm/stdlib/behavior/zoom-canvas.d.ts +16 -0
  46. package/esm/stdlib/behavior/zoom-canvas.js +107 -5
  47. package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
  48. package/esm/stdlib/data/transformV4Data.js +12 -6
  49. package/esm/stdlib/data/transformV4Data.js.map +1 -1
  50. package/esm/stdlib/index.d.ts +6 -4
  51. package/esm/stdlib/index.js +8 -6
  52. package/esm/stdlib/index.js.map +1 -1
  53. package/esm/stdlib/item/combo/circle.js +12 -7
  54. package/esm/stdlib/item/combo/circle.js.map +1 -1
  55. package/esm/stdlib/item/combo/rect.js +12 -7
  56. package/esm/stdlib/item/combo/rect.js.map +1 -1
  57. package/esm/stdlib/item/edge/base.d.ts +22 -5
  58. package/esm/stdlib/item/edge/base.js +48 -16
  59. package/esm/stdlib/item/edge/base.js.map +1 -1
  60. package/esm/stdlib/item/edge/cubic.js +11 -6
  61. package/esm/stdlib/item/edge/cubic.js.map +1 -1
  62. package/esm/stdlib/item/edge/line.js +12 -7
  63. package/esm/stdlib/item/edge/line.js.map +1 -1
  64. package/esm/stdlib/item/edge/loop.js +6 -1
  65. package/esm/stdlib/item/edge/loop.js.map +1 -1
  66. package/esm/stdlib/item/edge/polyline.js +11 -6
  67. package/esm/stdlib/item/edge/polyline.js.map +1 -1
  68. package/esm/stdlib/item/edge/quadratic.js +11 -6
  69. package/esm/stdlib/item/edge/quadratic.js.map +1 -1
  70. package/esm/stdlib/item/node/base.d.ts +24 -13
  71. package/esm/stdlib/item/node/base.js +90 -48
  72. package/esm/stdlib/item/node/base.js.map +1 -1
  73. package/esm/stdlib/item/node/base3d.d.ts +11 -2
  74. package/esm/stdlib/item/node/base3d.js +14 -3
  75. package/esm/stdlib/item/node/base3d.js.map +1 -1
  76. package/esm/stdlib/item/node/circle.js +13 -7
  77. package/esm/stdlib/item/node/circle.js.map +1 -1
  78. package/esm/stdlib/item/node/cube.d.ts +0 -2
  79. package/esm/stdlib/item/node/cube.js +12 -9
  80. package/esm/stdlib/item/node/cube.js.map +1 -1
  81. package/esm/stdlib/item/node/diamond.js +20 -11
  82. package/esm/stdlib/item/node/diamond.js.map +1 -1
  83. package/esm/stdlib/item/node/donut.js +18 -8
  84. package/esm/stdlib/item/node/donut.js.map +1 -1
  85. package/esm/stdlib/item/node/ellipse.js +11 -6
  86. package/esm/stdlib/item/node/ellipse.js.map +1 -1
  87. package/esm/stdlib/item/node/hexagon.js +12 -7
  88. package/esm/stdlib/item/node/hexagon.js.map +1 -1
  89. package/esm/stdlib/item/node/image.js +13 -3
  90. package/esm/stdlib/item/node/image.js.map +1 -1
  91. package/esm/stdlib/item/node/index.d.ts +1 -0
  92. package/esm/stdlib/item/node/index.js +1 -0
  93. package/esm/stdlib/item/node/index.js.map +1 -1
  94. package/esm/stdlib/item/node/modelRect.d.ts +33 -1
  95. package/esm/stdlib/item/node/modelRect.js +135 -78
  96. package/esm/stdlib/item/node/modelRect.js.map +1 -1
  97. package/esm/stdlib/item/node/plane.d.ts +38 -0
  98. package/esm/stdlib/item/node/plane.js +62 -0
  99. package/esm/stdlib/item/node/plane.js.map +1 -0
  100. package/esm/stdlib/item/node/rect.js +12 -7
  101. package/esm/stdlib/item/node/rect.js.map +1 -1
  102. package/esm/stdlib/item/node/sphere.js +12 -7
  103. package/esm/stdlib/item/node/sphere.js.map +1 -1
  104. package/esm/stdlib/item/node/star.d.ts +1 -3
  105. package/esm/stdlib/item/node/star.js +16 -10
  106. package/esm/stdlib/item/node/star.js.map +1 -1
  107. package/esm/stdlib/item/node/triangle.js +17 -7
  108. package/esm/stdlib/item/node/triangle.js.map +1 -1
  109. package/esm/stdlib/plugin/edgeBundling/index.d.ts +75 -0
  110. package/esm/stdlib/plugin/edgeBundling/index.js +364 -0
  111. package/esm/stdlib/plugin/edgeBundling/index.js.map +1 -0
  112. package/esm/stdlib/plugin/hull/bubbleset.d.ts +1 -1
  113. package/esm/stdlib/plugin/hull/bubbleset.js +13 -13
  114. package/esm/stdlib/plugin/hull/bubbleset.js.map +1 -1
  115. package/esm/stdlib/plugin/hull/index.js +4 -4
  116. package/esm/stdlib/plugin/hull/util.js +1 -1
  117. package/esm/stdlib/plugin/hull/util.js.map +1 -1
  118. package/esm/stdlib/plugin/index.d.ts +1 -0
  119. package/esm/stdlib/plugin/index.js +1 -0
  120. package/esm/stdlib/plugin/index.js.map +1 -1
  121. package/esm/stdlib/plugin/legend/index.d.ts +2 -2
  122. package/esm/stdlib/plugin/legend/index.js +10 -10
  123. package/esm/stdlib/plugin/legend/index.js.map +1 -1
  124. package/esm/stdlib/plugin/lodController/index.js +10 -8
  125. package/esm/stdlib/plugin/lodController/index.js.map +1 -1
  126. package/esm/stdlib/plugin/menu/index.js +1 -1
  127. package/esm/stdlib/plugin/menu/index.js.map +1 -1
  128. package/esm/stdlib/plugin/snapline/index.d.ts +2 -2
  129. package/esm/stdlib/plugin/snapline/index.js +2 -2
  130. package/esm/stdlib/plugin/snapline/index.js.map +1 -1
  131. package/esm/stdlib/plugin/tooltip/index.d.ts +1 -1
  132. package/esm/stdlib/plugin/tooltip/index.js +3 -3
  133. package/esm/stdlib/plugin/tooltip/index.js.map +1 -1
  134. package/esm/stdlib/plugin/{watermaker → watermarker}/index.d.ts +1 -1
  135. package/esm/stdlib/plugin/{watermaker → watermarker}/index.js +7 -7
  136. package/esm/stdlib/plugin/watermarker/index.js.map +1 -0
  137. package/esm/stdlib/selector/lasso.js +3 -3
  138. package/esm/stdlib/selector/lasso.js.map +1 -1
  139. package/esm/stdlib/theme/dark.js +1 -1
  140. package/esm/stdlib/theme/dark.js.map +1 -1
  141. package/esm/stdlib/theme/light.js +4 -1
  142. package/esm/stdlib/theme/light.js.map +1 -1
  143. package/esm/stdlib/themeSolver/spec.js +3 -3
  144. package/esm/stdlib/themeSolver/subject.d.ts +1 -1
  145. package/esm/stdlib/themeSolver/subject.js +1 -1
  146. package/esm/types/animate.d.ts +1 -1
  147. package/esm/types/data.d.ts +3 -1
  148. package/esm/types/graph.d.ts +54 -11
  149. package/esm/types/hook.d.ts +13 -3
  150. package/esm/types/index.d.ts +2 -1
  151. package/esm/types/index.js +1 -0
  152. package/esm/types/index.js.map +1 -1
  153. package/esm/types/item.d.ts +8 -10
  154. package/esm/types/item.js.map +1 -1
  155. package/esm/types/layout.d.ts +1 -1
  156. package/esm/types/node.d.ts +1 -31
  157. package/esm/types/plugin.d.ts +1 -1
  158. package/esm/types/plugin.js +1 -1
  159. package/esm/types/spec.d.ts +5 -5
  160. package/esm/types/theme.d.ts +1 -1
  161. package/esm/types/view.d.ts +1 -1
  162. package/esm/util/animate.js +1 -1
  163. package/esm/util/animate.js.map +1 -1
  164. package/esm/util/canvas.d.ts +1 -1
  165. package/esm/util/canvas.js +7 -1
  166. package/esm/util/canvas.js.map +1 -1
  167. package/esm/util/data.d.ts +10 -10
  168. package/esm/util/data.js +10 -9
  169. package/esm/util/data.js.map +1 -1
  170. package/esm/util/extend.js +1 -1
  171. package/esm/util/extend.js.map +1 -1
  172. package/esm/util/item.js +1 -1
  173. package/esm/util/item.js.map +1 -1
  174. package/esm/util/math.d.ts +1 -1
  175. package/esm/util/math.js +1 -1
  176. package/esm/util/path.d.ts +1 -1
  177. package/esm/util/path.js +1 -1
  178. package/esm/util/polyline.d.ts +2 -2
  179. package/esm/util/polyline.js +3 -3
  180. package/esm/util/polyline.js.map +1 -1
  181. package/esm/util/router.js +7 -7
  182. package/esm/util/router.js.map +1 -1
  183. package/esm/util/shape.d.ts +25 -13
  184. package/esm/util/shape.js +29 -20
  185. package/esm/util/shape.js.map +1 -1
  186. package/esm/util/shape3d.d.ts +2 -2
  187. package/esm/util/shape3d.js +9 -12
  188. package/esm/util/shape3d.js.map +1 -1
  189. package/lib/constant/shape.d.ts +1 -1
  190. package/lib/index.d.ts +4 -2
  191. package/lib/index.js +1 -1
  192. package/lib/index.js.map +1 -1
  193. package/lib/item/combo.js +3 -1
  194. package/lib/item/combo.js.map +1 -1
  195. package/lib/item/edge.js +7 -2
  196. package/lib/item/edge.js.map +1 -1
  197. package/lib/item/item.d.ts +2 -2
  198. package/lib/item/item.js +13 -6
  199. package/lib/item/item.js.map +1 -1
  200. package/lib/item/node.d.ts +1 -0
  201. package/lib/item/node.js +12 -2
  202. package/lib/item/node.js.map +1 -1
  203. package/lib/runtime/controller/data.js +14 -9
  204. package/lib/runtime/controller/data.js.map +1 -1
  205. package/lib/runtime/controller/interaction.js +3 -2
  206. package/lib/runtime/controller/interaction.js.map +1 -1
  207. package/lib/runtime/controller/item.d.ts +3 -2
  208. package/lib/runtime/controller/item.js +44 -21
  209. package/lib/runtime/controller/item.js.map +1 -1
  210. package/lib/runtime/controller/layout.js +7 -33
  211. package/lib/runtime/controller/layout.js.map +1 -1
  212. package/lib/runtime/controller/plugin.js +1 -1
  213. package/lib/runtime/controller/plugin.js.map +1 -1
  214. package/lib/runtime/graph.d.ts +19 -6
  215. package/lib/runtime/graph.js +62 -27
  216. package/lib/runtime/graph.js.map +1 -1
  217. package/lib/runtime/hooks.d.ts +2 -2
  218. package/lib/runtime/hooks.js +2 -2
  219. package/lib/stdlib/behavior/create-edge.d.ts +1 -1
  220. package/lib/stdlib/behavior/drag-canvas.d.ts +1 -1
  221. package/lib/stdlib/behavior/drag-node.d.ts +1 -1
  222. package/lib/stdlib/behavior/drag-node.js +1 -1
  223. package/lib/stdlib/behavior/drag-node.js.map +1 -1
  224. package/lib/stdlib/behavior/hover-activate.d.ts +1 -1
  225. package/lib/stdlib/behavior/orbit-canvas-3d.d.ts +1 -1
  226. package/lib/stdlib/behavior/rotate-canvas-3d.d.ts +2 -2
  227. package/lib/stdlib/behavior/scroll-canvas.js +5 -5
  228. package/lib/stdlib/behavior/scroll-canvas.js.map +1 -1
  229. package/lib/stdlib/behavior/track-canvas-3d.d.ts +1 -1
  230. package/lib/stdlib/behavior/zoom-canvas-3d.d.ts +1 -1
  231. package/lib/stdlib/behavior/zoom-canvas.d.ts +16 -0
  232. package/lib/stdlib/behavior/zoom-canvas.js +106 -4
  233. package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
  234. package/lib/stdlib/data/transformV4Data.js +12 -6
  235. package/lib/stdlib/data/transformV4Data.js.map +1 -1
  236. package/lib/stdlib/index.d.ts +6 -4
  237. package/lib/stdlib/index.js +10 -8
  238. package/lib/stdlib/index.js.map +1 -1
  239. package/lib/stdlib/item/combo/circle.js +12 -7
  240. package/lib/stdlib/item/combo/circle.js.map +1 -1
  241. package/lib/stdlib/item/combo/rect.js +12 -7
  242. package/lib/stdlib/item/combo/rect.js.map +1 -1
  243. package/lib/stdlib/item/edge/base.d.ts +22 -5
  244. package/lib/stdlib/item/edge/base.js +48 -16
  245. package/lib/stdlib/item/edge/base.js.map +1 -1
  246. package/lib/stdlib/item/edge/cubic.js +11 -6
  247. package/lib/stdlib/item/edge/cubic.js.map +1 -1
  248. package/lib/stdlib/item/edge/line.js +12 -7
  249. package/lib/stdlib/item/edge/line.js.map +1 -1
  250. package/lib/stdlib/item/edge/loop.js +6 -1
  251. package/lib/stdlib/item/edge/loop.js.map +1 -1
  252. package/lib/stdlib/item/edge/polyline.js +11 -6
  253. package/lib/stdlib/item/edge/polyline.js.map +1 -1
  254. package/lib/stdlib/item/edge/quadratic.js +11 -6
  255. package/lib/stdlib/item/edge/quadratic.js.map +1 -1
  256. package/lib/stdlib/item/node/base.d.ts +24 -13
  257. package/lib/stdlib/item/node/base.js +90 -48
  258. package/lib/stdlib/item/node/base.js.map +1 -1
  259. package/lib/stdlib/item/node/base3d.d.ts +11 -2
  260. package/lib/stdlib/item/node/base3d.js +14 -3
  261. package/lib/stdlib/item/node/base3d.js.map +1 -1
  262. package/lib/stdlib/item/node/circle.js +13 -7
  263. package/lib/stdlib/item/node/circle.js.map +1 -1
  264. package/lib/stdlib/item/node/cube.d.ts +0 -2
  265. package/lib/stdlib/item/node/cube.js +12 -9
  266. package/lib/stdlib/item/node/cube.js.map +1 -1
  267. package/lib/stdlib/item/node/diamond.js +20 -11
  268. package/lib/stdlib/item/node/diamond.js.map +1 -1
  269. package/lib/stdlib/item/node/donut.js +18 -8
  270. package/lib/stdlib/item/node/donut.js.map +1 -1
  271. package/lib/stdlib/item/node/ellipse.js +11 -6
  272. package/lib/stdlib/item/node/ellipse.js.map +1 -1
  273. package/lib/stdlib/item/node/hexagon.js +12 -7
  274. package/lib/stdlib/item/node/hexagon.js.map +1 -1
  275. package/lib/stdlib/item/node/image.js +13 -3
  276. package/lib/stdlib/item/node/image.js.map +1 -1
  277. package/lib/stdlib/item/node/index.d.ts +1 -0
  278. package/lib/stdlib/item/node/index.js +1 -0
  279. package/lib/stdlib/item/node/index.js.map +1 -1
  280. package/lib/stdlib/item/node/modelRect.d.ts +33 -1
  281. package/lib/stdlib/item/node/modelRect.js +135 -78
  282. package/lib/stdlib/item/node/modelRect.js.map +1 -1
  283. package/lib/stdlib/item/node/plane.d.ts +38 -0
  284. package/lib/stdlib/item/node/plane.js +66 -0
  285. package/lib/stdlib/item/node/plane.js.map +1 -0
  286. package/lib/stdlib/item/node/rect.js +12 -7
  287. package/lib/stdlib/item/node/rect.js.map +1 -1
  288. package/lib/stdlib/item/node/sphere.js +12 -7
  289. package/lib/stdlib/item/node/sphere.js.map +1 -1
  290. package/lib/stdlib/item/node/star.d.ts +1 -3
  291. package/lib/stdlib/item/node/star.js +16 -10
  292. package/lib/stdlib/item/node/star.js.map +1 -1
  293. package/lib/stdlib/item/node/triangle.js +17 -7
  294. package/lib/stdlib/item/node/triangle.js.map +1 -1
  295. package/lib/stdlib/plugin/edgeBundling/index.d.ts +75 -0
  296. package/lib/stdlib/plugin/edgeBundling/index.js +368 -0
  297. package/lib/stdlib/plugin/edgeBundling/index.js.map +1 -0
  298. package/lib/stdlib/plugin/hull/bubbleset.d.ts +1 -1
  299. package/lib/stdlib/plugin/hull/bubbleset.js +13 -13
  300. package/lib/stdlib/plugin/hull/bubbleset.js.map +1 -1
  301. package/lib/stdlib/plugin/hull/index.js +4 -4
  302. package/lib/stdlib/plugin/hull/util.js +1 -1
  303. package/lib/stdlib/plugin/hull/util.js.map +1 -1
  304. package/lib/stdlib/plugin/index.d.ts +1 -0
  305. package/lib/stdlib/plugin/index.js +1 -0
  306. package/lib/stdlib/plugin/index.js.map +1 -1
  307. package/lib/stdlib/plugin/legend/index.d.ts +2 -2
  308. package/lib/stdlib/plugin/legend/index.js +10 -10
  309. package/lib/stdlib/plugin/legend/index.js.map +1 -1
  310. package/lib/stdlib/plugin/lodController/index.js +10 -8
  311. package/lib/stdlib/plugin/lodController/index.js.map +1 -1
  312. package/lib/stdlib/plugin/menu/index.js +1 -1
  313. package/lib/stdlib/plugin/menu/index.js.map +1 -1
  314. package/lib/stdlib/plugin/snapline/index.d.ts +2 -2
  315. package/lib/stdlib/plugin/snapline/index.js +2 -2
  316. package/lib/stdlib/plugin/snapline/index.js.map +1 -1
  317. package/lib/stdlib/plugin/tooltip/index.d.ts +1 -1
  318. package/lib/stdlib/plugin/tooltip/index.js +3 -3
  319. package/lib/stdlib/plugin/tooltip/index.js.map +1 -1
  320. package/lib/stdlib/plugin/{watermaker → watermarker}/index.d.ts +1 -1
  321. package/lib/stdlib/plugin/{watermaker → watermarker}/index.js +7 -7
  322. package/lib/stdlib/plugin/watermarker/index.js.map +1 -0
  323. package/lib/stdlib/selector/lasso.js +3 -3
  324. package/lib/stdlib/selector/lasso.js.map +1 -1
  325. package/lib/stdlib/theme/dark.js +1 -1
  326. package/lib/stdlib/theme/dark.js.map +1 -1
  327. package/lib/stdlib/theme/light.js +4 -1
  328. package/lib/stdlib/theme/light.js.map +1 -1
  329. package/lib/stdlib/themeSolver/spec.js +3 -3
  330. package/lib/stdlib/themeSolver/subject.d.ts +1 -1
  331. package/lib/stdlib/themeSolver/subject.js +1 -1
  332. package/lib/types/animate.d.ts +1 -1
  333. package/lib/types/data.d.ts +3 -1
  334. package/lib/types/graph.d.ts +54 -11
  335. package/lib/types/hook.d.ts +13 -3
  336. package/lib/types/index.d.ts +2 -1
  337. package/lib/types/index.js +3 -1
  338. package/lib/types/index.js.map +1 -1
  339. package/lib/types/item.d.ts +8 -10
  340. package/lib/types/item.js.map +1 -1
  341. package/lib/types/layout.d.ts +1 -1
  342. package/lib/types/node.d.ts +1 -31
  343. package/lib/types/plugin.d.ts +1 -1
  344. package/lib/types/plugin.js +1 -1
  345. package/lib/types/spec.d.ts +5 -5
  346. package/lib/types/theme.d.ts +1 -1
  347. package/lib/types/view.d.ts +1 -1
  348. package/lib/util/animate.js +1 -1
  349. package/lib/util/animate.js.map +1 -1
  350. package/lib/util/canvas.d.ts +1 -1
  351. package/lib/util/canvas.js +7 -1
  352. package/lib/util/canvas.js.map +1 -1
  353. package/lib/util/data.d.ts +10 -10
  354. package/lib/util/data.js +12 -11
  355. package/lib/util/data.js.map +1 -1
  356. package/lib/util/extend.js +4 -7
  357. package/lib/util/extend.js.map +1 -1
  358. package/lib/util/item.js +1 -1
  359. package/lib/util/item.js.map +1 -1
  360. package/lib/util/math.d.ts +1 -1
  361. package/lib/util/math.js +1 -1
  362. package/lib/util/path.d.ts +1 -1
  363. package/lib/util/path.js +1 -1
  364. package/lib/util/polyline.d.ts +2 -2
  365. package/lib/util/polyline.js +3 -3
  366. package/lib/util/polyline.js.map +1 -1
  367. package/lib/util/router.js +7 -7
  368. package/lib/util/router.js.map +1 -1
  369. package/lib/util/shape.d.ts +25 -13
  370. package/lib/util/shape.js +28 -19
  371. package/lib/util/shape.js.map +1 -1
  372. package/lib/util/shape3d.d.ts +2 -2
  373. package/lib/util/shape3d.js +9 -12
  374. package/lib/util/shape3d.js.map +1 -1
  375. package/package.json +37 -53
  376. package/src/index.ts +1 -1
  377. package/src/item/combo.ts +2 -1
  378. package/src/item/edge.ts +9 -2
  379. package/src/item/item.ts +21 -10
  380. package/src/item/node.ts +22 -6
  381. package/src/runtime/controller/data.ts +16 -14
  382. package/src/runtime/controller/interaction.ts +5 -4
  383. package/src/runtime/controller/item.ts +78 -36
  384. package/src/runtime/controller/layout.ts +7 -9
  385. package/src/runtime/controller/plugin.ts +1 -1
  386. package/src/runtime/graph.ts +128 -71
  387. package/src/runtime/hooks.ts +2 -2
  388. package/src/stdlib/behavior/create-edge.ts +1 -1
  389. package/src/stdlib/behavior/drag-canvas.ts +1 -1
  390. package/src/stdlib/behavior/drag-node.ts +1 -1
  391. package/src/stdlib/behavior/hover-activate.ts +1 -1
  392. package/src/stdlib/behavior/orbit-canvas-3d.ts +1 -1
  393. package/src/stdlib/behavior/rotate-canvas-3d.ts +2 -2
  394. package/src/stdlib/behavior/scroll-canvas.ts +5 -5
  395. package/src/stdlib/behavior/track-canvas-3d.ts +1 -1
  396. package/src/stdlib/behavior/zoom-canvas-3d.ts +1 -1
  397. package/src/stdlib/behavior/zoom-canvas.ts +134 -13
  398. package/src/stdlib/data/transformV4Data.ts +27 -3
  399. package/src/stdlib/index.ts +8 -4
  400. package/src/stdlib/item/combo/circle.ts +26 -11
  401. package/src/stdlib/item/combo/rect.ts +26 -11
  402. package/src/stdlib/item/edge/base.ts +45 -24
  403. package/src/stdlib/item/edge/cubic.ts +26 -4
  404. package/src/stdlib/item/edge/line.ts +27 -5
  405. package/src/stdlib/item/edge/loop.ts +6 -1
  406. package/src/stdlib/item/edge/polyline.ts +26 -4
  407. package/src/stdlib/item/edge/quadratic.ts +26 -4
  408. package/src/stdlib/item/node/base.ts +74 -48
  409. package/src/stdlib/item/node/base3d.ts +19 -3
  410. package/src/stdlib/item/node/circle.ts +29 -8
  411. package/src/stdlib/item/node/cube.ts +26 -12
  412. package/src/stdlib/item/node/diamond.ts +35 -11
  413. package/src/stdlib/item/node/donut.ts +32 -18
  414. package/src/stdlib/item/node/ellipse.ts +25 -11
  415. package/src/stdlib/item/node/hexagon.ts +27 -7
  416. package/src/stdlib/item/node/image.ts +13 -5
  417. package/src/stdlib/item/node/index.ts +1 -0
  418. package/src/stdlib/item/node/modelRect.ts +230 -136
  419. package/src/stdlib/item/node/plane.ts +121 -0
  420. package/src/stdlib/item/node/rect.ts +27 -7
  421. package/src/stdlib/item/node/sphere.ts +26 -10
  422. package/src/stdlib/item/node/star.ts +32 -11
  423. package/src/stdlib/item/node/triangle.ts +32 -9
  424. package/src/stdlib/plugin/edgeBundling/index.ts +529 -0
  425. package/src/stdlib/plugin/hull/bubbleset.ts +14 -14
  426. package/src/stdlib/plugin/hull/index.ts +4 -4
  427. package/src/stdlib/plugin/hull/util.ts +1 -1
  428. package/src/stdlib/plugin/index.ts +1 -0
  429. package/src/stdlib/plugin/legend/index.ts +11 -12
  430. package/src/stdlib/plugin/lodController/index.ts +9 -8
  431. package/src/stdlib/plugin/menu/index.ts +1 -1
  432. package/src/stdlib/plugin/snapline/index.ts +3 -3
  433. package/src/stdlib/plugin/tooltip/index.ts +4 -4
  434. package/src/stdlib/plugin/{watermaker → watermarker}/index.ts +8 -8
  435. package/src/stdlib/selector/lasso.ts +3 -3
  436. package/src/stdlib/theme/dark.ts +0 -1
  437. package/src/stdlib/theme/light.ts +3 -1
  438. package/src/stdlib/themeSolver/spec.ts +3 -3
  439. package/src/stdlib/themeSolver/subject.ts +1 -1
  440. package/src/types/animate.ts +2 -2
  441. package/src/types/data.ts +5 -1
  442. package/src/types/graph.ts +82 -11
  443. package/src/types/hook.ts +32 -3
  444. package/src/types/index.ts +2 -1
  445. package/src/types/item.ts +15 -16
  446. package/src/types/layout.ts +1 -1
  447. package/src/types/node.ts +1 -31
  448. package/src/types/plugin.ts +1 -1
  449. package/src/types/spec.ts +5 -5
  450. package/src/types/theme.ts +1 -1
  451. package/src/types/view.ts +1 -1
  452. package/src/util/animate.ts +1 -1
  453. package/src/util/canvas.ts +8 -0
  454. package/src/util/data.ts +12 -10
  455. package/src/util/extend.ts +1 -1
  456. package/src/util/item.ts +1 -1
  457. package/src/util/math.ts +1 -1
  458. package/src/util/path.ts +1 -1
  459. package/src/util/polyline.ts +3 -3
  460. package/src/util/router.ts +7 -7
  461. package/src/util/shape.ts +70 -33
  462. package/src/util/shape3d.ts +16 -10
  463. package/esm/stdlib/plugin/watermaker/index.js.map +0 -1
  464. package/lib/stdlib/plugin/watermaker/index.js.map +0 -1
@@ -8,7 +8,7 @@ const VALID_TRIGGERS = ['drag', 'directionKeys'];
8
8
 
9
9
  export interface TrackCanvas3DOptions {
10
10
  /**
11
- * The way to tranlate the canvas. 'drag' (default) means dragged by mouse, 'directionKeys' means the up/down/left/right key on keyBoard.
11
+ * The way to translate the canvas. 'drag' (default) means dragged by mouse, 'directionKeys' means the up/down/left/right key on keyBoard.
12
12
  */
13
13
  trigger?: 'drag' | 'directionKeys';
14
14
  /**
@@ -9,7 +9,7 @@ const VALID_TRIGGERS = ['wheel', 'upDownKeys'];
9
9
 
10
10
  export interface ZoomCanvas3DOptions {
11
11
  /**
12
- * The way to tranlate the canvas. 'drag' (default) means dragged by mouse, 'directionKeys' means the up/down/left/right key on keyBoard.
12
+ * The way to translate the canvas. 'drag' (default) means dragged by mouse, 'directionKeys' means the up/down/left/right key on keyBoard.
13
13
  */
14
14
  trigger?: 'wheel' | 'upDownKeys';
15
15
  /**
@@ -1,4 +1,4 @@
1
- import { isNumber } from '@antv/util';
1
+ import { isNumber, isBoolean } from '@antv/util';
2
2
  import { ID, IG6GraphEvent } from '../../types';
3
3
  import { Behavior } from '../../types/behavior';
4
4
 
@@ -46,14 +46,22 @@ export interface ZoomCanvasOptions {
46
46
  * Whether allow the behavior happen on the current item.
47
47
  */
48
48
  shouldBegin?: (event: IG6GraphEvent) => boolean;
49
-
50
- // TODO: fixSelectedItems, optimizeZoom
51
- // fixSelectedItems: {
52
- // fixAll: false,
53
- // fixLineWidth: false,
54
- // fixLabel: false,
55
- // fixState: 'selected',
56
- // },
49
+ /**
50
+ * Whether to fix the stroke thickness, text size, overall size, etc. of selected elements. false by default.
51
+ * @property {boolean} fixAll: fix the overall size of the element, higher priority than fixSelectedItems.fixLineWidth and fixSelectedItems.fixLabel;
52
+ * @property {boolean} fixLineWidth: fix the stroke thickness of keyShape;
53
+ * @property {boolean} fixLabel: fix the text size of labelShape, labelBackgroundShape;
54
+ * @property {string} fixState: the state of the element to be fixed. Default is `selected` ;
55
+ */
56
+ fixSelectedItems:
57
+ | boolean
58
+ | {
59
+ fixAll?: boolean;
60
+ fixLineWidth?: boolean;
61
+ fixLabel?: boolean;
62
+ fixState: string;
63
+ };
64
+ // TODO: optimizeZoom
57
65
  // optimizeZoom: hide shapes when zoom ratio is smaller than optimizeZoom
58
66
  }
59
67
 
@@ -68,6 +76,7 @@ const DEFAULT_OPTIONS: Required<ZoomCanvasOptions> = {
68
76
  minZoom: 0.00001,
69
77
  maxZoom: 1000,
70
78
  shouldBegin: () => true,
79
+ fixSelectedItems: false,
71
80
  };
72
81
 
73
82
  export class ZoomCanvas extends Behavior {
@@ -80,6 +89,16 @@ export class ZoomCanvas extends Behavior {
80
89
  private tileRequestId?: number;
81
90
  private lastWheelTriggerTime?: number;
82
91
 
92
+ private zoomCache: {
93
+ fixIds: Set<ID>;
94
+ balanceRatio?: Map<ID, number>;
95
+ lineWidth?: Map<ID, number>;
96
+ } = {
97
+ fixIds: new Set(),
98
+ balanceRatio: new Map(),
99
+ lineWidth: new Map(),
100
+ };
101
+
83
102
  constructor(options: Partial<ZoomCanvasOptions>) {
84
103
  const finalOptions = Object.assign({}, DEFAULT_OPTIONS, options);
85
104
  if (!VALID_TRIGGERS.includes(finalOptions.trigger)) {
@@ -88,6 +107,18 @@ export class ZoomCanvas extends Behavior {
88
107
  );
89
108
  finalOptions.trigger = 'wheel';
90
109
  }
110
+ const { fixSelectedItems } = finalOptions;
111
+ if (isBoolean(fixSelectedItems) && fixSelectedItems) {
112
+ finalOptions.fixSelectedItems = {
113
+ fixAll: true,
114
+ fixState: 'selected',
115
+ };
116
+ }
117
+ if (!isBoolean(fixSelectedItems)) {
118
+ if (!fixSelectedItems.fixState)
119
+ // @ts-ignore
120
+ finalOptions.fixSelectedItems.fixState = 'selected';
121
+ }
91
122
  super(finalOptions);
92
123
  }
93
124
 
@@ -124,10 +155,10 @@ export class ZoomCanvas extends Behavior {
124
155
  this.options.enableOptimize !== undefined
125
156
  ? this.options.enableOptimize
126
157
  : graphBehaviorOptimize;
127
- const shouldOptimze = isNumber(optimize)
158
+ const shouldOptimize = isNumber(optimize)
128
159
  ? graph.getAllNodesData().length > optimize
129
160
  : optimize;
130
- if (shouldOptimze) {
161
+ if (shouldOptimize) {
131
162
  this.hiddenEdgeIds = graph
132
163
  .getAllEdgesData()
133
164
  .map((edge) => edge.id)
@@ -169,11 +200,11 @@ export class ZoomCanvas extends Behavior {
169
200
  this.options.enableOptimize !== undefined
170
201
  ? this.options.enableOptimize
171
202
  : graphBehaviorOptimize;
172
- const shouldOptimze = isNumber(optimize)
203
+ const shouldOptimize = isNumber(optimize)
173
204
  ? graph.getAllNodesData().length > optimize
174
205
  : optimize;
175
206
  this.zooming = false;
176
- if (shouldOptimze) {
207
+ if (shouldOptimize) {
177
208
  if (this.tileRequestId) {
178
209
  cancelAnimationFrame(this.tileRequestId);
179
210
  this.tileRequestId = undefined;
@@ -233,6 +264,7 @@ export class ZoomCanvas extends Behavior {
233
264
  if (!this.zooming) {
234
265
  this.graph.canvas.getConfig().disableHitTesting = true;
235
266
  this.hideShapes();
267
+ this.clearCache();
236
268
  this.zooming = true;
237
269
  }
238
270
 
@@ -260,6 +292,11 @@ export class ZoomCanvas extends Behavior {
260
292
  if (minZoom && zoomTo < minZoom) return;
261
293
  if (maxZoom && zoomTo > maxZoom) return;
262
294
 
295
+ const { fixSelectedItems } = this.options;
296
+ if (fixSelectedItems) {
297
+ this.balanceItemSize();
298
+ }
299
+
263
300
  graph.zoom(zoomRatio, { x: client.x, y: client.y });
264
301
 
265
302
  this.lastWheelTriggerTime = now;
@@ -276,6 +313,90 @@ export class ZoomCanvas extends Behavior {
276
313
  }
277
314
  }
278
315
 
316
+ private clearCache() {
317
+ this.zoomCache.fixIds.forEach((fixId) => {
318
+ const item = this.graph.itemController.itemMap.get(fixId);
319
+ item.displayModel.labelShapeVisible = undefined;
320
+ });
321
+ this.zoomCache.fixIds.clear();
322
+ }
323
+
324
+ private balanceItemSize() {
325
+ const { graph } = this;
326
+ const zoom = graph.getZoom();
327
+
328
+ let fixNodeIds = [];
329
+ let fixEdgeIds = [];
330
+
331
+ if (zoom < 1) {
332
+ let typeArr = [];
333
+ const { fixSelectedItems } = this.options;
334
+ const { fixLabel, fixAll, fixLineWidth, fixState } = fixSelectedItems;
335
+ if (fixLabel) typeArr.push('labelSize');
336
+ if (fixLineWidth) typeArr.push('lineWidth');
337
+ if (fixAll) typeArr = ['fullSize'];
338
+
339
+ fixNodeIds = graph.findIdByState('node', fixState);
340
+ fixEdgeIds = graph.findIdByState('edge', fixState);
341
+
342
+ const fixIds = fixNodeIds.concat(fixEdgeIds);
343
+ if (!fixIds.length) return;
344
+ this.zoomCache.fixIds = new Set([...fixIds]);
345
+ fixIds.forEach((id) => {
346
+ const item = graph.itemController.itemMap.get(id);
347
+ const balanceRatio = 1 / zoom || 1;
348
+
349
+ const itemType = item.getType();
350
+ if (itemType === 'edge' && typeArr.includes('fullSize')) {
351
+ typeArr = ['labelSize', 'lineWidth'];
352
+ }
353
+
354
+ const balanceLabelShape = () => {
355
+ item.updateLabelPosition();
356
+ item.displayModel.labelShapeVisible = true;
357
+ graph.showItem(id, {
358
+ shapeIds: ['labelShape', 'labelBackgroundShape'],
359
+ disableAnimate: true,
360
+ });
361
+ };
362
+
363
+ typeArr.forEach((type) => {
364
+ switch (type) {
365
+ case 'lineWidth': {
366
+ const { keyShape } = item.shapeMap;
367
+ if (!this.zoomCache.lineWidth.has(id)) {
368
+ this.zoomCache.lineWidth.set(id, keyShape.attributes.lineWidth);
369
+ }
370
+ const oriLineWidth = this.zoomCache.lineWidth.get(id);
371
+ keyShape.attr('lineWidth', oriLineWidth * balanceRatio);
372
+ break;
373
+ }
374
+ case 'fullSize': {
375
+ const { group } = item;
376
+ const transform = group.style.transform;
377
+ if (!this.zoomCache.balanceRatio.has(id)) {
378
+ const oriBalanceRatio =
379
+ Number(transform?.match(/scale\(([\d.]+),/)?.[1]) || 1;
380
+ this.zoomCache.balanceRatio.set(id, oriBalanceRatio);
381
+ }
382
+ const balanceRatioCache = this.zoomCache.balanceRatio.get(id);
383
+ const newBalanceRatio = balanceRatioCache * balanceRatio;
384
+ group.style.transform = `scale(${newBalanceRatio}, ${newBalanceRatio})`;
385
+ balanceLabelShape();
386
+ break;
387
+ }
388
+ case 'labelSize': {
389
+ balanceLabelShape();
390
+ break;
391
+ }
392
+ default:
393
+ break;
394
+ }
395
+ });
396
+ });
397
+ }
398
+ }
399
+
279
400
  public onKeydown(event) {
280
401
  const { key } = event;
281
402
  const {
@@ -33,6 +33,11 @@ const handler = (
33
33
  ): GraphData => {
34
34
  const { nodes = [], edges = [], combos = [] } = data;
35
35
  const formattedNodes = nodes.map((node: any) => {
36
+ const prevNode = graphCore?.getNode(node.id);
37
+ const mergedNode = {
38
+ ...prevNode,
39
+ ...node,
40
+ };
36
41
  const {
37
42
  id,
38
43
  type,
@@ -43,8 +48,9 @@ const handler = (
43
48
  labelCfg = {},
44
49
  icon,
45
50
  linkPoints,
51
+ data = {},
46
52
  ...others
47
- } = node;
53
+ } = mergedNode;
48
54
  const anchorShapes = [];
49
55
  if (linkPoints) {
50
56
  const { top, bottom, left, right, ...otherAnchorShapeStyles } =
@@ -60,9 +66,11 @@ const handler = (
60
66
  id,
61
67
  data: {
62
68
  ...others,
69
+ ...data,
63
70
  labelShape: {
64
71
  ...labelStyle,
65
72
  ...otherLabelStyle,
73
+ ...data.labelShape,
66
74
  },
67
75
  },
68
76
  };
@@ -100,6 +108,11 @@ const handler = (
100
108
  });
101
109
 
102
110
  const formattedEdges = edges.map((edge: any) => {
111
+ const prevEdge = graphCore?.getEdge(edge.id);
112
+ const mergedEdge = {
113
+ ...prevEdge,
114
+ ...edge,
115
+ };
103
116
  const {
104
117
  id = uniqueId(),
105
118
  type,
@@ -112,8 +125,9 @@ const handler = (
112
125
  labelCfg = {},
113
126
  icon,
114
127
  linkPoints,
128
+ data = {},
115
129
  ...others
116
- } = edge;
130
+ } = mergedEdge;
117
131
  const { style: labelStyle = {}, ...otherLabelStyle } = labelCfg;
118
132
  const { background } = labelStyle;
119
133
  const newEdge = {
@@ -122,9 +136,11 @@ const handler = (
122
136
  target,
123
137
  data: {
124
138
  ...others,
139
+ ...data,
125
140
  labelShape: {
126
141
  ...labelStyle,
127
142
  ...otherLabelStyle,
143
+ ...data.labelShape,
128
144
  },
129
145
  },
130
146
  };
@@ -152,6 +168,11 @@ const handler = (
152
168
  });
153
169
 
154
170
  const formattedCombos = combos.map((combo: any) => {
171
+ const prevCombo = graphCore?.getNode(combo.id);
172
+ const mergedCombo = {
173
+ ...prevCombo,
174
+ ...combo,
175
+ };
155
176
  const {
156
177
  id,
157
178
  type,
@@ -162,17 +183,20 @@ const handler = (
162
183
  labelCfg = {},
163
184
  icon,
164
185
  linkPoints,
186
+ data = {},
165
187
  ...others
166
- } = combo;
188
+ } = mergedCombo;
167
189
  const { style: labelStyle = {}, ...otherLabelStyle } = labelCfg;
168
190
  const { background } = labelStyle;
169
191
  const newCombo = {
170
192
  id,
171
193
  data: {
172
194
  ...others,
195
+ ...data,
173
196
  labelShape: {
174
197
  ...labelStyle,
175
198
  ...otherLabelStyle,
199
+ ...data.labelShape,
176
200
  },
177
201
  },
178
202
  };
@@ -34,6 +34,7 @@ const {
34
34
  ModelRectNode,
35
35
  ImageNode,
36
36
  CubeNode,
37
+ PlaneNode,
37
38
  BaseNode,
38
39
  BaseNode3D,
39
40
  } = Nodes;
@@ -82,6 +83,7 @@ const {
82
83
  Snapline,
83
84
  EdgeFilterLens,
84
85
  LodController,
86
+ EdgeBundling,
85
87
  } = Plugins;
86
88
 
87
89
  const {
@@ -102,7 +104,7 @@ const {
102
104
  import lassoSelector from './selector/lasso';
103
105
  import rectSelector from './selector/rect';
104
106
  import Hull from './plugin/hull';
105
- import { WaterMarker } from './plugin/watermaker';
107
+ import { WaterMarker } from './plugin/watermarker';
106
108
 
107
109
  const stdLib = {
108
110
  transforms: {
@@ -211,7 +213,7 @@ const utils = {
211
213
  lassoSelector,
212
214
  };
213
215
 
214
- const registery = { useLib };
216
+ const registry = { useLib };
215
217
 
216
218
  const Extensions = {
217
219
  // transforms
@@ -255,6 +257,7 @@ const Extensions = {
255
257
  EllipseNode,
256
258
  ModelRectNode,
257
259
  CubeNode,
260
+ PlaneNode,
258
261
  BaseNode,
259
262
  BaseNode3D,
260
263
  // edges
@@ -303,7 +306,8 @@ const Extensions = {
303
306
  Snapline,
304
307
  EdgeFilterLens,
305
308
  WaterMarker,
309
+ EdgeBundling,
306
310
  };
307
311
 
308
- export default registery;
309
- export { Extensions, registery, stdLib, utils };
312
+ export default registry;
313
+ export { Extensions, registry, stdLib, utils };
@@ -32,16 +32,26 @@ export class CircleCombo extends BaseNode {
32
32
  let shapes: ComboShapeMap = { keyShape: undefined };
33
33
 
34
34
  // keyShape
35
- shapes.keyShape = this.drawKeyShape(model, shapeMap, diffData);
35
+ shapes.keyShape = this.drawKeyShape(model, shapeMap, diffData, diffState);
36
36
 
37
37
  // haloShape
38
38
  if (data.haloShape && this.drawHaloShape) {
39
- shapes.haloShape = this.drawHaloShape(model, shapeMap, diffData);
39
+ shapes.haloShape = this.drawHaloShape(
40
+ model,
41
+ shapeMap,
42
+ diffData,
43
+ diffState,
44
+ );
40
45
  }
41
46
 
42
47
  // labelShape
43
48
  if (data.labelShape) {
44
- shapes.labelShape = this.drawLabelShape(model, shapeMap, diffData);
49
+ shapes.labelShape = this.drawLabelShape(
50
+ model,
51
+ shapeMap,
52
+ diffData,
53
+ diffState,
54
+ );
45
55
  }
46
56
 
47
57
  // labelBackgroundShape
@@ -50,6 +60,7 @@ export class CircleCombo extends BaseNode {
50
60
  model,
51
61
  shapeMap,
52
62
  diffData,
63
+ diffState,
53
64
  );
54
65
  }
55
66
 
@@ -69,7 +80,12 @@ export class CircleCombo extends BaseNode {
69
80
 
70
81
  // iconShape
71
82
  if (data.iconShape) {
72
- shapes.iconShape = this.drawIconShape(model, shapeMap, diffData);
83
+ shapes.iconShape = this.drawIconShape(
84
+ model,
85
+ shapeMap,
86
+ diffData,
87
+ diffState,
88
+ );
73
89
  }
74
90
 
75
91
  // badgeShape
@@ -90,7 +106,7 @@ export class CircleCombo extends BaseNode {
90
106
  if (data.otherShapes && this.drawOtherShapes) {
91
107
  shapes = {
92
108
  ...shapes,
93
- ...this.drawOtherShapes(model, shapeMap, diffData),
109
+ ...this.drawOtherShapes(model, shapeMap, diffData, diffState),
94
110
  };
95
111
  }
96
112
  return shapes;
@@ -102,12 +118,11 @@ export class CircleCombo extends BaseNode {
102
118
  diffData?: { previous: ComboModelData; current: ComboModelData },
103
119
  diffState?: { previous: State[]; current: State[] },
104
120
  ): DisplayObject {
105
- return this.upsertShape(
106
- 'circle',
107
- 'keyShape',
108
- this.mergedStyles.keyShape,
109
- shapeMap,
121
+ return this.upsertShape('circle', 'keyShape', this.mergedStyles.keyShape, {
110
122
  model,
111
- );
123
+ shapeMap,
124
+ diffData,
125
+ diffState,
126
+ });
112
127
  }
113
128
  }
@@ -33,16 +33,26 @@ export class RectCombo extends BaseNode {
33
33
  let shapes: ComboShapeMap = { keyShape: undefined };
34
34
 
35
35
  // keyShape
36
- shapes.keyShape = this.drawKeyShape(model, shapeMap, diffData);
36
+ shapes.keyShape = this.drawKeyShape(model, shapeMap, diffData, diffState);
37
37
 
38
38
  // haloShape
39
39
  if (data.haloShape && this.drawHaloShape) {
40
- shapes.haloShape = this.drawHaloShape(model, shapeMap, diffData);
40
+ shapes.haloShape = this.drawHaloShape(
41
+ model,
42
+ shapeMap,
43
+ diffData,
44
+ diffState,
45
+ );
41
46
  }
42
47
 
43
48
  // labelShape
44
49
  if (data.labelShape) {
45
- shapes.labelShape = this.drawLabelShape(model, shapeMap, diffData);
50
+ shapes.labelShape = this.drawLabelShape(
51
+ model,
52
+ shapeMap,
53
+ diffData,
54
+ diffState,
55
+ );
46
56
  }
47
57
 
48
58
  // labelBackgroundShape
@@ -51,6 +61,7 @@ export class RectCombo extends BaseNode {
51
61
  model,
52
62
  shapeMap,
53
63
  diffData,
64
+ diffState,
54
65
  );
55
66
  }
56
67
 
@@ -70,7 +81,12 @@ export class RectCombo extends BaseNode {
70
81
 
71
82
  // iconShape
72
83
  if (data.iconShape) {
73
- shapes.iconShape = this.drawIconShape(model, shapeMap, diffData);
84
+ shapes.iconShape = this.drawIconShape(
85
+ model,
86
+ shapeMap,
87
+ diffData,
88
+ diffState,
89
+ );
74
90
  }
75
91
 
76
92
  // badgeShape
@@ -91,7 +107,7 @@ export class RectCombo extends BaseNode {
91
107
  if (data.otherShapes && this.drawOtherShapes) {
92
108
  shapes = {
93
109
  ...shapes,
94
- ...this.drawOtherShapes(model, shapeMap, diffData),
110
+ ...this.drawOtherShapes(model, shapeMap, diffData, diffState),
95
111
  };
96
112
  }
97
113
  return shapes;
@@ -103,13 +119,12 @@ export class RectCombo extends BaseNode {
103
119
  diffData?: { previous: ComboModelData; current: ComboModelData },
104
120
  diffState?: { previous: State[]; current: State[] },
105
121
  ): DisplayObject {
106
- return this.upsertShape(
107
- 'rect',
108
- 'keyShape',
109
- this.mergedStyles.keyShape,
110
- shapeMap,
122
+ return this.upsertShape('rect', 'keyShape', this.mergedStyles.keyShape, {
111
123
  model,
112
- );
124
+ shapeMap,
125
+ diffData,
126
+ diffState,
127
+ });
113
128
  }
114
129
 
115
130
  public getMergedStyles(model: ComboDisplayModel) {
@@ -20,6 +20,7 @@ import {
20
20
  ShapeStyle,
21
21
  State,
22
22
  LodLevelRanges,
23
+ ItemModelData,
23
24
  } from '../../../types/item';
24
25
  import { formatPadding, mergeStyles, upsertShape } from '../../../util/shape';
25
26
  import { DEFAULT_ANIMATE_CFG, fadeIn, fadeOut } from '../../../util/animate';
@@ -48,7 +49,7 @@ export abstract class BaseEdge {
48
49
  labelBackgroundShapeTransform?: string;
49
50
  };
50
51
  // cache the zoom level infomations
51
- private zoomCache: {
52
+ #zoomCache: {
52
53
  // last responsed zoom ratio.
53
54
  zoom: number;
54
55
  // wordWrapWidth of labelShape according to the maxWidth
@@ -62,7 +63,7 @@ export abstract class BaseEdge {
62
63
  if (themeStyles) this.themeStyles = themeStyles;
63
64
  this.lodLevels = lodLevels;
64
65
  this.transformCache = {};
65
- this.zoomCache.zoom = zoom;
66
+ this.#zoomCache.zoom = zoom;
66
67
  }
67
68
 
68
69
  /**
@@ -119,16 +120,16 @@ export abstract class BaseEdge {
119
120
  }
120
121
  });
121
122
 
122
- const { zoom } = this.zoomCache;
123
+ const { zoom } = this.#zoomCache;
123
124
 
124
125
  const { maxWidth = '60%' } = this.mergedStyles.labelShape || {};
125
- this.zoomCache.wordWrapWidth = getWordWrapWidthByEnds(
126
+ this.#zoomCache.wordWrapWidth = getWordWrapWidthByEnds(
126
127
  [this.sourcePoint, this.targetPoint],
127
128
  maxWidth,
128
129
  1,
129
130
  );
130
131
 
131
- this.zoomCache.zoom = 1;
132
+ this.#zoomCache.zoom = 1;
132
133
  if (zoom !== 1) this.onZoom(shapeMap, zoom);
133
134
  }
134
135
 
@@ -165,7 +166,9 @@ export abstract class BaseEdge {
165
166
  public afterDraw(
166
167
  model: EdgeDisplayModel,
167
168
  shapeMap: { [shapeId: string]: DisplayObject },
168
- shapesChanged?: string[],
169
+ // shapesChanged?: string[],
170
+ diffData?: { previous: EdgeModelData; current: EdgeModelData },
171
+ diffState?: { previous: State[]; current: State[] },
169
172
  ): { [otherShapeId: string]: DisplayObject } {
170
173
  return {};
171
174
  }
@@ -285,9 +288,9 @@ export abstract class BaseEdge {
285
288
  const wordWrapWidth = getWordWrapWidthByEnds(
286
289
  [this.sourcePoint, this.targetPoint],
287
290
  maxWidth,
288
- this.zoomCache.zoom,
291
+ this.#zoomCache.zoom,
289
292
  );
290
- this.zoomCache.wordWrapWidth = wordWrapWidth;
293
+ this.#zoomCache.wordWrapWidth = wordWrapWidth;
291
294
  const style = {
292
295
  ...this.defaultStyles.labelShape,
293
296
  textAlign: positionPreset.textAlign,
@@ -297,7 +300,12 @@ export abstract class BaseEdge {
297
300
  ...otherStyle,
298
301
  };
299
302
  this.transformCache.labelShapeTransform = style.transform;
300
- return this.upsertShape('text', 'labelShape', style, shapeMap, model);
303
+ return this.upsertShape('text', 'labelShape', style, {
304
+ model,
305
+ shapeMap,
306
+ diffData,
307
+ diffState,
308
+ });
301
309
  }
302
310
 
303
311
  /**
@@ -356,13 +364,12 @@ export abstract class BaseEdge {
356
364
  }`;
357
365
  }
358
366
 
359
- return this.upsertShape(
360
- 'rect',
361
- 'labelBackgroundShape',
362
- bgStyle,
363
- shapeMap,
367
+ return this.upsertShape('rect', 'labelBackgroundShape', bgStyle, {
364
368
  model,
365
- );
369
+ shapeMap,
370
+ diffData,
371
+ diffState,
372
+ });
366
373
  }
367
374
 
368
375
  /**
@@ -448,8 +455,12 @@ export abstract class BaseEdge {
448
455
  iconShapeType,
449
456
  'iconShape',
450
457
  shapeStyle as GShapeStyle,
451
- shapeMap,
452
- model,
458
+ {
459
+ model,
460
+ shapeMap,
461
+ diffData,
462
+ diffState,
463
+ },
453
464
  );
454
465
  }
455
466
 
@@ -479,8 +490,12 @@ export abstract class BaseEdge {
479
490
  stroke: attributes.stroke,
480
491
  ...haloShapeStyle,
481
492
  },
482
- shapeMap,
483
- model,
493
+ {
494
+ model,
495
+ shapeMap,
496
+ diffData,
497
+ diffState,
498
+ },
484
499
  );
485
500
  }
486
501
 
@@ -571,8 +586,10 @@ export abstract class BaseEdge {
571
586
  transformOrigin: 'center',
572
587
  ...others,
573
588
  },
574
- {},
575
- model,
589
+ {
590
+ model,
591
+ shapeMap: {},
592
+ },
576
593
  );
577
594
  resultStyle[`${markerField}Offset`] = width / 2 + offset;
578
595
  }
@@ -590,9 +607,13 @@ export abstract class BaseEdge {
590
607
  type: SHAPE_TYPE,
591
608
  id: string,
592
609
  style: ShapeStyle,
593
- shapeMap: { [shapeId: string]: DisplayObject },
594
- model: EdgeDisplayModel,
610
+ config: {
611
+ model: EdgeDisplayModel;
612
+ shapeMap?: { [k: string]: DisplayObject<any, any> };
613
+ diffData?: { previous: EdgeModelData; current: EdgeModelData };
614
+ diffState?: { previous: State[]; current: State[] };
615
+ },
595
616
  ): DisplayObject {
596
- return upsertShape(type, id, style as GShapeStyle, shapeMap, model);
617
+ return upsertShape(type, id, style as GShapeStyle, config);
597
618
  }
598
619
  }