@antv/g6 5.0.0-beta.11 → 5.0.0-beta.13

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 (315) hide show
  1. package/dist/g6.min.js +2 -2
  2. package/esm/api-doc/graph.d.ts +3 -3
  3. package/esm/api-doc/graph.js +3 -3
  4. package/esm/api-doc/graph.js.map +1 -1
  5. package/esm/constant/shape.d.ts +1 -1
  6. package/esm/index.d.ts +12 -62
  7. package/esm/index.js +4 -5
  8. package/esm/index.js.map +1 -1
  9. package/esm/item/item.js +2 -1
  10. package/esm/item/item.js.map +1 -1
  11. package/esm/runtime/controller/item.js +34 -16
  12. package/esm/runtime/controller/item.js.map +1 -1
  13. package/esm/runtime/controller/layout.js +1 -3
  14. package/esm/runtime/controller/layout.js.map +1 -1
  15. package/esm/runtime/controller/plugin.js +8 -3
  16. package/esm/runtime/controller/plugin.js.map +1 -1
  17. package/esm/runtime/graph.d.ts +1 -1
  18. package/esm/runtime/graph.js +11 -5
  19. package/esm/runtime/graph.js.map +1 -1
  20. package/esm/stdlib/behavior/drag-canvas.d.ts +2 -1
  21. package/esm/stdlib/behavior/drag-canvas.js +12 -5
  22. package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
  23. package/esm/stdlib/behavior/shortcuts-call.d.ts +2 -2
  24. package/esm/stdlib/behavior/shortcuts-call.js +12 -5
  25. package/esm/stdlib/behavior/shortcuts-call.js.map +1 -1
  26. package/esm/stdlib/behavior/zoom-canvas-3d.js +4 -1
  27. package/esm/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
  28. package/esm/stdlib/behavior/zoom-canvas.d.ts +1 -0
  29. package/esm/stdlib/behavior/zoom-canvas.js +8 -2
  30. package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
  31. package/esm/stdlib/index.d.ts +6 -1
  32. package/esm/stdlib/index.js +8 -3
  33. package/esm/stdlib/index.js.map +1 -1
  34. package/esm/stdlib/item/edge/base.js +5 -1
  35. package/esm/stdlib/item/edge/base.js.map +1 -1
  36. package/esm/stdlib/item/edge/cubic-horizontal.js.map +1 -1
  37. package/esm/stdlib/item/edge/cubic-vertical.js.map +1 -1
  38. package/esm/stdlib/item/edge/cubic.js +1 -1
  39. package/esm/stdlib/item/edge/cubic.js.map +1 -1
  40. package/esm/stdlib/item/edge/loop.js +1 -1
  41. package/esm/stdlib/item/edge/loop.js.map +1 -1
  42. package/esm/stdlib/item/node/base.d.ts +1 -0
  43. package/esm/stdlib/item/node/base.js +5 -2
  44. package/esm/stdlib/item/node/base.js.map +1 -1
  45. package/esm/stdlib/item/node/cube.d.ts +35 -0
  46. package/esm/stdlib/item/node/cube.js +54 -0
  47. package/esm/stdlib/item/node/cube.js.map +1 -0
  48. package/esm/stdlib/item/node/index.d.ts +3 -0
  49. package/esm/stdlib/item/node/index.js +3 -0
  50. package/esm/stdlib/item/node/index.js.map +1 -1
  51. package/esm/stdlib/plugin/edgeFilterLens/index.d.ts +66 -0
  52. package/esm/stdlib/plugin/edgeFilterLens/index.js +309 -0
  53. package/esm/stdlib/plugin/edgeFilterLens/index.js.map +1 -0
  54. package/esm/stdlib/plugin/grid/index.d.ts +1 -1
  55. package/esm/stdlib/plugin/grid/index.js +3 -4
  56. package/esm/stdlib/plugin/grid/index.js.map +1 -1
  57. package/esm/stdlib/plugin/hull/convexHull.d.ts +1 -1
  58. package/esm/stdlib/plugin/hull/hullComponent.js +2 -3
  59. package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -1
  60. package/esm/stdlib/plugin/hull/util.d.ts +2 -2
  61. package/esm/stdlib/plugin/hull/util.js +6 -2
  62. package/esm/stdlib/plugin/hull/util.js.map +1 -1
  63. package/esm/stdlib/plugin/index.d.ts +1 -0
  64. package/esm/stdlib/plugin/index.js +1 -0
  65. package/esm/stdlib/plugin/index.js.map +1 -1
  66. package/esm/stdlib/plugin/legend/index.d.ts +2 -2
  67. package/esm/stdlib/plugin/legend/index.js +3 -3
  68. package/esm/stdlib/plugin/legend/index.js.map +1 -1
  69. package/esm/stdlib/plugin/menu/index.d.ts +4 -4
  70. package/esm/stdlib/plugin/menu/index.js +3 -3
  71. package/esm/stdlib/plugin/menu/index.js.map +1 -1
  72. package/esm/stdlib/plugin/minimap/index.d.ts +1 -1
  73. package/esm/stdlib/plugin/minimap/index.js +3 -3
  74. package/esm/stdlib/plugin/minimap/index.js.map +1 -1
  75. package/esm/stdlib/plugin/timebar/index.js +2 -2
  76. package/esm/stdlib/plugin/timebar/index.js.map +1 -1
  77. package/esm/stdlib/plugin/toolbar/index.d.ts +3 -3
  78. package/esm/stdlib/plugin/toolbar/index.js +4 -4
  79. package/esm/stdlib/plugin/toolbar/index.js.map +1 -1
  80. package/esm/stdlib/plugin/tooltip/index.d.ts +4 -4
  81. package/esm/stdlib/plugin/tooltip/index.js +3 -4
  82. package/esm/stdlib/plugin/tooltip/index.js.map +1 -1
  83. package/esm/stdlib/plugin/types.d.ts +1 -0
  84. package/esm/stdlib/plugin/watermaker/index.d.ts +78 -0
  85. package/esm/stdlib/plugin/watermaker/index.js +243 -0
  86. package/esm/stdlib/plugin/watermaker/index.js.map +1 -0
  87. package/esm/types/index.d.ts +2 -1
  88. package/esm/types/index.js +1 -0
  89. package/esm/types/index.js.map +1 -1
  90. package/esm/types/plugin.d.ts +1 -1
  91. package/esm/util/bbox.js +4 -5
  92. package/esm/util/bbox.js.map +1 -1
  93. package/esm/util/behavior.d.ts +2 -2
  94. package/esm/util/behavior.js +2 -2
  95. package/esm/util/behavior.js.map +1 -1
  96. package/esm/util/data.d.ts +2 -2
  97. package/esm/util/data.js.map +1 -1
  98. package/esm/util/dom.d.ts +15 -0
  99. package/esm/util/dom.js +29 -0
  100. package/esm/util/dom.js.map +1 -0
  101. package/esm/util/extend.d.ts +1 -1
  102. package/esm/util/extend.js +0 -1
  103. package/esm/util/extend.js.map +1 -1
  104. package/esm/util/index.d.ts +7 -52
  105. package/esm/util/index.js +7 -23
  106. package/esm/util/index.js.map +1 -1
  107. package/esm/util/layout.d.ts +1 -1
  108. package/esm/util/layout.js.map +1 -1
  109. package/esm/util/loop.d.ts +1 -1
  110. package/esm/util/math.d.ts +1 -1
  111. package/esm/util/matrix.d.ts +6 -0
  112. package/esm/util/matrix.js +48 -0
  113. package/esm/util/matrix.js.map +1 -0
  114. package/esm/util/path.js +1 -1
  115. package/esm/util/path.js.map +1 -1
  116. package/esm/util/point.d.ts +1 -1
  117. package/esm/util/polyline.d.ts +2 -1
  118. package/esm/util/polyline.js +2 -1
  119. package/esm/util/polyline.js.map +1 -1
  120. package/esm/util/router.d.ts +1 -1
  121. package/esm/util/shape.js +12 -12
  122. package/esm/util/shape.js.map +1 -1
  123. package/esm/util/shape3d.js +15 -11
  124. package/esm/util/shape3d.js.map +1 -1
  125. package/esm/util/text.d.ts +1 -1
  126. package/esm/util/text.js +3 -2
  127. package/esm/util/text.js.map +1 -1
  128. package/lib/api-doc/graph.d.ts +3 -3
  129. package/lib/api-doc/graph.js +27 -7
  130. package/lib/api-doc/graph.js.map +1 -1
  131. package/lib/constant/shape.d.ts +1 -1
  132. package/lib/index.d.ts +12 -62
  133. package/lib/index.js +18 -10
  134. package/lib/index.js.map +1 -1
  135. package/lib/item/item.js +2 -1
  136. package/lib/item/item.js.map +1 -1
  137. package/lib/runtime/controller/item.js +34 -16
  138. package/lib/runtime/controller/item.js.map +1 -1
  139. package/lib/runtime/controller/layout.js +1 -3
  140. package/lib/runtime/controller/layout.js.map +1 -1
  141. package/lib/runtime/controller/plugin.js +8 -3
  142. package/lib/runtime/controller/plugin.js.map +1 -1
  143. package/lib/runtime/graph.d.ts +1 -1
  144. package/lib/runtime/graph.js +12 -5
  145. package/lib/runtime/graph.js.map +1 -1
  146. package/lib/stdlib/behavior/drag-canvas.d.ts +2 -1
  147. package/lib/stdlib/behavior/drag-canvas.js +12 -5
  148. package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
  149. package/lib/stdlib/behavior/shortcuts-call.d.ts +2 -2
  150. package/lib/stdlib/behavior/shortcuts-call.js +12 -5
  151. package/lib/stdlib/behavior/shortcuts-call.js.map +1 -1
  152. package/lib/stdlib/behavior/zoom-canvas-3d.js +4 -1
  153. package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
  154. package/lib/stdlib/behavior/zoom-canvas.d.ts +1 -0
  155. package/lib/stdlib/behavior/zoom-canvas.js +8 -2
  156. package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
  157. package/lib/stdlib/index.d.ts +6 -1
  158. package/lib/stdlib/index.js +8 -3
  159. package/lib/stdlib/index.js.map +1 -1
  160. package/lib/stdlib/item/edge/base.js +5 -1
  161. package/lib/stdlib/item/edge/base.js.map +1 -1
  162. package/lib/stdlib/item/edge/cubic-horizontal.js.map +1 -1
  163. package/lib/stdlib/item/edge/cubic-vertical.js.map +1 -1
  164. package/lib/stdlib/item/edge/cubic.js +2 -2
  165. package/lib/stdlib/item/edge/cubic.js.map +1 -1
  166. package/lib/stdlib/item/edge/loop.js +3 -3
  167. package/lib/stdlib/item/edge/loop.js.map +1 -1
  168. package/lib/stdlib/item/node/base.d.ts +1 -0
  169. package/lib/stdlib/item/node/base.js +5 -2
  170. package/lib/stdlib/item/node/base.js.map +1 -1
  171. package/lib/stdlib/item/node/cube.d.ts +35 -0
  172. package/lib/stdlib/item/node/cube.js +58 -0
  173. package/lib/stdlib/item/node/cube.js.map +1 -0
  174. package/lib/stdlib/item/node/index.d.ts +3 -0
  175. package/lib/stdlib/item/node/index.js +3 -0
  176. package/lib/stdlib/item/node/index.js.map +1 -1
  177. package/lib/stdlib/plugin/edgeFilterLens/index.d.ts +66 -0
  178. package/lib/stdlib/plugin/edgeFilterLens/index.js +313 -0
  179. package/lib/stdlib/plugin/edgeFilterLens/index.js.map +1 -0
  180. package/lib/stdlib/plugin/grid/index.d.ts +1 -1
  181. package/lib/stdlib/plugin/grid/index.js +6 -7
  182. package/lib/stdlib/plugin/grid/index.js.map +1 -1
  183. package/lib/stdlib/plugin/hull/convexHull.d.ts +1 -1
  184. package/lib/stdlib/plugin/hull/hullComponent.js +2 -3
  185. package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -1
  186. package/lib/stdlib/plugin/hull/util.d.ts +2 -2
  187. package/lib/stdlib/plugin/hull/util.js +26 -22
  188. package/lib/stdlib/plugin/hull/util.js.map +1 -1
  189. package/lib/stdlib/plugin/index.d.ts +1 -0
  190. package/lib/stdlib/plugin/index.js +1 -0
  191. package/lib/stdlib/plugin/index.js.map +1 -1
  192. package/lib/stdlib/plugin/legend/index.d.ts +2 -2
  193. package/lib/stdlib/plugin/legend/index.js +3 -3
  194. package/lib/stdlib/plugin/legend/index.js.map +1 -1
  195. package/lib/stdlib/plugin/menu/index.d.ts +4 -4
  196. package/lib/stdlib/plugin/menu/index.js +6 -6
  197. package/lib/stdlib/plugin/menu/index.js.map +1 -1
  198. package/lib/stdlib/plugin/minimap/index.d.ts +1 -1
  199. package/lib/stdlib/plugin/minimap/index.js +6 -6
  200. package/lib/stdlib/plugin/minimap/index.js.map +1 -1
  201. package/lib/stdlib/plugin/timebar/index.js +2 -2
  202. package/lib/stdlib/plugin/timebar/index.js.map +1 -1
  203. package/lib/stdlib/plugin/toolbar/index.d.ts +3 -3
  204. package/lib/stdlib/plugin/toolbar/index.js +5 -5
  205. package/lib/stdlib/plugin/toolbar/index.js.map +1 -1
  206. package/lib/stdlib/plugin/tooltip/index.d.ts +4 -4
  207. package/lib/stdlib/plugin/tooltip/index.js +10 -11
  208. package/lib/stdlib/plugin/tooltip/index.js.map +1 -1
  209. package/lib/stdlib/plugin/types.d.ts +1 -0
  210. package/lib/stdlib/plugin/watermaker/index.d.ts +78 -0
  211. package/lib/stdlib/plugin/watermaker/index.js +247 -0
  212. package/lib/stdlib/plugin/watermaker/index.js.map +1 -0
  213. package/lib/types/index.d.ts +2 -1
  214. package/lib/types/index.js +3 -1
  215. package/lib/types/index.js.map +1 -1
  216. package/lib/types/plugin.d.ts +1 -1
  217. package/lib/util/bbox.js +4 -5
  218. package/lib/util/bbox.js.map +1 -1
  219. package/lib/util/behavior.d.ts +2 -2
  220. package/lib/util/behavior.js +2 -2
  221. package/lib/util/behavior.js.map +1 -1
  222. package/lib/util/data.d.ts +2 -2
  223. package/lib/util/data.js.map +1 -1
  224. package/lib/util/dom.d.ts +15 -0
  225. package/lib/util/dom.js +34 -0
  226. package/lib/util/dom.js.map +1 -0
  227. package/lib/util/extend.d.ts +1 -1
  228. package/lib/util/extend.js +0 -1
  229. package/lib/util/extend.js.map +1 -1
  230. package/lib/util/index.d.ts +7 -52
  231. package/lib/util/index.js +23 -23
  232. package/lib/util/index.js.map +1 -1
  233. package/lib/util/layout.d.ts +1 -1
  234. package/lib/util/layout.js.map +1 -1
  235. package/lib/util/loop.d.ts +1 -1
  236. package/lib/util/math.d.ts +1 -1
  237. package/lib/util/matrix.d.ts +6 -0
  238. package/lib/util/matrix.js +52 -0
  239. package/lib/util/matrix.js.map +1 -0
  240. package/lib/util/path.js +2 -2
  241. package/lib/util/path.js.map +1 -1
  242. package/lib/util/point.d.ts +1 -1
  243. package/lib/util/polyline.d.ts +2 -1
  244. package/lib/util/polyline.js +2 -1
  245. package/lib/util/polyline.js.map +1 -1
  246. package/lib/util/router.d.ts +1 -1
  247. package/lib/util/shape.js +12 -12
  248. package/lib/util/shape.js.map +1 -1
  249. package/lib/util/shape3d.js +15 -11
  250. package/lib/util/shape3d.js.map +1 -1
  251. package/lib/util/text.d.ts +1 -1
  252. package/lib/util/text.js +3 -2
  253. package/lib/util/text.js.map +1 -1
  254. package/package.json +34 -41
  255. package/src/api-doc/graph.ts +4 -3
  256. package/src/constant/shape.ts +1 -1
  257. package/src/index.ts +5 -6
  258. package/src/item/item.ts +2 -0
  259. package/src/runtime/controller/item.ts +33 -14
  260. package/src/runtime/controller/layout.ts +1 -5
  261. package/src/runtime/controller/plugin.ts +14 -3
  262. package/src/runtime/graph.ts +12 -6
  263. package/src/stdlib/behavior/drag-canvas.ts +19 -7
  264. package/src/stdlib/behavior/shortcuts-call.ts +13 -4
  265. package/src/stdlib/behavior/zoom-canvas-3d.ts +4 -1
  266. package/src/stdlib/behavior/zoom-canvas.ts +15 -2
  267. package/src/stdlib/index.ts +10 -1
  268. package/src/stdlib/item/edge/base.ts +5 -2
  269. package/src/stdlib/item/edge/cubic-horizontal.ts +0 -1
  270. package/src/stdlib/item/edge/cubic-vertical.ts +0 -1
  271. package/src/stdlib/item/edge/cubic.ts +1 -1
  272. package/src/stdlib/item/edge/loop.ts +1 -1
  273. package/src/stdlib/item/node/base.ts +5 -1
  274. package/src/stdlib/item/node/cube.ts +102 -0
  275. package/src/stdlib/item/node/index.ts +3 -0
  276. package/src/stdlib/plugin/edgeFilterLens/index.ts +387 -0
  277. package/src/stdlib/plugin/grid/index.ts +6 -6
  278. package/src/stdlib/plugin/hull/convexHull.ts +1 -1
  279. package/src/stdlib/plugin/hull/hullComponent.ts +2 -3
  280. package/src/stdlib/plugin/hull/util.ts +6 -2
  281. package/src/stdlib/plugin/index.ts +1 -0
  282. package/src/stdlib/plugin/legend/index.ts +6 -6
  283. package/src/stdlib/plugin/menu/index.ts +13 -13
  284. package/src/stdlib/plugin/minimap/index.ts +6 -6
  285. package/src/stdlib/plugin/timebar/index.ts +4 -4
  286. package/src/stdlib/plugin/toolbar/index.ts +8 -8
  287. package/src/stdlib/plugin/tooltip/index.ts +10 -10
  288. package/src/stdlib/plugin/types.ts +1 -0
  289. package/src/stdlib/plugin/watermaker/index.ts +302 -0
  290. package/src/types/index.ts +2 -1
  291. package/src/types/plugin.ts +1 -1
  292. package/src/util/bbox.ts +4 -5
  293. package/src/util/behavior.ts +4 -4
  294. package/src/util/data.ts +2 -3
  295. package/src/util/dom.ts +33 -0
  296. package/src/util/extend.ts +2 -3
  297. package/src/util/index.ts +7 -24
  298. package/src/util/layout.ts +3 -2
  299. package/src/util/loop.ts +1 -1
  300. package/src/util/math.ts +1 -1
  301. package/src/util/matrix.ts +66 -0
  302. package/src/util/path.ts +1 -1
  303. package/src/util/point.ts +1 -1
  304. package/src/util/polyline.ts +2 -1
  305. package/src/util/router.ts +1 -1
  306. package/src/util/shape.ts +16 -12
  307. package/src/util/shape3d.ts +19 -10
  308. package/src/util/text.ts +3 -1
  309. package/esm/stdlib/plugin/map/index.d.ts +0 -118
  310. package/esm/stdlib/plugin/map/index.js +0 -683
  311. package/esm/stdlib/plugin/map/index.js.map +0 -1
  312. package/lib/stdlib/plugin/map/index.d.ts +0 -118
  313. package/lib/stdlib/plugin/map/index.js +0 -687
  314. package/lib/stdlib/plugin/map/index.js.map +0 -1
  315. package/src/stdlib/plugin/map/index.ts +0 -808
