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

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 (324) hide show
  1. package/dist/g6.min.js +2 -2
  2. package/esm/constant/shape.d.ts +1 -1
  3. package/esm/index.d.ts +3 -1
  4. package/esm/index.js +1 -1
  5. package/esm/item/combo.d.ts +6 -4
  6. package/esm/item/combo.js +10 -3
  7. package/esm/item/combo.js.map +1 -1
  8. package/esm/item/edge.d.ts +12 -4
  9. package/esm/item/edge.js +100 -17
  10. package/esm/item/edge.js.map +1 -1
  11. package/esm/item/item.d.ts +18 -8
  12. package/esm/item/item.js +103 -59
  13. package/esm/item/item.js.map +1 -1
  14. package/esm/item/node.d.ts +10 -4
  15. package/esm/item/node.js +92 -8
  16. package/esm/item/node.js.map +1 -1
  17. package/esm/runtime/controller/data.d.ts +5 -1
  18. package/esm/runtime/controller/data.js +38 -1
  19. package/esm/runtime/controller/data.js.map +1 -1
  20. package/esm/runtime/controller/index.d.ts +1 -1
  21. package/esm/runtime/controller/index.js +1 -1
  22. package/esm/runtime/controller/index.js.map +1 -1
  23. package/esm/runtime/controller/item.d.ts +22 -11
  24. package/esm/runtime/controller/item.js +241 -96
  25. package/esm/runtime/controller/item.js.map +1 -1
  26. package/esm/runtime/controller/layout.d.ts +3 -0
  27. package/esm/runtime/controller/layout.js +178 -98
  28. package/esm/runtime/controller/layout.js.map +1 -1
  29. package/esm/runtime/controller/plugin.d.ts +3 -0
  30. package/esm/runtime/controller/plugin.js +66 -24
  31. package/esm/runtime/controller/plugin.js.map +1 -1
  32. package/esm/runtime/controller/viewport.js +9 -2
  33. package/esm/runtime/controller/viewport.js.map +1 -1
  34. package/esm/runtime/graph.d.ts +57 -26
  35. package/esm/runtime/graph.js +263 -139
  36. package/esm/runtime/graph.js.map +1 -1
  37. package/esm/stdlib/behavior/click-select.js +9 -3
  38. package/esm/stdlib/behavior/click-select.js.map +1 -1
  39. package/esm/stdlib/behavior/drag-canvas.js +6 -3
  40. package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
  41. package/esm/stdlib/behavior/drag-combo.js +8 -8
  42. package/esm/stdlib/behavior/drag-combo.js.map +1 -1
  43. package/esm/stdlib/behavior/drag-node.d.ts +4 -0
  44. package/esm/stdlib/behavior/drag-node.js +121 -27
  45. package/esm/stdlib/behavior/drag-node.js.map +1 -1
  46. package/esm/stdlib/behavior/scroll-canvas.js +3 -3
  47. package/esm/stdlib/behavior/scroll-canvas.js.map +1 -1
  48. package/esm/stdlib/behavior/zoom-canvas.js +3 -3
  49. package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
  50. package/esm/stdlib/data/mapNodeSize.js +2 -2
  51. package/esm/stdlib/data/mapNodeSize.js.map +1 -1
  52. package/esm/stdlib/data/validateData.js +2 -2
  53. package/esm/stdlib/data/validateData.js.map +1 -1
  54. package/esm/stdlib/index.d.ts +2 -0
  55. package/esm/stdlib/index.js +3 -1
  56. package/esm/stdlib/index.js.map +1 -1
  57. package/esm/stdlib/item/edge/base.d.ts +2 -11
  58. package/esm/stdlib/item/edge/base.js +12 -105
  59. package/esm/stdlib/item/edge/base.js.map +1 -1
  60. package/esm/stdlib/item/node/base.d.ts +2 -20
  61. package/esm/stdlib/item/node/base.js +10 -150
  62. package/esm/stdlib/item/node/base.js.map +1 -1
  63. package/esm/stdlib/plugin/edgeFilterLens/index.js +2 -2
  64. package/esm/stdlib/plugin/edgeFilterLens/index.js.map +1 -1
  65. package/esm/stdlib/plugin/fisheye/index.js +3 -2
  66. package/esm/stdlib/plugin/fisheye/index.js.map +1 -1
  67. package/esm/stdlib/plugin/history/visibility-updated-command.js +2 -2
  68. package/esm/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
  69. package/esm/stdlib/plugin/hull/index.d.ts +1 -1
  70. package/esm/stdlib/plugin/index.d.ts +1 -0
  71. package/esm/stdlib/plugin/index.js +1 -0
  72. package/esm/stdlib/plugin/index.js.map +1 -1
  73. package/esm/stdlib/plugin/lodController/index.d.ts +73 -0
  74. package/esm/stdlib/plugin/lodController/index.js +556 -0
  75. package/esm/stdlib/plugin/lodController/index.js.map +1 -0
  76. package/esm/stdlib/plugin/minimap/index.js +12 -14
  77. package/esm/stdlib/plugin/minimap/index.js.map +1 -1
  78. package/esm/stdlib/plugin/toolbar/index.d.ts +2 -2
  79. package/esm/stdlib/plugin/toolbar/index.js +27 -29
  80. package/esm/stdlib/plugin/toolbar/index.js.map +1 -1
  81. package/esm/stdlib/theme/dark.js +32 -35
  82. package/esm/stdlib/theme/dark.js.map +1 -1
  83. package/esm/stdlib/theme/light.js +27 -30
  84. package/esm/stdlib/theme/light.js.map +1 -1
  85. package/esm/stdlib/themeSolver/spec.js +2 -2
  86. package/esm/stdlib/themeSolver/spec.js.map +1 -1
  87. package/esm/types/animate.d.ts +1 -1
  88. package/esm/types/combo.d.ts +2 -2
  89. package/esm/types/edge.d.ts +2 -2
  90. package/esm/types/graph.d.ts +62 -43
  91. package/esm/types/hook.d.ts +5 -0
  92. package/esm/types/item.d.ts +9 -15
  93. package/esm/types/layout.d.ts +7 -2
  94. package/esm/types/layout.js.map +1 -1
  95. package/esm/types/node.d.ts +3 -2
  96. package/esm/types/plugin.d.ts +1 -0
  97. package/esm/types/plugin.js +1 -0
  98. package/esm/types/plugin.js.map +1 -1
  99. package/esm/types/spec.d.ts +1 -0
  100. package/esm/types/theme.d.ts +7 -7
  101. package/esm/util/animate.d.ts +7 -2
  102. package/esm/util/animate.js +37 -23
  103. package/esm/util/animate.js.map +1 -1
  104. package/esm/util/bbox.d.ts +7 -1
  105. package/esm/util/bbox.js +16 -0
  106. package/esm/util/bbox.js.map +1 -1
  107. package/esm/util/data.d.ts +7 -1
  108. package/esm/util/data.js +17 -5
  109. package/esm/util/data.js.map +1 -1
  110. package/esm/util/dom.js +5 -5
  111. package/esm/util/dom.js.map +1 -1
  112. package/esm/util/item.d.ts +1 -1
  113. package/esm/util/item.js +8 -8
  114. package/esm/util/item.js.map +1 -1
  115. package/esm/util/mapper.js +1 -1
  116. package/esm/util/mapper.js.map +1 -1
  117. package/esm/util/path.d.ts +6 -1
  118. package/esm/util/path.js +72 -1
  119. package/esm/util/path.js.map +1 -1
  120. package/esm/util/polyline.d.ts +10 -0
  121. package/esm/util/polyline.js +22 -17
  122. package/esm/util/polyline.js.map +1 -1
  123. package/esm/util/router.d.ts +1 -1
  124. package/esm/util/router.js +19 -18
  125. package/esm/util/router.js.map +1 -1
  126. package/esm/util/shape.d.ts +1 -1
  127. package/esm/util/shape.js +28 -13
  128. package/esm/util/shape.js.map +1 -1
  129. package/esm/util/zoom.d.ts +5 -8
  130. package/esm/util/zoom.js +15 -20
  131. package/esm/util/zoom.js.map +1 -1
  132. package/lib/constant/shape.d.ts +1 -1
  133. package/lib/index.d.ts +3 -1
  134. package/lib/index.js +1 -1
  135. package/lib/item/combo.d.ts +6 -4
  136. package/lib/item/combo.js +10 -3
  137. package/lib/item/combo.js.map +1 -1
  138. package/lib/item/edge.d.ts +12 -4
  139. package/lib/item/edge.js +99 -16
  140. package/lib/item/edge.js.map +1 -1
  141. package/lib/item/item.d.ts +18 -8
  142. package/lib/item/item.js +101 -57
  143. package/lib/item/item.js.map +1 -1
  144. package/lib/item/node.d.ts +10 -4
  145. package/lib/item/node.js +92 -8
  146. package/lib/item/node.js.map +1 -1
  147. package/lib/runtime/controller/data.d.ts +5 -1
  148. package/lib/runtime/controller/data.js +38 -1
  149. package/lib/runtime/controller/data.js.map +1 -1
  150. package/lib/runtime/controller/index.d.ts +1 -1
  151. package/lib/runtime/controller/index.js +1 -1
  152. package/lib/runtime/controller/index.js.map +1 -1
  153. package/lib/runtime/controller/item.d.ts +22 -11
  154. package/lib/runtime/controller/item.js +238 -93
  155. package/lib/runtime/controller/item.js.map +1 -1
  156. package/lib/runtime/controller/layout.d.ts +3 -0
  157. package/lib/runtime/controller/layout.js +178 -98
  158. package/lib/runtime/controller/layout.js.map +1 -1
  159. package/lib/runtime/controller/plugin.d.ts +3 -0
  160. package/lib/runtime/controller/plugin.js +66 -24
  161. package/lib/runtime/controller/plugin.js.map +1 -1
  162. package/lib/runtime/controller/viewport.js +9 -2
  163. package/lib/runtime/controller/viewport.js.map +1 -1
  164. package/lib/runtime/graph.d.ts +57 -26
  165. package/lib/runtime/graph.js +263 -139
  166. package/lib/runtime/graph.js.map +1 -1
  167. package/lib/stdlib/behavior/click-select.js +9 -3
  168. package/lib/stdlib/behavior/click-select.js.map +1 -1
  169. package/lib/stdlib/behavior/drag-canvas.js +6 -3
  170. package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
  171. package/lib/stdlib/behavior/drag-combo.js +8 -8
  172. package/lib/stdlib/behavior/drag-combo.js.map +1 -1
  173. package/lib/stdlib/behavior/drag-node.d.ts +4 -0
  174. package/lib/stdlib/behavior/drag-node.js +121 -27
  175. package/lib/stdlib/behavior/drag-node.js.map +1 -1
  176. package/lib/stdlib/behavior/scroll-canvas.js +3 -3
  177. package/lib/stdlib/behavior/scroll-canvas.js.map +1 -1
  178. package/lib/stdlib/behavior/zoom-canvas.js +3 -3
  179. package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
  180. package/lib/stdlib/data/mapNodeSize.js +2 -2
  181. package/lib/stdlib/data/mapNodeSize.js.map +1 -1
  182. package/lib/stdlib/data/validateData.js +2 -2
  183. package/lib/stdlib/data/validateData.js.map +1 -1
  184. package/lib/stdlib/index.d.ts +2 -0
  185. package/lib/stdlib/index.js +3 -1
  186. package/lib/stdlib/index.js.map +1 -1
  187. package/lib/stdlib/item/edge/base.d.ts +2 -11
  188. package/lib/stdlib/item/edge/base.js +12 -105
  189. package/lib/stdlib/item/edge/base.js.map +1 -1
  190. package/lib/stdlib/item/node/base.d.ts +2 -20
  191. package/lib/stdlib/item/node/base.js +10 -150
  192. package/lib/stdlib/item/node/base.js.map +1 -1
  193. package/lib/stdlib/plugin/edgeFilterLens/index.js +2 -2
  194. package/lib/stdlib/plugin/edgeFilterLens/index.js.map +1 -1
  195. package/lib/stdlib/plugin/fisheye/index.js +2 -1
  196. package/lib/stdlib/plugin/fisheye/index.js.map +1 -1
  197. package/lib/stdlib/plugin/history/visibility-updated-command.js +2 -2
  198. package/lib/stdlib/plugin/history/visibility-updated-command.js.map +1 -1
  199. package/lib/stdlib/plugin/hull/index.d.ts +1 -1
  200. package/lib/stdlib/plugin/index.d.ts +1 -0
  201. package/lib/stdlib/plugin/index.js +1 -0
  202. package/lib/stdlib/plugin/index.js.map +1 -1
  203. package/lib/stdlib/plugin/lodController/index.d.ts +73 -0
  204. package/lib/stdlib/plugin/lodController/index.js +560 -0
  205. package/lib/stdlib/plugin/lodController/index.js.map +1 -0
  206. package/lib/stdlib/plugin/minimap/index.js +12 -14
  207. package/lib/stdlib/plugin/minimap/index.js.map +1 -1
  208. package/lib/stdlib/plugin/toolbar/index.d.ts +2 -2
  209. package/lib/stdlib/plugin/toolbar/index.js +27 -29
  210. package/lib/stdlib/plugin/toolbar/index.js.map +1 -1
  211. package/lib/stdlib/theme/dark.js +32 -35
  212. package/lib/stdlib/theme/dark.js.map +1 -1
  213. package/lib/stdlib/theme/light.js +27 -30
  214. package/lib/stdlib/theme/light.js.map +1 -1
  215. package/lib/stdlib/themeSolver/spec.js +2 -2
  216. package/lib/stdlib/themeSolver/spec.js.map +1 -1
  217. package/lib/types/animate.d.ts +1 -1
  218. package/lib/types/combo.d.ts +2 -2
  219. package/lib/types/edge.d.ts +2 -2
  220. package/lib/types/graph.d.ts +62 -43
  221. package/lib/types/hook.d.ts +5 -0
  222. package/lib/types/item.d.ts +9 -15
  223. package/lib/types/layout.d.ts +7 -2
  224. package/lib/types/layout.js.map +1 -1
  225. package/lib/types/node.d.ts +3 -2
  226. package/lib/types/plugin.d.ts +1 -0
  227. package/lib/types/plugin.js +1 -0
  228. package/lib/types/plugin.js.map +1 -1
  229. package/lib/types/spec.d.ts +1 -0
  230. package/lib/types/theme.d.ts +7 -7
  231. package/lib/util/animate.d.ts +7 -2
  232. package/lib/util/animate.js +37 -23
  233. package/lib/util/animate.js.map +1 -1
  234. package/lib/util/bbox.d.ts +7 -1
  235. package/lib/util/bbox.js +18 -1
  236. package/lib/util/bbox.js.map +1 -1
  237. package/lib/util/data.d.ts +7 -1
  238. package/lib/util/data.js +19 -6
  239. package/lib/util/data.js.map +1 -1
  240. package/lib/util/dom.js +5 -5
  241. package/lib/util/dom.js.map +1 -1
  242. package/lib/util/item.d.ts +1 -1
  243. package/lib/util/item.js +8 -8
  244. package/lib/util/item.js.map +1 -1
  245. package/lib/util/mapper.js +1 -1
  246. package/lib/util/mapper.js.map +1 -1
  247. package/lib/util/path.d.ts +6 -1
  248. package/lib/util/path.js +72 -1
  249. package/lib/util/path.js.map +1 -1
  250. package/lib/util/polyline.d.ts +10 -0
  251. package/lib/util/polyline.js +25 -18
  252. package/lib/util/polyline.js.map +1 -1
  253. package/lib/util/router.d.ts +1 -1
  254. package/lib/util/router.js +19 -18
  255. package/lib/util/router.js.map +1 -1
  256. package/lib/util/shape.d.ts +1 -1
  257. package/lib/util/shape.js +27 -12
  258. package/lib/util/shape.js.map +1 -1
  259. package/lib/util/zoom.d.ts +5 -8
  260. package/lib/util/zoom.js +17 -22
  261. package/lib/util/zoom.js.map +1 -1
  262. package/package.json +1 -1
  263. package/src/index.ts +1 -1
  264. package/src/item/combo.ts +13 -5
  265. package/src/item/edge.ts +126 -17
  266. package/src/item/item.ts +119 -57
  267. package/src/item/node.ts +108 -11
  268. package/src/runtime/controller/data.ts +64 -3
  269. package/src/runtime/controller/index.ts +1 -1
  270. package/src/runtime/controller/item.ts +321 -135
  271. package/src/runtime/controller/layout.ts +254 -113
  272. package/src/runtime/controller/plugin.ts +86 -33
  273. package/src/runtime/controller/viewport.ts +8 -2
  274. package/src/runtime/graph.ts +383 -158
  275. package/src/stdlib/behavior/click-select.ts +8 -3
  276. package/src/stdlib/behavior/drag-canvas.ts +6 -3
  277. package/src/stdlib/behavior/drag-combo.ts +8 -8
  278. package/src/stdlib/behavior/drag-node.ts +165 -50
  279. package/src/stdlib/behavior/scroll-canvas.ts +3 -3
  280. package/src/stdlib/behavior/zoom-canvas.ts +3 -3
  281. package/src/stdlib/data/mapNodeSize.ts +2 -2
  282. package/src/stdlib/data/validateData.ts +2 -2
  283. package/src/stdlib/index.ts +3 -0
  284. package/src/stdlib/item/edge/base.ts +15 -139
  285. package/src/stdlib/item/node/base.ts +20 -215
  286. package/src/stdlib/plugin/edgeFilterLens/index.ts +2 -2
  287. package/src/stdlib/plugin/fisheye/index.ts +3 -2
  288. package/src/stdlib/plugin/history/visibility-updated-command.ts +2 -2
  289. package/src/stdlib/plugin/index.ts +1 -0
  290. package/src/stdlib/plugin/lodController/index.ts +602 -0
  291. package/src/stdlib/plugin/minimap/index.ts +12 -14
  292. package/src/stdlib/plugin/toolbar/index.ts +29 -31
  293. package/src/stdlib/theme/dark.ts +32 -34
  294. package/src/stdlib/theme/light.ts +27 -29
  295. package/src/stdlib/themeSolver/spec.ts +2 -2
  296. package/src/types/animate.ts +1 -1
  297. package/src/types/combo.ts +2 -2
  298. package/src/types/edge.ts +2 -2
  299. package/src/types/graph.ts +65 -53
  300. package/src/types/hook.ts +5 -0
  301. package/src/types/item.ts +8 -14
  302. package/src/types/layout.ts +20 -15
  303. package/src/types/node.ts +3 -2
  304. package/src/types/plugin.ts +2 -0
  305. package/src/types/spec.ts +1 -0
  306. package/src/types/theme.ts +7 -7
  307. package/src/util/animate.ts +104 -78
  308. package/src/util/bbox.ts +26 -1
  309. package/src/util/data.ts +15 -6
  310. package/src/util/dom.ts +6 -6
  311. package/src/util/item.ts +15 -1
  312. package/src/util/mapper.ts +1 -1
  313. package/src/util/path.ts +72 -2
  314. package/src/util/polyline.ts +30 -23
  315. package/src/util/router.ts +21 -19
  316. package/src/util/shape.ts +27 -12
  317. package/src/util/zoom.ts +19 -25
  318. package/esm/runtime/controller/extension.d.ts +0 -9
  319. package/esm/runtime/controller/extension.js +0 -11
  320. package/esm/runtime/controller/extension.js.map +0 -1
  321. package/lib/runtime/controller/extension.d.ts +0 -9
  322. package/lib/runtime/controller/extension.js +0 -15
  323. package/lib/runtime/controller/extension.js.map +0 -1
  324. package/src/runtime/controller/extension.ts +0 -14
@@ -8,21 +8,50 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { Group } from '@antv/g';
11
- import { debounce, each, isArray, isNumber, isObject, map, throttle, uniq, uniqueId, } from '@antv/util';
11
+ import { debounce, isArray, isNumber, isObject, throttle, uniq, uniqueId, } from '@antv/util';
12
12
  import { DirectionalLight, AmbientLight } from '@antv/g-plugin-3d';
13
13
  import registry from '../../stdlib';
14
14
  import Node from '../../item/node';
15
15
  import Edge from '../../item/edge';
16
16
  import Combo from '../../item/combo';
17
- import { getCombinedBoundsByData, upsertShape } from '../../util/shape';
17
+ import { getCombinedBoundsByData, intersectBBox, upsertShape, } from '../../util/shape';
18
18
  import { getExtension } from '../../util/extension';
19
19
  import { upsertTransientItem } from '../../util/item';
20
- import { formatLodStrategy } from '../../util/zoom';
20
+ import { formatLodLevels } from '../../util/zoom';
21
21
  import { deconstructData, graphComboTreeDfs, graphCoreTreeDfs, traverseAncestors, traverseAncestorsAndSucceeds, traverseGraphAncestors, } from '../../util/data';
22
22
  import { getGroupedChanges } from '../../util/event';