@@ -0,0 +1,387 @@
1
+ import { DisplayObject } from '@antv/g';
2
+ import { clone } from '@antv/util';
3
+ import { Plugin as Base, IPluginBaseConfig } from '../../../types/plugin';
4
+ import { IGraph } from '../../../types';
5
+ import { IG6GraphEvent } from '../../../types/event';
6
+ import { ShapeStyle } from '../../../types/item';
7
+ import { distance } from '../../../util/point';
8
+
9
+ const DELTA = 0.01;
10
+ interface EdgeFilterLensConfig extends IPluginBaseConfig {
11
+ trigger?: 'mousemove' | 'click' | 'drag';
12
+ r?: number;
13
+ delegateStyle?: ShapeStyle;
14
+ showLabel?: 'node' | 'edge' | 'both' | undefined;
15
+ scaleRBy?: 'wheel' | undefined;
16
+ maxR?: number;
17
+ minR?: number;
18
+ showType?: 'one' | 'both' | 'only-source' | 'only-target'; // 更名,原名与plugin的type冲突
19
+ shouldShow?: (d?: unknown) => boolean;
20
+ }
21
+
22
+ const lensDelegateStyle = {
23
+ stroke: '#000',
24
+ strokeOpacity: 0.8,
25
+ lineWidth: 2,
26
+ fillOpacity: 1,
27
+ fill: '#fff',
28
+ };
29
+
30
+ export class EdgeFilterLens extends Base {
31
+ private showNodeLabel: boolean;
32
+ private showEdgeLabel: boolean;
33
+ private delegate: DisplayObject;
34
+ private cachedTransientNodes: Set<string | number>;
35
+ private cachedTransientEdges: Set<string | number>;
36
+ private dragging: boolean;
37
+ private delegateCenterDiff: { x: number; y: number };
38
+
39
+ constructor(config?: EdgeFilterLensConfig) {
40
+ super(config);
41
+ this.cachedTransientNodes = new Set();
42
+ this.cachedTransientEdges = new Set();
43
+ }
44
+
45
+ public getDefaultCfgs(): EdgeFilterLensConfig {
46
+ return {
47
+ showType: 'both',
48
+ trigger: 'mousemove',
49
+ r: 60,
50
+ delegateStyle: clone(lensDelegateStyle),
51
+ showLabel: 'edge',
52
+ scaleRBy: 'wheel',
53
+ };
54
+ }
55
+
56
+ public getEvents() {
57
+ let events = {
58
+ pointerdown: this.onPointerDown,
59
+ pointerup: this.onPointerUp,
60
+ wheel: this.onWheel,
61
+ } as {
62
+ [key: string]: any;
63
+ };
64
+ switch (this.options.trigger) {
65
+ case 'click':
66
+ events = {
67
+ ...events,
68
+ click: this.filter,
69
+ };
70
+ break;
71
+ case 'drag':
72
+ events = {
73
+ ...events,
74
+ pointermove: this.onPointerMove,
75
+ };
76
+ break;
77
+ default:
78
+ events = {
79
+ ...events,
80
+ pointermove: this.filter,
81
+ };
82
+ break;
83
+ }
84
+ return events;
85
+ }
86
+
87
+ public init(graph: IGraph) {
88
+ super.init(graph);
89
+ const showLabel = this.options.showLabel;
90
+ const showNodeLabel = showLabel === 'node' || showLabel === 'both';
91
+ const showEdgeLabel = showLabel === 'edge' || showLabel === 'both';
92
+ this.showNodeLabel = showNodeLabel;
93
+ this.showEdgeLabel = showEdgeLabel;
94
+ const shouldShow = this.options.shouldShow;
95
+ if (!shouldShow) this.options.shouldShow = () => true;
96
+ }
97
+
98
+ protected onPointerUp(e: IG6GraphEvent) {
99
+ this.dragging = false;
100
+ }
101
+
102
+ protected onPointerMove(e: IG6GraphEvent) {
103
+ if (!this.dragging) return;
104
+ this.moveDelegate(e);
105
+ }
106
+
107
+ protected onPointerDown(e: IG6GraphEvent) {
108
+ const { delegate: lensDelegate } = this;
109
+ let cacheCenter;
110
+ if (!lensDelegate || lensDelegate.destroyed) {
111
+ cacheCenter = { x: e.canvas.x, y: e.canvas.y };
112
+ this.filter(e);
113
+ } else {
114
+ cacheCenter = {
115
+ x: lensDelegate.style.cx,
116
+ y: lensDelegate.style.cy,
117
+ };
118
+ }
119
+ this.delegateCenterDiff = {
120
+ x: e.canvas.x - cacheCenter.x,
121
+ y: e.canvas.y - cacheCenter.y,
122
+ };
123
+ this.dragging = true;
124
+ }
125
+
126
+ // Determine whether it is dragged in the delegate
127
+ protected isInLensDelegate(lensDelegate, pointer): boolean {
128
+ const { cx: lensX, cy: lensY, r: lensR } = lensDelegate.style;
129
+ if (
130
+ pointer.x >= lensX - lensR &&
131
+ pointer.x <= lensX + lensR &&
132
+ pointer.y >= lensY - lensR &&
133
+ pointer.y <= lensY + lensR
134
+ ) {
135
+ return true;
136
+ }
137
+ return false;
138
+ }
139
+
140
+ protected moveDelegate(e) {
141
+ if (
142
+ this.isInLensDelegate(this.delegate, { x: e.canvas.x, y: e.canvas.y })
143
+ ) {
144
+ const center = {
145
+ x: e.canvas.x - this.delegateCenterDiff.x,
146
+ y: e.canvas.y - this.delegateCenterDiff.y,
147
+ };
148
+ this.filter(e, center);
149
+ }
150
+ }
151
+
152
+ protected onWheel(e: IG6GraphEvent) {
153
+ const { delegate: lensDelegate, options } = this;
154
+ const { scaleRBy } = options;
155
+ if (!lensDelegate || lensDelegate.destroyed) return;
156
+ if (scaleRBy !== 'wheel') return;
157
+ if (this.isInLensDelegate(lensDelegate, { x: e.canvas.x, y: e.canvas.y })) {
158
+ if (scaleRBy === 'wheel') {
159
+ this.scaleRByWheel(e);
160
+ }
161
+ }
162
+ }
163
+
164
+ /**
165
+ * Scale the range by wheel
166
+ * @param e mouse wheel event
167
+ */
168
+ protected scaleRByWheel(e: IG6GraphEvent) {
169
+ if (!e || !e.originalEvent) return;
170
+ if (e.preventDefault) e.preventDefault();
171
+ const { graph, options } = this;
172
+ const graphCanvasEl = graph.canvas.context.config.canvas;
173
+ const graphHeight = graphCanvasEl?.height || 500;
174
+ const maxR = options.maxR
175
+ ? Math.min(options.maxR, graphHeight)
176
+ : graphHeight;
177
+ const minR = options.minR
178
+ ? Math.max(options.minR, graphHeight * DELTA)
179
+ : graphHeight * DELTA;
180
+
181
+ const scale = 1 + (e.originalEvent as any).deltaY * -1 * DELTA;
182
+ let r = options.r * scale;
183
+ r = Math.min(r, maxR);
184
+ r = Math.max(r, minR);
185
+ options.r = r;
186
+ this.delegate.style.r = r;
187
+ this.filter(e);
188
+ }
189
+
190
+ /**
191
+ * Response function for mousemove, click, or drag to filter out the edges
192
+ * @param e mouse event
193
+ */
194
+ protected filter(e: IG6GraphEvent, mousePos?) {
195
+ const {
196
+ graph,
197
+ options,
198
+ showNodeLabel,
199
+ showEdgeLabel,
200
+ cachedTransientNodes,
201
+ cachedTransientEdges,
202
+ } = this;
203
+ const r = options.r;
204
+ const showType = options.showType;
205
+ const shouldShow = options.shouldShow;
206
+ const fCenter = mousePos || { x: e.canvas.x, y: e.canvas.y };
207
+ this.updateDelegate(fCenter, r);
208
+
209
+ const nodes = graph.getAllNodesData();
210
+ const hitNodesMap = new Map();
211
+ nodes.forEach((node) => {
212
+ const { data, id } = node;
213
+ if (distance({ x: data.x, y: data.y }, fCenter) < r) {
214
+ hitNodesMap.set(id, node);
215
+ }
216
+ });
217
+
218
+ const edges = graph.getAllEdgesData();
219
+ const hitEdges = [];
220
+ edges.forEach((edge) => {
221
+ const sourceId = edge.source;
222
+ const targetId = edge.target;
223
+ if (shouldShow(edge)) {
224
+ if (showType === 'only-source' || showType === 'one') {
225
+ if (hitNodesMap.get(sourceId) && !hitNodesMap.get(targetId))
226
+ hitEdges.push(edge);
227
+ } else if (showType === 'only-target' || showType === 'one') {
228
+ if (hitNodesMap.get(targetId) && !hitNodesMap.get(sourceId))
229
+ hitEdges.push(edge);
230
+ } else if (
231
+ showType === 'both' &&
232
+ hitNodesMap.get(sourceId) &&
233
+ hitNodesMap.get(targetId)
234
+ ) {
235
+ hitEdges.push(edge);
236
+ }
237
+ }
238
+ });
239
+
240
+ const currentTransientNodes = new Set<string | number>();
241
+ const currentTransientEdges = new Set<string | number>();
242
+
243
+ hitNodesMap.forEach((node) => {
244
+ currentTransientNodes.add(node.id);
245
+
246
+ if (cachedTransientNodes.has(node.id)) {
247
+ cachedTransientNodes.delete(node.id);
248
+ } else {
249
+ graph.drawTransient('node', node.id, {
250
+ shapeIds: showNodeLabel
251
+ ? ['labelShape', 'labelBackgroundShape', 'keyShape']
252
+ : ['keyShape'],
253
+ });
254
+ }
255
+ });
256
+
257
+ cachedTransientNodes.forEach((id) => {
258
+ graph.drawTransient('node', id, { action: 'remove' });
259
+ });
260
+
261
+ if (showEdgeLabel) {
262
+ hitEdges.forEach((edge) => {
263
+ currentTransientEdges.add(edge.id);
264
+
265
+ if (cachedTransientEdges.has(edge.id)) {
266
+ cachedTransientEdges.delete(edge.id);
267
+ } else {
268
+ graph.drawTransient('edge', edge.id, {
269
+ shapeIds: ['labelShape', 'labelBackgroundShape', 'keyShape'],
270
+ drawSource: false,
271
+ drawTarget: false,
272
+ });
273
+ }
274
+ });
275
+
276
+ cachedTransientEdges.forEach((id) => {
277
+ graph.drawTransient('edge', id, { action: 'remove' });
278
+ });
279
+ }
280
+
281
+ this.cachedTransientNodes = currentTransientNodes;
282
+ this.cachedTransientEdges = currentTransientEdges;
283
+ }
284
+
285
+ /**
286
+ * Adjust part of the parameters, including trigger, showType, r, maxR, minR, shouldShow, showLabel, and scaleRBy
287
+ * @param {EdgeFilterLensConfig} cfg
288
+ */
289
+ public updateParams(cfg: EdgeFilterLensConfig) {
290
+ const self = this;
291
+ const { r, trigger, minR, maxR, scaleRBy, showLabel, shouldShow } = cfg;
292
+ if (!isNaN(cfg.r)) {
293
+ self.options.r = r;
294
+ }
295
+ if (!isNaN(maxR)) {
296
+ self.options.maxR = maxR;
297
+ }
298
+ if (!isNaN(minR)) {
299
+ self.options.minR = minR;
300
+ }
301
+ if (trigger === 'mousemove' || trigger === 'click' || trigger === 'drag') {
302
+ self.options.trigger = trigger;
303
+ }
304
+ if (scaleRBy === 'wheel' || scaleRBy === 'unset') {
305
+ self.options.scaleRBy = scaleRBy;
306
+ self.delegate.remove();
307
+ self.delegate.destroy();
308
+ }
309
+ if (showLabel === 'node' || showLabel === 'both') {
310
+ self.showNodeLabel = true;
311
+ }
312
+ if (showLabel === 'edge' || showLabel === 'both') {
313
+ self.showEdgeLabel = true;
314
+ }
315
+ if (shouldShow) {
316
+ self.options.shouldShow = shouldShow;
317
+ }
318
+ }
319
+
320
+ /**
321
+ * Update the delegate shape of the lens
322
+ * @param {Point} mCenter the center of the shape
323
+ * @param {number} r the radius of the shape
324
+ */
325
+ private updateDelegate(mCenter, r) {
326
+ const { graph, options, delegate } = this;
327
+ let lensDelegate = delegate;
328
+ if (!lensDelegate || lensDelegate.destroyed) {
329
+ // 拖动多个
330
+ const attrs = options.delegateStyle || lensDelegateStyle;
331
+
332
+ // model上的x, y是相对于图形中心的,delegateShape是g实例,x,y是绝对坐标
333
+ lensDelegate = graph.drawTransient('circle', 'lens-shape', {
334
+ style: {
335
+ r,
336
+ cx: mCenter.x,
337
+ cy: mCenter.y,
338
+ zIndex: -1,
339
+ ...attrs,
340
+ },
341
+ });
342
+ lensDelegate.toBack();
343
+ } else {
344
+ lensDelegate = graph.drawTransient('circle', 'lens-shape', {
345
+ style: {
346
+ r,
347
+ cx: mCenter.x,
348
+ cy: mCenter.y,
349
+ },
350
+ });
351
+ }
352
+
353
+ this.delegate = lensDelegate;
354
+ }
355
+
356
+ /**
357
+ * Clear the filtering
358
+ */
359
+ public clear() {
360
+ const {
361
+ graph,
362
+ delegate: lensDelegate,
363
+ cachedTransientNodes,
364
+ cachedTransientEdges,
365
+ } = this;
366
+
367
+ if (lensDelegate && !lensDelegate.destroyed) {
368
+ graph.drawTransient('circle', 'lens-shape', { action: 'remove' });
369
+ }
370
+ cachedTransientNodes.forEach((id) => {
371
+ graph.drawTransient('node', id, { action: 'remove' });
372
+ });
373
+ cachedTransientEdges.forEach((id) => {
374
+ graph.drawTransient('edge', id, { action: 'remove' });
375
+ });
376
+
377
+ cachedTransientNodes.clear();
378
+ cachedTransientEdges.clear();
379
+ }
380
+
381
+ /**
382
+ * Destroy the component
383
+ */
384
+ public destroy() {
385
+ this.clear();
386
+ }
387
+ }
@@ -1,7 +1,7 @@
1
1
  // TODO: update type define.