23
- import { EdgeCollisionChecker, QuadTree } from '../../util/polyline';
24
23
  import { isBBoxInBBox, isPointInBBox } from '../../util/bbox';
25
24
  import { convertToNumber } from '../../util/type';
25
+ import { isPointPreventPolylineOverlap, isPolylineWithObstacleAvoidance, } from '../../util/polyline';
26
+ var WARN_TYPE;
27
+ (function (WARN_TYPE) {
28
+ WARN_TYPE[WARN_TYPE["FAIL_GET_BBOX"] = 0] = "FAIL_GET_BBOX";
29
+ WARN_TYPE[WARN_TYPE["FAIL_GET_VISIBLE"] = 1] = "FAIL_GET_VISIBLE";
30
+ WARN_TYPE[WARN_TYPE["FAIL_SET_STATE"] = 2] = "FAIL_SET_STATE";
31
+ WARN_TYPE[WARN_TYPE["FAIL_GET_STATE"] = 3] = "FAIL_GET_STATE";
32
+ WARN_TYPE[WARN_TYPE["FAIL_SET_VISIBLE"] = 4] = "FAIL_SET_VISIBLE";
33
+ WARN_TYPE[WARN_TYPE["FAIL_DRAW_TRANSIENT"] = 5] = "FAIL_DRAW_TRANSIENT";
34
+ WARN_TYPE[WARN_TYPE["SOURCE_NOT_EXIST"] = 6] = "SOURCE_NOT_EXIST";
35
+ WARN_TYPE[WARN_TYPE["TARGET_NOT_EXIST"] = 7] = "TARGET_NOT_EXIST";
36
+ })(WARN_TYPE || (WARN_TYPE = {}));
37
+ const getWarnMsg = {
38
+ [WARN_TYPE.FAIL_GET_BBOX]: (ids) => `Fail to get items' bboxes, the items with ids ${ids.join(', ')} do not exist.`,
39
+ [WARN_TYPE.FAIL_GET_VISIBLE]: (ids) => `Fail to get items' visible, the items with ids ${ids.join(', ')} do not exist.`,
40
+ [WARN_TYPE.FAIL_SET_STATE]: (ids) => `Fail to set states for items ${ids.join(', ')}, which do not exist.`,
41
+ [WARN_TYPE.FAIL_SET_VISIBLE]: (ids) => `Fail to set visibility for items ${ids.join(', ')}, which do not exist.`,
42
+ [WARN_TYPE.FAIL_DRAW_TRANSIENT]: (ids) => `Fail to draw transient items of ${ids}, which do not exist.`,
43
+ [WARN_TYPE.SOURCE_NOT_EXIST]: (params) => `The source nodes ${params
44
+ .map((p) => p.source)
45
+ .join(', ')} do not exist in the graph for edges ${params
46
+ .map((p) => p.id)
47
+ .join(', ')}, please add the nodes first`,
48
+ [WARN_TYPE.TARGET_NOT_EXIST]: (params) => `The target nodes ${params
49
+ .map((p) => p.target)
50
+ .join(', ')} do not exist in the graph for edges ${params
51
+ .map((p) => p.id)
52
+ .join(', ')}, please add the nodes first`,
53
+ [WARN_TYPE.FAIL_GET_STATE]: (ids) => `Fail to get items' states, the items with ids ${ids.join(', ')} do not exist.`,
54
+ };
26
55
  /**
27
56
  * Manages and stores the node / edge / combo items.
28
57
  */