2
- import { createDom, modifyCSS } from '@antv/dom-util';
3
2
  import { Canvas } from '@antv/g';
4
3
  import { uniqueId } from '@antv/util';
4
+ import { createDOM, modifyCSS } from '../../../util/dom';
5
5
  import { IGraph } from '../../../types';
6
6
  import { Plugin as Base, IPluginBaseConfig } from '../../../types/plugin';
7
7
 
@@ -28,7 +28,7 @@ interface ViewPortEventParam {
28
28
  export class Grid extends Base {
29
29
  private canvas: Canvas;
30
30
  private viewport: HTMLElement | undefined;
31
- private container: HTMLDivElement;
31
+ private container: HTMLElement;
32
32
  constructor(options?: GridConfig) {
33
33
  super(options);
34
34
  }
@@ -49,11 +49,11 @@ export class Grid extends Base {
49
49
  const [width, height] = graph.getSize();
50
50
  const img = this.options.img || GRID_PNG;
51
51
 
52
- const container: HTMLDivElement = createDom(
52
+ const container: HTMLElement = createDOM(
53
53
  `<div class='g6-grid-container' style="position: absolute; left:0;top:0;right:0;bottom:0;overflow: hidden;"></div>`,
54
54
  );
55
55
 
56
- const gridContainer: HTMLDivElement = createDom(
56
+ const gridContainer: HTMLElement = createDOM(
57
57
  `<div
58
58
  class='g6-grid'
59
59
  style='position:absolute;
@@ -96,7 +96,7 @@ export class Grid extends Base {
96
96
  * @param param
97
97
  */
98
98
  protected updateGrid(param: ViewPortEventParam) {
99
- const gridContainer: HTMLDivElement = this.container;
99
+ const gridContainer: HTMLElement = this.container;
100
100
  let { matrix } = param;
101
101
  if (!matrix) matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
102
102
 
@@ -110,7 +110,7 @@ export class Grid extends Base {
110
110
  });
111
111
  }
112
112
 
113
- public getContainer(): HTMLDivElement {
113
+ public getContainer(): HTMLElement {
114
114
  return this.container;
115
115
  }
116
116
 
@@ -1,4 +1,4 @@
1
- import { ComboModel, NodeModel } from 'types';
1
+ import { ComboModel, NodeModel } from '../../../types';
2
2
  import { Point } from '../../../types/common';
3
3
 
4
4
  /**
@@ -1,4 +1,3 @@
1
- import { parsePathString } from '@antv/path-util';
2
1
  import { DisplayObject } from '@antv/g';
3
2
  import { isArray } from '@antv/util';
4
3
  import { ComboModel, ID, IGraph, NodeModel } from '../../../types';
@@ -141,7 +140,7 @@ export default class Hull {
141
140
  contour.map((p) => [p.x, p.y]),
142
141
  this.padding,
143
142
  );
144
- path = parsePathString(hull);
143
+ path = hull;
145
144
  break;
146
145
  case 'smooth-convex':
147
146
  contour = genConvexHull(members);
@@ -150,7 +149,7 @@ export default class Hull {
150
149
  contour.map((p) => [p.x, p.y]),
151
150
  this.padding,
152
151
  );
153
- path = parsePathString(hull);
152
+ path = hull;
154
153
  } else if (contour.length > 2) {
155
154
  hull = paddedHull(
156
155
  contour.map((p) => [p.x, p.y]),
@@ -1,4 +1,4 @@
1
- import { vec2 } from '@antv/matrix-util';
1
+ import { vec2 } from 'gl-matrix';
2
2
  import { ID, IGraph } from 'types';
3
3
  import { AABB } from '@antv/g';
4
4
  import { Bounds, Point } from '../../../types/common';
@@ -56,7 +56,11 @@ export function roundedHull(polyPoints: vec2[], padding: number) {
56
56
  const p1 = [points[0][0], points[0][1] - padding];
57
57
  const p2 = [points[0][0], points[0][1] + padding];
58
58
 
59
- return `M ${p1} A ${padding},${padding},0,0,0,${p2} A ${padding},${padding},0,0,0,${p1}`;
59
+ return [
60
+ ['M', p1],
61
+ ['A', padding, padding, 0, 0, 0, p2],
62
+ ['A', padding, padding, 0, 0, 0, p1],
63
+ ];
60
64
  };
61
65
 
62
66
  // The rounded hull path around two points
@@ -8,3 +8,4 @@ export * from './toolbar';
8
8
  export * from './tooltip';
9
9
  export * from './timebar';
10
10
  export * from './snapline';
11
+ export * from './edgeFilterLens';
@@ -1,13 +1,13 @@
1
1
  import { Category } from '@antv/gui';
2
2
  import { Canvas, DisplayObject, Circle, Line } from '@antv/g';
3
3
  import { isFunction, isString, upperFirst, uniqueId } from '@antv/util';
4
- import { createDom } from '@antv/dom-util';
5
4
  import { ID } from '@antv/graphlib';
6
5
  import { IGraph } from '../../../types';
7
6
  import { RendererName } from '../../../types/render';
8
7
  import { Plugin as Base, IPluginBaseConfig } from '../../../types/plugin';
9
8
  import { createCanvas } from '../../../util/canvas';
10
9
  import { ShapeTagMap, formatPadding } from '../../../util/shape';
10
+ import { createDOM } from '../../../util/dom';
11
11
 
12
12
  const LEGEND_CATEGORY_ITEM_MARKER = '.legend-category-item-marker';
13
13
 
@@ -51,7 +51,7 @@ export interface LegendConfig extends IPluginBaseConfig {
51
51
  /**
52
52
  * Container for the legend, using graph's container by default
53
53
  */
54
- container?: HTMLDivElement | string;
54
+ container?: HTMLElement | string;
55
55
  /**
56
56
  * Renderer for the legend canvas, 'canvas' by default
57
57
  */
@@ -102,7 +102,7 @@ export class Legend extends Base {
102
102
  */
103
103
  private edgeLegend: Category;
104
104
 
105
- private wrapper: HTMLDivElement;
105
+ private wrapper: HTMLElement;
106
106
  private canvas: Canvas;
107
107
 
108
108
  private size: ('fit-content' | number)[];
@@ -303,7 +303,7 @@ export class Legend extends Base {
303
303
 
304
304
  /**
305
305
  * Creates a wrapper div element for the graph and appends it to the container.
306
- * @returns {HTMLDivElement} - The created wrapper div element.
306
+ * @returns {HTMLElement} - The created wrapper div element.
307
307
  */
308
308
  private createWrapper() {
309
309
  const { options, graph, size } = this;
@@ -322,9 +322,9 @@ export class Legend extends Base {
322
322
  size[0] === 'fit-content' ? 0 : size[0],
323
323
  size[1] === 'fit-content' ? 0 : size[1],
324
324
  ];
325
- const wrapper = (HTMLDivElement = createDom(
325
+ const wrapper = createDOM(
326
326
  `<div class='${className}' style='width: ${wrapperSize[0]}px; height: ${wrapperSize[1]}px; overflow: hidden;'></div>`,
327
- ));
327
+ );
328
328
  $container.appendChild(wrapper);
329
329
  return wrapper;
330
330
  }
@@ -1,11 +1,11 @@
1
- import { createDom, modifyCSS } from '@antv/dom-util';
2
- import { AABB } from '@antv/g';
3
1
  import { isString, uniqueId } from '@antv/util';
4
2
  import insertCss from 'insert-css';
5
3
  import Item from '../../../item/item';
4
+ import { createDOM, modifyCSS } from '../../../util/dom';
6
5
  import { IGraph } from '../../../types';
7
6
  import { IG6GraphEvent } from '../../../types/event';
8
7
  import { Plugin as Base, IPluginBaseConfig } from '../../../types/plugin';
8
+
9
9
  typeof document !== 'undefined' &&
10
10
  insertCss(`
11
11
  .g6-component-contextmenu {
@@ -39,14 +39,14 @@ typeof document !== 'undefined' &&
39
39
  * The `MenuConfig` interface contains the following properties:
40
40
 
41
41
  - `handleMenuClick`: An optional function for handling menu click events. It takes two arguments: `target` (of type HTMLElement) and `item` (of type Item), and has no return value.
42
- - `getContent`: An optional function for getting the content of the menu. It takes an optional argument of type `IG6GraphEvent`, and returns a value of type HTMLDivElement, string, or Promise (resolving to HTMLDivElement or string).
42
+ - `getContent`: An optional function for getting the content of the menu. It takes an optional argument of type `IG6GraphEvent`, and returns a value of type HTMLElement, string, or Promise (resolving to HTMLElement or string).
43
43
  - `offsetX`: An optional number representing the offset of the menu in the X direction.
44
44
  - `offsetY`: An optional number representing the offset of the menu in the Y direction.
45
45
  - `shouldBegin`: An optional function for determining whether the menu should be displayed. It takes an optional argument of type `IG6GraphEvent`, and returns a boolean value.
46
46
  - `itemTypes`: An optional array of strings representing the types of items for which the menu is allowed to be displayed.
47
47
  - `trigger`: An optional string, either 'click' or 'contextmenu', representing the event type that triggers the display of the menu.
48
48
  - `onHide`: An optional function to be executed when the menu is hidden. It takes no arguments and returns a boolean value.
49
- - `loadingContent`: An optional HTMLDivElement or string representing the loading DOM.
49
+ - `loadingContent`: An optional HTMLElement or string representing the loading DOM.
50
50
  - `liHoverStyle`: An optional object representing the style of li elements when hovered over. It can contain any number of key-value pairs, where the key is a style name and the value is a string.
51
51
  */
52
52
  export interface MenuConfig extends IPluginBaseConfig {
@@ -54,7 +54,7 @@ export interface MenuConfig extends IPluginBaseConfig {
54
54
  // return the content of menu, support the `Promise` type return value.
55
55
  getContent?: (
56
56
  evt?: IG6GraphEvent,
57
- ) => HTMLDivElement | string | Promise<HTMLDivElement | string>;
57
+ ) => HTMLElement | string | Promise<HTMLElement | string>;
58
58
  offsetX?: number;
59
59
  offsetY?: number;
60
60
  shouldBegin?: (evt?: IG6GraphEvent) => boolean;
@@ -62,7 +62,7 @@ export interface MenuConfig extends IPluginBaseConfig {
62
62
  trigger?: 'click' | 'contextmenu';
63
63
  onHide?: () => boolean;
64
64
  //loading Dom
65
- loadingContent?: HTMLDivElement | string;
65
+ loadingContent?: HTMLElement | string;
66
66
  liHoverStyle?: { [key: string]: string };
67
67
  }
68
68
 
@@ -126,16 +126,16 @@ export class Menu extends Base {
126
126
  .join('')}
127
127
  }
128
128
  `);
129
- const menu = createDom(
129
+ const menu = createDOM(
130
130
  `<div class=${className || 'g6-component-contextmenu'}></div>`,
131
131
  );
132
132
  modifyCSS(menu, { top: '0px', position: 'absolute', visibility: 'hidden' });
133
- let container: HTMLDivElement | null | string = this.options.container;
133
+ let container: HTMLElement | null | string = this.options.container;
134
134
  if (!container) {
135
- container = this.graph.container as HTMLDivElement;
135
+ container = this.graph.container as HTMLElement;
136
136
  }
137
137
  if (isString(container)) {
138
- container = document.getElementById(container) as HTMLDivElement;
138
+ container = document.getElementById(container) as HTMLElement;
139
139
  }
140
140
  container.appendChild(menu);
141
141
  this.menu = menu;
@@ -189,7 +189,7 @@ export class Menu extends Base {
189
189
  if (isString(menu)) {
190
190
  //the type is string
191
191
  menuDom.innerHTML = menu;
192
- } else if (menu instanceof HTMLDivElement) {
192
+ } else if (menu instanceof HTMLElement) {
193
193
  //the type is htmldom
194
194
  menuDom.innerHTML = menu.outerHTML;
195
195
  } else {
@@ -264,10 +264,10 @@ export class Menu extends Base {
264
264
  if (menu) {
265
265
  let container = this.options.container;
266
266
  if (!container) {
267
- container = this.graph.container as HTMLDivElement;
267
+ container = this.graph.container as HTMLElement;
268
268
  }
269
269
  if (isString(container)) {
270
- container = document.getElementById(container) as HTMLDivElement;
270
+ container = document.getElementById(container) as HTMLElement;
271
271
  }
272
272
  container.removeChild(menu);
273
273
  }
@@ -1,6 +1,5 @@
1
1
  // TODO: update type define.
2
2
  // @ts-nocheck
3
- import { createDom, modifyCSS } from '@antv/dom-util';
4
3
  import { Canvas, DisplayObject, Group, Rect } from '@antv/g';
5
4
  import { debounce, each, isNil, isString, uniqueId } from '@antv/util';
6
5
  import { IGraph } from '../../../types';
@@ -8,6 +7,7 @@ import { IG6GraphEvent } from '../../../types/event';
8
7
  import { ShapeStyle } from '../../../types/item';
9
8
  import { Plugin as Base, IPluginBaseConfig } from '../../../types/plugin';
10
9
  import { createCanvas } from '../../../util/canvas';
10
+ import { createDOM, modifyCSS } from '../../../util/dom';
11
11
 
12
12
  const DEFAULT_MODE = 'default';
13
13
  const KEYSHAPE_MODE = 'keyShape';
@@ -32,7 +32,7 @@ export interface MiniMapConfig extends IPluginBaseConfig {
32
32
  /** Whether to hide edges on minimap to enhance performance */
33
33
  hideEdge?: boolean;
34
34
  /** Container for minimap */
35
- container?: HTMLDivElement | null;
35
+ container?: HTMLElement | null;
36
36
  }
37
37
 
38
38
  export class Minimap extends Base {
@@ -47,7 +47,7 @@ export class Minimap extends Base {
47
47
  graphItem: DisplayObject;
48
48
  }
49
49
  > = new Map();
50
- private container: HTMLDivElement;
50
+ private container: HTMLElement;
51
51
  /** Ratio of (minimap graph size / main graph size). */
52
52
  private ratio: number;
53
53
  /** Distance from top of minimap graph to the top of minimap container. */
@@ -111,7 +111,7 @@ export class Minimap extends Base {
111
111
  const containerDOM = canvas.context.config.container as HTMLElement;
112
112
  const isFireFox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
113
113
  const isSafari = navigator.userAgent.toLowerCase().indexOf('safari') > -1;
114
- const viewport = createDom(`
114
+ const viewport = createDOM(`
115
115
  <div
116
116
  class=${viewportClassName}
117
117
  style='position:absolute;
@@ -631,12 +631,12 @@ export class Minimap extends Base {
631
631
  const { graph, options } = this;
632
632
  const { size, className } = options;
633
633
  let parentNode = options.container;
634
- const container: HTMLDivElement = createDom(
634
+ const container: HTMLElement = createDOM(
635
635
  `<div class='${className}' style='width: ${size[0]}px; height: ${size[1]}px; overflow: hidden;'></div>`,
636
636
  );
637
637
 
638
638
  if (isString(parentNode)) {
639
- parentNode = document.getElementById(parentNode) as HTMLDivElement;
639
+ parentNode = document.getElementById(parentNode) as HTMLElement;
640
640
  }
641
641
 
642
642
  if (parentNode) {