@@ -41,26 +70,70 @@ export class ItemController {
41
70
  // The G shapes or groups on transient map drawn by this controller
42
71
  this.transientObjectMap = new Map();
43
72
  this.transientItemMap = new Map();
44
- this.onViewportChange = debounce(({ transform, effectTiming, tileLodSize = 1000, }) => {
45
- const { zoom } = transform;
46
- if (zoom) {
47
- const zoomRatio = this.graph.getZoom();
48
- const range = this.graph.getCanvasRange();
49
- const nodeItems = Array.from(this.itemMap, ([key, value]) => value);
50
- const itemsInViewport = [];
51
- const itemsOutViewport = [];
52
- nodeItems.forEach((item) => {
73
+ /** Caches */
74
+ this.nearEdgesCache = new Map();
75
+ this.cacheWarnMsg = {};
76
+ /**
77
+ * get the items inside viewport
78
+ * @returns
79
+ */
80
+ this.groupItemsByView = (containType = 'inside', ratio = 1) => {
81
+ const range = this.graph.getCanvasRange();
82
+ const items = Array.from(this.itemMap, ([key, value]) => value);
83
+ const containFunc = containType === 'intersect' ? intersectBBox : isBBoxInBBox;
84
+ let { inView: itemsInView, outView: itemsOutView } = this.cacheViewItems || {};
85
+ if (!ratio || ratio === 1 || !this.cacheViewItems) {
86
+ itemsInView = [];
87
+ itemsOutView = [];
88
+ items.forEach((item) => {
53
89
  const { keyShape } = item.shapeMap;
54
90
  if (!keyShape)
55
91
  return;
56
92
  const renderBounds = keyShape.getRenderBounds();
57
- if (isBBoxInBBox(renderBounds, range, 0.4))
58
- itemsInViewport.push(item);
93
+ if (containFunc(renderBounds, range, 0.4))
94
+ itemsInView.push(item);
59
95
  else
60
- itemsOutViewport.push(item);
96
+ itemsOutView.push(item);
97
+ });
98
+ }
99
+ else if (ratio < 1) {
100
+ // zoom-out
101
+ itemsOutView.forEach((item) => {
102
+ const { keyShape } = item.shapeMap;
103
+ if (!keyShape)
104
+ return;
105
+ const renderBounds = keyShape.getRenderBounds();
106
+ if (containFunc(renderBounds, range, 0.4)) {
107
+ itemsInView.push(item);
108
+ }
61
109
  });
62
- const sortedItems = itemsInViewport.concat(itemsOutViewport);
63
- const sections = Math.ceil(nodeItems.length / tileLodSize);
110
+ }
111
+ else if (ratio > 1) {
112
+ // zoom-in
113
+ itemsInView.forEach((item) => {
114
+ const { keyShape } = item.shapeMap;
115
+ if (!keyShape)
116
+ return;
117
+ const renderBounds = keyShape.getRenderBounds();
118
+ if (!containFunc(renderBounds, range, 0.4)) {
119
+ itemsOutView.push(item);
120
+ }
121
+ });
122
+ }
123
+ this.cacheViewItems = { inView: itemsInView, outView: itemsOutView };
124
+ return {
125
+ items,
126
+ inView: itemsInView,
127
+ outView: itemsOutView,
128
+ };
129
+ };
130
+ this.onViewportChange = debounce(({ transform, effectTiming, tileLodSize = 1000, }) => {
131
+ const { zoom } = transform;
132
+ if (zoom) {
133
+ const zoomRatio = this.graph.getZoom();
134
+ const { items, inView: itemsInview, outView: itemsOutView, } = this.groupItemsByView();
135
+ const sortedItems = itemsInview.concat(itemsOutView);
136
+ const sections = Math.ceil(items.length / tileLodSize);
64
137
  const itemSections = Array.from({ length: sections }, (v, i) => sortedItems.slice(i * tileLodSize, i * tileLodSize + tileLodSize));
65
138
  let requestId;
66
139
  const update = () => {
@@ -72,7 +145,6 @@ export class ItemController {
72
145
  requestId = requestAnimationFrame(update);
73
146
  };
74
147
  requestId = requestAnimationFrame(update);
75
- // this.itemMap.forEach((item) => item.updateZoom(zoomRatio));
76
148
  this.zoom = zoomRatio;
77
149
  }
78
150
  }, 500, false);
@@ -111,6 +183,11 @@ export class ItemController {
111
183
  // Fix OOM problem, since this map will hold all the refs of items.
112
184
  this.itemMap.clear();
113
185
  };
186
+ this.debounceWarn = debounce((type) => {
187
+ const msg = getWarnMsg[type](this.cacheWarnMsg[type]);
188
+ console.warn(msg);
189
+ this.cacheWarnMsg[type] = [];
190
+ }, 16, false);
114
191
  this.graph = graph;
115
192
  // get mapper for node / edge / combo
116
193
  const { node, edge, combo, nodeState = {}, edgeState = {}, comboState = {}, } = graph.getSpecification();
@@ -170,19 +247,30 @@ export class ItemController {
170
247
  */
171
248
  onRender(param) {
172
249
  return __awaiter(this, void 0, void 0, function* () {
173
- const { graphCore, theme = {}, transientCanvas, tileOptimize = {} } = param;
250
+ const { graphCore, theme = {}, transientCanvas, transientLabelCanvas, tileOptimize = {}, } = param;
174
251
  const { graph } = this;
175
252
  // 0. clear groups on canvas, and create new groups
176
253
  graph.canvas.removeChildren();
177
- const comboGroup = new Group({ id: 'combo-group', style: { zIndex: 0 } });
178
- const edgeGroup = new Group({ id: 'edge-group', style: { zIndex: 1 } });
179
- const nodeGroup = new Group({ id: 'node-group', style: { zIndex: 2 } });
180
- graph.canvas.appendChild(comboGroup);
181
- graph.canvas.appendChild(edgeGroup);
182
- graph.canvas.appendChild(nodeGroup);
183
- this.nodeGroup = nodeGroup;
184
- this.edgeGroup = edgeGroup;
185
- this.comboGroup = comboGroup;
254
+ graph.labelCanvas.removeChildren();
255
+ graph.transientCanvas.removeChildren();
256
+ this.itemMap.forEach((item) => item.destroy());
257
+ this.itemMap.clear();
258
+ this.comboGroup = new Group({ id: 'combo-group', style: { zIndex: 0 } });
259
+ this.edgeGroup = new Group({ id: 'edge-group', style: { zIndex: 1 } });
260
+ this.nodeGroup = new Group({ id: 'node-group', style: { zIndex: 2 } });
261
+ this.edgeLabelGroup = new Group({
262
+ id: 'node-label-group',
263
+ style: { zIndex: 0 },
264
+ });
265
+ this.nodeLabelGroup = new Group({
266
+ id: 'node-label-group',
267
+ style: { zIndex: 1 },
268
+ });
269
+ graph.canvas.appendChild(this.comboGroup);
270
+ graph.canvas.appendChild(this.edgeGroup);
271
+ graph.canvas.appendChild(this.nodeGroup);
272
+ graph.labelCanvas.appendChild(this.edgeLabelGroup);
273
+ graph.labelCanvas.appendChild(this.nodeLabelGroup);
186
274
  // Also create transient groups on transient canvas.
187
275
  transientCanvas.removeChildren();
188
276
  this.transientComboGroup = new Group({
@@ -200,6 +288,16 @@ export class ItemController {
200
288
  transientCanvas.appendChild(this.transientComboGroup);
201
289
  transientCanvas.appendChild(this.transientEdgeGroup);
202
290
  transientCanvas.appendChild(this.transientNodeGroup);
291
+ this.transientEdgeLabelGroup = new Group({
292
+ id: 'node-label-group',
293
+ style: { zIndex: 0 },
294
+ });
295
+ this.transientNodeLabelGroup = new Group({
296
+ id: 'node-label-group',
297
+ style: { zIndex: 1 },
298
+ });
299
+ transientLabelCanvas.appendChild(this.transientEdgeLabelGroup);
300
+ transientLabelCanvas.appendChild(this.transientNodeLabelGroup);
203
301
  // 1. create lights for webgl 3d rendering
204
302
  if (graph.rendererType === 'webgl-3d') {
205
303
  const ambientLight = new AmbientLight({
@@ -335,7 +433,6 @@ export class ItemController {
335
433
  };
336
434
  const debounceUpdateRelates = debounce(updateRelates, 16, false);
337
435
  Object.values(nodeComboUpdate).forEach((updateObj) => {
338
- var _a;
339
436
  const { isReplace, previous, current, id } = updateObj;
340
437
  if (!graphCore.hasNode(id))
341
438
  return;
@@ -403,11 +500,15 @@ export class ItemController {
403
500
  previous[nodeDataTypeField] !== current[nodeDataTypeField]) {
404
501
  itemTheme = getItemTheme(this.nodeDataTypeSet, nodeDataTypeField, current[nodeDataTypeField], nodeTheme);
405
502
  }
406
- const preventPolylineEdgeOverlap = ((_a = innerModel === null || innerModel === void 0 ? void 0 : innerModel.data) === null || _a === void 0 ? void 0 : _a.preventPolylineEdgeOverlap) || false;
407
- const relatedEdgeInnerModels = preventPolylineEdgeOverlap
408
- ? this.findNearEdgesByNode(id, graphCore).concat(graphCore.getRelatedEdges(id))
409
- : graphCore.getRelatedEdges(id);
410
- relatedEdgeInnerModels.forEach((edge) => {
503
+ const adjacentEdgeInnerModels = graphCore.getRelatedEdges(id);
504
+ if (isPointPreventPolylineOverlap(innerModel)) {
505
+ const newNearEdges = this.graph.getNearEdgesData(id, (edge) => isPolylineWithObstacleAvoidance(edge));
506
+ const prevNearEdges = this.nearEdgesCache.get(id) || [];
507
+ adjacentEdgeInnerModels.push(...newNearEdges);
508
+ adjacentEdgeInnerModels.push(...prevNearEdges);
509
+ this.nearEdgesCache.set(id, newNearEdges);
510
+ }
511
+ adjacentEdgeInnerModels.forEach((edge) => {
411
512
  edgeIdsToUpdate.add(edge.id);
412
513
  nodeRelatedIdsToUpdate.add(edge.id);
413
514
  });
@@ -435,7 +536,7 @@ export class ItemController {
435
536
  const parentItem = this.itemMap.get(current.parentId);
436
537
  if (current.parentId && (parentItem === null || parentItem === void 0 ? void 0 : parentItem.model.data.collapsed)) {
437
538
  this.graph.executeWithNoStack(() => {
438
- this.graph.hideItem(innerModel.id, false);
539
+ this.graph.hideItem(innerModel.id, { disableAnimate: false });
439
540
  });
440
541
  }
441
542
  });
@@ -505,7 +606,7 @@ export class ItemController {
505
606
  let parent = graphCore.getParent(nodeId, 'tree');
506
607
  while (parent) {
507
608
  if (parent.data.collapsed) {
508
- this.graph.hideItem(nodeId, true);
609
+ this.graph.hideItem(nodeId, { disableAnimate: true });
509
610
  break;
510
611
  }
511
612
  parent = graphCore.getParent(parent.id, 'tree');
@@ -527,7 +628,11 @@ export class ItemController {
527
628
  ids.forEach((id) => {
528
629
  const item = this.itemMap.get(id);
529
630
  if (!item) {
530
- console.warn(`Fail to set state for item ${id}, which is not exist.`);
631
+ this.cacheWarnMsg[WARN_TYPE.FAIL_SET_STATE] =
632
+ this.cacheWarnMsg[WARN_TYPE.FAIL_SET_STATE] || [];
633
+ this.cacheWarnMsg[WARN_TYPE.FAIL_SET_STATE].push(id);
634
+ // @ts-ignore
635
+ this.debounceWarn(WARN_TYPE.FAIL_SET_STATE);
531
636
  return;
532
637
  }
533
638
  if (!states || !value) {
@@ -540,17 +645,31 @@ export class ItemController {
540
645
  });
541
646
  }
542
647
  onItemVisibilityChange(param) {
543
- const { ids, value, graphCore, animate = true, keepKeyShape = false, } = param;
648
+ const { ids, shapeIds, value, graphCore, animate = true, keepKeyShape = false, keepRelated = false, } = param;
544
649
  ids.forEach((id) => {
545
650
  const item = this.itemMap.get(id);
546
651
  if (!item) {
547
- console.warn(`Fail to set visibility for item ${id}, which is not exist.`);
652
+ this.cacheWarnMsg[WARN_TYPE.FAIL_SET_VISIBLE] =
653
+ this.cacheWarnMsg[WARN_TYPE.FAIL_SET_VISIBLE] || [];
654
+ this.cacheWarnMsg[WARN_TYPE.FAIL_SET_VISIBLE].push(id);
655
+ // @ts-ignore
656
+ this.debounceWarn(WARN_TYPE.FAIL_SET_VISIBLE);
657
+ return;
658
+ }
659
+ if (shapeIds === null || shapeIds === void 0 ? void 0 : shapeIds.length) {
660
+ if (value) {
661
+ item.show(animate, shapeIds);
662
+ }
663
+ else {
664
+ item.hide(animate, false, shapeIds);
665
+ }
548
666
  return;
549
667
  }
550
668
  const type = item.getType();
551
669
  if (value) {
552
670
  if (type === 'edge') {
553
671
  item.show(animate);
672
+ item.forceUpdate();
554
673
  }
555
674
  else {
556
675
  if (graphCore.hasTreeStructure('combo')) {
@@ -574,7 +693,7 @@ export class ItemController {
574
693
  }
575
694
  else {
576
695
  item.hide(animate, keepKeyShape);
577
- if (type !== 'edge') {
696
+ if (type !== 'edge' && !keepRelated) {
578
697
  const relatedEdges = graphCore.getRelatedEdges(id);
579
698
  relatedEdges.forEach(({ id: edgeId }) => {
580
699
  var _a;
@@ -653,10 +772,14 @@ export class ItemController {
653
772
  if (isItemType) {
654
773
  const item = this.itemMap.get(id);
655
774
  if (!item) {
656
- console.warn(`Fail to draw transient item of ${id}, which is not exist.`);
775
+ this.cacheWarnMsg[WARN_TYPE.FAIL_DRAW_TRANSIENT] =
776
+ this.cacheWarnMsg[WARN_TYPE.FAIL_DRAW_TRANSIENT] || [];
777
+ this.cacheWarnMsg[WARN_TYPE.FAIL_DRAW_TRANSIENT].push(id);
778
+ // @ts-ignore
779
+ this.debounceWarn(WARN_TYPE.FAIL_DRAW_TRANSIENT);
657
780
  return;
658
781
  }
659
- const transientItem = upsertTransientItem(item, this.transientNodeGroup, this.transientEdgeGroup, this.transientComboGroup, this.transientItemMap, this.itemMap, graphCore, { shapeIds, drawSource, drawTarget, visible }, upsertAncestors);
782
+ const transientItem = upsertTransientItem(item, this.transientNodeGroup, this.transientEdgeGroup, this.transientComboGroup, this.transientNodeLabelGroup, this.transientEdgeLabelGroup, this.transientItemMap, this.itemMap, graphCore, { shapeIds, drawSource, drawTarget, visible }, upsertAncestors);
660
783
  if (shapeIds) {
661
784
  // only update node positions to cloned node container(group)
662
785
  if ((type === 'node' || type === 'combo') &&
@@ -699,6 +822,14 @@ export class ItemController {
699
822
  }
700
823
  // Update the target combo's posiiton and other props
701
824
  transItem.update(Object.assign(Object.assign({}, transItem.model), { data: Object.assign(Object.assign({}, transItem.model.data), data) }));
825
+ if (type !== 'edge') {
826
+ const relatedEdges = graphCore.getRelatedEdges(transItem.model.id);
827
+ relatedEdges.forEach((relatedEdge) => {
828
+ const transientEdge = this.transientItemMap.get(relatedEdge.id);
829
+ if (transientEdge)
830
+ transientEdge.forceUpdate();
831
+ });
832
+ }
702
833
  }
703
834
  return;
704
835
  }
@@ -713,11 +844,19 @@ export class ItemController {
713
844
  return this.transientObjectMap.get(id);
714
845
  }
715
846
  getTransientItem(id) {
716
- return this.transientItemMap[id];
847
+ return this.transientItemMap.get(id);
848
+ }
849
+ getItemMap() {
850
+ return this.itemMap;
717
851
  }
718
852
  findDisplayModel(id) {
719
- var _a;
720
- return (_a = this.itemMap.get(id)) === null || _a === void 0 ? void 0 : _a.displayModel;
853
+ const item = this.itemMap.get(id);
854
+ if (!item)
855
+ return { id, data: {} };
856
+ return {
857
+ id,
858
+ data: Object.assign(Object.assign(Object.assign({}, item.displayModel.data), item.renderExt.mergedStyles), { lodLevels: item.lodLevels }),
859
+ };
721
860
  }
722
861
  /**
723
862
  * Create nodes with inner data to canvas.
@@ -725,7 +864,7 @@ export class ItemController {
725
864
  */
726
865
  renderNodes(models, nodeTheme = {}, tileOptimize) {
727
866
  return __awaiter(this, void 0, void 0, function* () {
728
- const { nodeExtensions, nodeGroup, nodeDataTypeSet, graph } = this;
867
+ const { nodeExtensions, nodeGroup, nodeLabelGroup, nodeDataTypeSet, graph, } = this;
729
868
  const { dataTypeField = '' } = nodeTheme;
730
869
  const { tileFirstRender, tileFirstRenderSize = 1000 } = tileOptimize || {};
731
870
  const zoom = graph.getZoom();
@@ -742,10 +881,12 @@ export class ItemController {
742
881
  dataType = node.data[dataTypeField];
743
882
  const itemTheme = getItemTheme(nodeDataTypeSet, dataTypeField, dataType, nodeTheme);
744
883
  const nodeItem = new Node({
884
+ graph,
745
885
  delayFirstDraw,
746
886
  model: node,
747
887
  renderExtensions: nodeExtensions,
748
888
  containerGroup: nodeGroup,
889
+ labelContainerGroup: nodeLabelGroup,
749
890
  mapper: this.nodeMapper,
750
891
  stateMapper: this.nodeStateMapper,
751
892
  zoom,
@@ -810,10 +951,12 @@ export class ItemController {
810
951
  };
811
952
  const comboItem = new Combo({
812
953
  model: combo,
954
+ graph: this.graph,
813
955
  getCombinedBounds,
814
956
  getChildren,
815
957
  renderExtensions: comboExtensions,
816
958
  containerGroup: comboGroup,
959
+ labelContainerGroup: this.nodeLabelGroup,
817
960
  mapper: this.comboMapper,
818
961
  stateMapper: this.comboStateMapper,
819
962
  zoom,
@@ -836,7 +979,7 @@ export class ItemController {
836
979
  * @param models edges' inner datas
837
980
  */
838
981
  renderEdges(models, edgeTheme = {}, tileOptimize, nodesInView) {
839
- const { edgeExtensions, edgeGroup, itemMap, edgeDataTypeSet, graph } = this;
982
+ const { edgeExtensions, edgeGroup, edgeLabelGroup, itemMap, edgeDataTypeSet, graph, } = this;
840
983
  const { dataTypeField = '' } = edgeTheme;
841
984
  const { tileFirstRender, tileFirstRenderSize = 1000 } = tileOptimize || {};
842
985
  const zoom = graph.getZoom();
@@ -852,11 +995,19 @@ export class ItemController {
852
995
  const sourceItem = itemMap.get(source);
853
996
  const targetItem = itemMap.get(target);
854
997
  if (!sourceItem) {
855
- console.warn(`The source node ${source} is not exist in the graph for edge ${id}, please add the node first`);
998
+ this.cacheWarnMsg[WARN_TYPE.SOURCE_NOT_EXIST] =
999
+ this.cacheWarnMsg[WARN_TYPE.SOURCE_NOT_EXIST] || [];
1000
+ this.cacheWarnMsg[WARN_TYPE.SOURCE_NOT_EXIST].push({ id, source });
1001
+ // @ts-ignore
1002
+ this.debounceWarn(WARN_TYPE.SOURCE_NOT_EXIST);
856
1003
  return;
857
1004
  }
858
1005
  if (!targetItem) {
859
- console.warn(`The source node ${source} is not exist in the graph for edge ${id}, please add the node first`);
1006
+ this.cacheWarnMsg[WARN_TYPE.TARGET_NOT_EXIST] =
1007
+ this.cacheWarnMsg[WARN_TYPE.TARGET_NOT_EXIST] || [];
1008
+ this.cacheWarnMsg[WARN_TYPE.TARGET_NOT_EXIST].push({ id, source });
1009
+ // @ts-ignore
1010
+ this.debounceWarn(WARN_TYPE.TARGET_NOT_EXIST);
860
1011
  return;
861
1012
  }
862
1013
  // get the base styles from theme
@@ -865,10 +1016,12 @@ export class ItemController {
865
1016
  dataType = edge.data[dataTypeField];
866
1017
  const itemTheme = getItemTheme(edgeDataTypeSet, dataTypeField, dataType, edgeTheme);
867
1018
  const edgeItem = new Edge({
1019
+ graph,
868
1020
  delayFirstDraw,
869
1021
  model: edge,
870
1022
  renderExtensions: edgeExtensions,
871
1023
  containerGroup: edgeGroup,
1024
+ labelContainerGroup: edgeLabelGroup,
872
1025
  mapper: this.edgeMapper,
873
1026
  stateMapper: this.edgeStateMapper,
874
1027
  sourceItem,
@@ -928,7 +1081,11 @@ export class ItemController {
928
1081
  getItemState(id, state) {
929
1082
  const item = this.itemMap.get(id);
930
1083
  if (!item) {
931
- console.warn(`Fail to get item state, the item with id ${id} does not exist.`);
1084
+ this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE] =
1085
+ this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE] || [];
1086
+ this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE].push(id);
1087
+ // @ts-ignore
1088
+ this.debounceWarn(WARN_TYPE.FAIL_GET_STATE);
932
1089
  return false;
933
1090
  }
934
1091
  return item.hasState(state);
@@ -936,7 +1093,11 @@ export class ItemController {
936
1093
  getItemAllStates(id) {
937
1094
  const item = this.itemMap.get(id);
938
1095
  if (!item) {
939
- console.warn(`Fail to get item state, the item with id ${id} does not exist.`);
1096
+ this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE] =
1097
+ this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE] || [];
1098
+ this.cacheWarnMsg[WARN_TYPE.FAIL_GET_STATE].push(id);
1099
+ // @ts-ignore
1100
+ this.debounceWarn(WARN_TYPE.FAIL_GET_STATE);
940
1101
  return [];
941
1102
  }
942
1103
  return item
@@ -952,55 +1113,39 @@ export class ItemController {
952
1113
  ? this.transientItemMap.get(id)
953
1114
  : this.itemMap.get(id);
954
1115
  if (!item) {
955
- console.warn(`Fail to get item bbox, the item with id ${id} does not exist.`);
1116
+ this.cacheWarnMsg[WARN_TYPE.FAIL_GET_BBOX] =
1117
+ this.cacheWarnMsg[WARN_TYPE.FAIL_GET_BBOX] || [];
1118
+ this.cacheWarnMsg[WARN_TYPE.FAIL_GET_BBOX].push(id);
1119
+ // @ts-ignore
1120
+ this.debounceWarn(WARN_TYPE.FAIL_GET_BBOX);
956
1121
  return false;
957
1122
  }
958
1123
  if (item instanceof Group)
959
1124
  return item.getRenderBounds();
960
1125
  return isKeyShape ? item.getKeyBBox() : item.getBBox();
961
1126
  }
1127
+ getItemVisibleShapeIds(id) {
1128
+ const item = this.itemMap.get(id);
1129
+ const shapeIds = [];
1130
+ Object.keys(item.shapeMap).forEach((shapeId) => {
1131
+ var _a;
1132
+ if (((_a = item.shapeMap[shapeId]) === null || _a === void 0 ? void 0 : _a.attributes.visibility) !== 'hidden')
1133
+ shapeIds.push(shapeId);
1134
+ });
1135
+ return shapeIds;
1136
+ }
962
1137
  getItemVisible(id) {
963
1138
  const item = this.itemMap.get(id);
964
1139
  if (!item) {
965
- console.warn(`Fail to get item visible, the item with id ${id} does not exist.`);
1140
+ this.cacheWarnMsg[WARN_TYPE.FAIL_GET_VISIBLE] =
1141
+ this.cacheWarnMsg[WARN_TYPE.FAIL_GET_VISIBLE] || [];
1142
+ this.cacheWarnMsg[WARN_TYPE.FAIL_GET_VISIBLE].push(id);
1143
+ // @ts-ignore
1144
+ this.debounceWarn(WARN_TYPE.FAIL_GET_VISIBLE);
966
1145
  return false;
967
1146
  }
968
1147
  return item.isVisible();
969
1148
  }
970
- /**
971
- * Identify edges that are intersected by a particular node
972
- * @param nodeId node id
973
- * @param graphCore
974
- * @returns
975
- */
976
- findNearEdgesByNode(nodeId, graphCore) {
977
- var _a;
978
- const edges = graphCore.getAllEdges();
979
- const canvasBBox = this.graph.getRenderBBox(undefined);
980
- const quadTree = new QuadTree(canvasBBox, 4);
981
- each(edges, (edge) => {
982
- const { data: { x: sourceX, y: sourceY }, } = graphCore.getNode(edge.source);
983
- const { data: { x: targetX, y: targetY }, } = graphCore.getNode(edge.target);
984
- quadTree.insert({
985
- id: edge.id,
986
- p1: { x: sourceX, y: sourceY },
987
- p2: { x: targetX, y: targetY },
988
- bbox: this.graph.getRenderBBox(edge.id),
989
- });
990
- });
991
- // update node position
992
- const node = (this.getTransientItem(nodeId) ||
993
- this.getItemById(nodeId));
994
- const nodeBBox = this.graph.getRenderBBox(nodeId);
995
- const nodeData = (_a = node === null || node === void 0 ? void 0 : node.model) === null || _a === void 0 ? void 0 : _a.data;
996
- if (nodeData) {
997
- nodeBBox.update([nodeData.x, nodeData.y, 0], nodeBBox.halfExtents);
998
- }
999
- const checker = new EdgeCollisionChecker(quadTree);
1000
- const collisions = checker.getCollidingEdges(nodeBBox);
1001
- const collidingEdges = map(collisions, (collision) => graphCore.getEdge(collision.id));
1002
- return collidingEdges;
1003
- }
1004
1149
  sortByComboTree(graphCore) {
1005
1150
  if (!graphCore.hasTreeStructure('combo'))
1006
1151
  return;
@@ -1018,7 +1163,7 @@ export class ItemController {
1018
1163
  graphComboTreeDfs(this.graph, [comboModel], (child) => {
1019
1164
  if (child.id !== comboModel.id) {
1020
1165
  this.graph.executeWithNoStack(() => {
1021
- this.graph.hideItem(child.id, false);
1166
+ this.graph.hideItem(child.id, { disableAnimate: false });
1022
1167
  });
1023
1168
  }
1024
1169
  relatedEdges = relatedEdges.concat(graphCore.getRelatedEdges(child.id));
@@ -1172,8 +1317,8 @@ export class ItemController {
1172
1317
  if (!positions.length)
1173
1318
  return;
1174
1319
  this.graph.updateNodePosition(positions, undefined, !animate, (model, canceled) => {
1175
- this.graph.hideItem(model.id, canceled);
1176
- }, undefined);
1320
+ this.graph.hideItem(model.id, { disableAnimate: canceled });
1321
+ });
1177
1322
  }
1178
1323
  /**
1179
1324
  * Expand sub tree(s).
@@ -1203,20 +1348,20 @@ export class ItemController {
1203
1348
  allNodeIds = allNodeIds.concat(nodeIds.filter((id) => id !== root.id));
1204
1349
  });
1205
1350
  const ids = uniq(allNodeIds.concat(allEdgeIds));
1206
- this.graph.showItem(ids, !animate);
1351
+ this.graph.showItem(ids, { disableAnimate: !animate });
1207
1352
  yield this.graph.layout(undefined, !animate);
1208
1353
  });
1209
1354
  }
1210
1355
  }
1211
1356
  const getItemTheme = (dataTypeSet, dataTypeField, dataType, itemTheme) => {
1212
- const { styles: themeStyles = [], lodStrategy } = itemTheme;
1213
- const formattedLodStrategy = formatLodStrategy(lodStrategy);
1357
+ const { styles: themeStyles = [], lodLevels } = itemTheme;
1358
+ const formattedLodLevels = formatLodLevels(lodLevels);
1214
1359
  if (!dataTypeField) {
1215
1360
  // dataType field is not assigned
1216
1361
  const styles = isArray(themeStyles)
1217
1362
  ? themeStyles[0]
1218
1363
  : Object.values(themeStyles)[0];
1219
- return { styles, lodStrategy: formattedLodStrategy };
1364
+ return { styles, lodLevels: formattedLodLevels };
1220
1365
  }
1221
1366
  dataTypeSet.add(dataType);
1222
1367
  let themeStyle;
@@ -1232,7 +1377,7 @@ const getItemTheme = (dataTypeSet, dataTypeField, dataType, itemTheme) => {
1232
1377
  }
1233
1378
  return {
1234
1379
  styles: themeStyle,
1235
- lodStrategy: formattedLodStrategy,
1380
+ lodLevels: formattedLodLevels,
1236
1381
  };
1237
1382
  };
1238
1383
  const filterItemMapByType = (itemMap, type) => {