@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
package/src/item/item.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Group, DisplayObject, AABB, IAnimation } from '@antv/g';
2
- import { clone, isFunction, isObject, throttle } from '@antv/util';
2
+ import { clone, isFunction, isObject, pick, throttle } from '@antv/util';
3
3
  import { OTHER_SHAPES_FIELD_NAME, RESERVED_SHAPE_IDS } from '../constant';
4
4
  import { EdgeShapeMap } from '../types/edge';
5
5
  import {
@@ -11,7 +11,7 @@ import {
11
11
  ItemShapeStyles,
12
12
  ITEM_TYPE,
13
13
  State,
14
- LodStrategyObj,
14
+ LodLevelRanges,
15
15
  } from '../types/item';
16
16
  import { NodeShapeMap } from '../types/node';
17
17
  import { EdgeStyleSet, NodeStyleSet } from '../types/theme';
@@ -24,17 +24,19 @@ import {
24
24
  } from '../util/shape';
25
25
  import { isEncode } from '../util/type';
26
26
  import { DEFAULT_MAPPER } from '../util/mapper';
27
+ import { cloneJSON } from '../util/data';
27
28
  import {
28
29
  getShapeAnimateBeginStyles,
29
30
  animateShapes,
30
31
  GROUP_ANIMATE_STYLES,
31
32
  stopAnimate,
32
33
  } from '../util/animate';
33
- import { AnimateTiming, IAnimates } from '../types/animate';
34
- import { formatLodStrategy } from '../util/zoom';
35
- import { IStateAnimate } from '../types/animate';
34
+ import { AnimateTiming, IAnimates, IStateAnimate } from '../types/animate';
35
+ import { formatLodLevels } from '../util/zoom';
36
+ import { IGraph } from '../types';
36
37
 
37
38
  export default abstract class Item implements IItem {
39
+ public graph: IGraph;
38
40
  public destroyed = false;
39
41
  /** Inner model. */
40
42
  public model: ItemModel;
@@ -48,6 +50,8 @@ export default abstract class Item implements IItem {
48
50
  };
49
51
  /** The graphic group for item drawing. */
50
52
  public group: Group;
53
+ /** The graphic group for item'label drawing. */
54
+ public labelGroup: Group;
51
55
  /** The keyShape of the item. */
52
56
  public keyShape: DisplayObject;
53
57
  /** render extension for this item. */
@@ -63,7 +67,9 @@ export default abstract class Item implements IItem {
63
67
  public shapeMap: NodeShapeMap | EdgeShapeMap = {
64
68
  keyShape: undefined,
65
69
  };
66
- public afterDrawShapeMap = {};
70
+ public afterDrawShapeMap: {
71
+ [otherShapeId: string]: DisplayObject;
72
+ } = {};
67
73
  /** Set to different value in implements. */
68
74
  public type: ITEM_TYPE;
69
75
  /** The flag of transient item. */
@@ -79,7 +85,7 @@ export default abstract class Item implements IItem {
79
85
  [stateName: string]: ItemShapeStyles;
80
86
  };
81
87
  /** The zoom strategy to show and hide shapes according to their lod. */
82
- public lodStrategy: LodStrategyObj;
88
+ public lodLevels: LodLevelRanges;
83
89
  /** Last zoom ratio. */
84
90
  public zoom: number;
85
91
  /** Cache the chaging states which are not consomed by draw */
@@ -103,8 +109,10 @@ export default abstract class Item implements IItem {
103
109
  /** Initiate the item. */
104
110
  public init(props) {
105
111
  const {
112
+ graph,
106
113
  model,
107
114
  containerGroup,
115
+ labelContainerGroup,
108
116
  mapper,
109
117
  stateMapper,
110
118
  renderExtensions,
@@ -113,10 +121,15 @@ export default abstract class Item implements IItem {
113
121
  type: itemType,
114
122
  } = props;
115
123
  this.type = itemType;
124
+ this.graph = graph;
116
125
  this.group = new Group({ style: { zIndex: 0 } });
126
+ this.labelGroup = new Group({ style: { zIndex: 0 } });
117
127
  this.group.setAttribute('data-item-type', this.type);
118
128
  this.group.setAttribute('data-item-id', props.model.id);
129
+ this.labelGroup.setAttribute('data-item-type', this.type);
130
+ this.labelGroup.setAttribute('data-item-id', props.model.id);
119
131
  containerGroup.appendChild(this.group);
132
+ labelContainerGroup.appendChild(this.labelGroup);
120
133
  this.model = model;
121
134
  this.mapper = mapper;
122
135
  this.zoom = zoom;
@@ -125,14 +138,14 @@ export default abstract class Item implements IItem {
125
138
  this.renderExtensions = renderExtensions;
126
139
  const {
127
140
  type = this.type === 'edge' ? 'line-edge' : `circle-${this.type}`,
128
- lodStrategy: modelLodStrategy,
141
+ lodLevels: modelLodLevels,
129
142
  enableBalanceShape,
130
143
  } = this.displayModel.data;
131
144
  const RenderExtension = renderExtensions.find((ext) => ext.type === type);
132
145
  this.themeStyles = theme.styles;
133
- const lodStrategy = modelLodStrategy
134
- ? formatLodStrategy(modelLodStrategy)
135
- : theme.lodStrategy;
146
+ this.lodLevels = modelLodLevels
147
+ ? formatLodLevels(modelLodLevels)
148
+ : theme.lodLevels;
136
149
  if (!RenderExtension) {
137
150
  if (this.type === 'node') {
138
151
  throw new Error(
@@ -150,7 +163,7 @@ export default abstract class Item implements IItem {
150
163
  }
151
164
  this.renderExt = new RenderExtension({
152
165
  themeStyles: this.themeStyles?.default,
153
- lodStrategy,
166
+ lodLevels: this.lodLevels,
154
167
  enableBalanceShape,
155
168
  device: this.device,
156
169
  zoom: this.zoom,
@@ -174,10 +187,18 @@ export default abstract class Item implements IItem {
174
187
  ...this.shapeMap,
175
188
  ...this.afterDrawShapeMap,
176
189
  }) || {};
190
+ if (this.afterDrawShapeMap.labelShape) {
191
+ this.afterDrawShapeMap.labelShape.attributes.dataIsLabel = true;
192
+ }
193
+ if (this.afterDrawShapeMap.labelBackgroundShape) {
194
+ this.afterDrawShapeMap.labelBackgroundShape.attributes.dataIsLabelBackground =
195
+ true;
196
+ }
177
197
  const shapeMap = updateShapes(
178
198
  this.afterDrawShapeMap,
179
199
  afterDrawShapeMap,
180
200
  this.group,
201
+ this.labelGroup,
181
202
  false,
182
203
  (id) => {
183
204
  if (RESERVED_SHAPE_IDS.includes(id)) {
@@ -193,6 +214,7 @@ export default abstract class Item implements IItem {
193
214
  ...this.shapeMap,
194
215
  ...shapeMap,
195
216
  };
217
+ this.changedStates = [];
196
218
  }
197
219
 
198
220
  /**
@@ -205,7 +227,7 @@ export default abstract class Item implements IItem {
205
227
  isReplace?: boolean,
206
228
  itemTheme?: {
207
229
  styles: NodeStyleSet | EdgeStyleSet;
208
- lodStrategy: LodStrategyObj;
230
+ lodLevels: LodLevelRanges;
209
231
  },
210
232
  onlyMove?: boolean,
211
233
  animate = true,
@@ -224,9 +246,9 @@ export default abstract class Item implements IItem {
224
246
  );
225
247
  this.displayModel = displayModel;
226
248
 
227
- this.lodStrategy = displayModel.data.lodStrategy
228
- ? formatLodStrategy(displayModel.data.lodStrategy)
229
- : itemTheme?.lodStrategy || this.lodStrategy;
249
+ this.lodLevels = displayModel.data.lodLevels
250
+ ? formatLodLevels(displayModel.data.lodLevels)
251
+ : itemTheme?.lodLevels || this.lodLevels;
230
252
 
231
253
  if (onlyMove) {
232
254
  this.updatePosition(displayModel, diffData, animate, onfinish);
@@ -243,13 +265,13 @@ export default abstract class Item implements IItem {
243
265
  );
244
266
  this.renderExt = new RenderExtension({
245
267
  themeStyles: this.themeStyles.default,
246
- lodStrategy: this.lodStrategy,
268
+ lodLevels: this.lodLevels,
247
269
  device: this.device,
248
270
  zoom: this.zoom,
249
271
  });
250
272
  } else {
251
273
  this.renderExt.themeStyles = this.themeStyles.default;
252
- this.renderExt.lodStrategy = this.lodStrategy;
274
+ this.renderExt.lodLevels = this.lodLevels;
253
275
  }
254
276
  // 3. call element update fn from useLib
255
277
  if (this.states?.length) {
@@ -325,7 +347,7 @@ export default abstract class Item implements IItem {
325
347
  // === fields' values in mapper are final value or Encode ===
326
348
  const dataChangedFields = isReplace
327
349
  ? undefined
328
- : Object.keys(current).concat(Object.keys(otherFields)); // only fields in current data for partial updating
350
+ : Object.keys(current || {}).concat(Object.keys(otherFields)); // only fields in current data for partial updating
329
351
 
330
352
  let typeChange = false;
331
353
  const { data, ...otherProps } = innerModel;
@@ -367,6 +389,7 @@ export default abstract class Item implements IItem {
367
389
  displayModelData[fieldName] || isObject(innerModel.data[fieldName])
368
390
  ? {
369
391
  ...(innerModel.data[fieldName] as object),
392
+ ...(this.displayModel?.data[fieldName] as object),
370
393
  }
371
394
  : {};
372
395
  updateShapeChange({
@@ -418,10 +441,23 @@ export default abstract class Item implements IItem {
418
441
  }
419
442
 
420
443
  /** Show the item. */
421
- public show(animate = true) {
422
- Promise.all(this.stopAnimations()).finally(() => {
444
+ public show(animate = true, shapeIds = undefined) {
445
+ const shapeIdsToStop = shapeIds?.filter((id) => {
446
+ const shape = this.shapeMap[id];
447
+ return shape && shape.style.visibility === 'hidden';
448
+ });
449
+ if (shapeIds?.length && !shapeIdsToStop?.length) return;
450
+ if (!shapeIdsToStop || shapeIdsToStop.includes('labelShape')) {
451
+ this.labelGroup.style.visibility = 'visible';
452
+ }
453
+ Promise.all(this.stopAnimations(shapeIdsToStop)).finally(() => {
423
454
  if (this.destroyed) return;
424
455
  const { animates = {} } = this.displayModel.data;
456
+ const shapeIdsToShow =
457
+ shapeIdsToStop ||
458
+ Object.keys(this.shapeMap).filter(
459
+ (shapeId) => this.cacheHiddenByItem[shapeId],
460
+ );
425
461
  if (animate && animates.show?.length) {
426
462
  const showAnimateFieldsMap: any = {};
427
463
  Object.values(animates.show).forEach((animate) => {
@@ -431,24 +467,26 @@ export default abstract class Item implements IItem {
431
467
  ).concat(animate.fields);
432
468
  });
433
469
  const targetStyleMap = {};
434
- Object.keys(this.shapeMap).forEach((id) => {
470
+ shapeIdsToShow.forEach((id) => {
435
471
  const shape = this.shapeMap[id];
436
- if (this.cacheHiddenByItem[id]) {
437
- // set the animate fields to initial value
438
- if (showAnimateFieldsMap[id]) {
439
- targetStyleMap[id] = targetStyleMap[id] || {};
440
- const beginStyle = getShapeAnimateBeginStyles(shape);
441
- showAnimateFieldsMap[id].forEach((field) => {
442
- if (beginStyle.hasOwnProperty(field)) {
443
- targetStyleMap[id][field] = shape.style[field];
444
- shape.style[field] = beginStyle[field];
445
- }
446
- });
447
- }
448
- shape.show();
472
+ // set the animate fields to initial value
473
+ if (showAnimateFieldsMap[id]) {
474
+ targetStyleMap[id] = targetStyleMap[id] || {};
475
+ const beginStyle = getShapeAnimateBeginStyles(shape);
476
+ showAnimateFieldsMap[id].forEach((field) => {
477
+ if (beginStyle.hasOwnProperty(field)) {
478
+ targetStyleMap[id][field] = shape.style[field];
479
+ shape.style[field] = beginStyle[field];
480
+ }
481
+ });
449
482
  }
483
+ shape.show();
484
+ delete this.cacheHiddenByItem[id];
450
485
  });
451
- if (showAnimateFieldsMap.group && !this.shapeMap.keyShape.isVisible()) {
486
+ if (
487
+ showAnimateFieldsMap.group &&
488
+ this.shapeMap.keyShape.attributes.visibility === 'hidden'
489
+ ) {
452
490
  showAnimateFieldsMap.group.forEach((field) => {
453
491
  const usingField = field === 'size' ? 'transform' : field;
454
492
  if (GROUP_ANIMATE_STYLES[0].hasOwnProperty(usingField)) {
@@ -457,18 +495,19 @@ export default abstract class Item implements IItem {
457
495
  }
458
496
  });
459
497
  }
460
-
461
498
  if (Object.keys(targetStyleMap).length) {
462
499
  this.animations = this.runWithAnimates(
463
500
  animates,
464
501
  'show',
465
502
  targetStyleMap,
503
+ shapeIdsToShow,
466
504
  );
467
505
  }
468
506
  } else {
469
- Object.keys(this.shapeMap).forEach((id) => {
507
+ shapeIdsToShow.forEach((id) => {
470
508
  const shape = this.shapeMap[id];
471
- if (this.cacheHiddenByItem[id]) shape.show();
509
+ shape.show();
510
+ delete this.cacheHiddenByItem[id];
472
511
  });
473
512
  }
474
513
 
@@ -482,21 +521,32 @@ export default abstract class Item implements IItem {
482
521
  }
483
522
 
484
523
  /** Hides the item. */
485
- public hide(animate = true, keepKeyShape = false) {
524
+ public hide(animate = true, keepKeyShape = false, shapeIds = undefined) {
525
+ const shapeIdsToHide =
526
+ shapeIds?.filter((id) => {
527
+ const shape = this.shapeMap[id];
528
+ return (
529
+ shape &&
530
+ (shape.attributes.visibility !== 'hidden' ||
531
+ this.cacheNotHiddenByItem[id])
532
+ );
533
+ }) || Object.keys(this.shapeMap);
534
+ if (!shapeIdsToHide.length) return;
486
535
  this.cacheNotHiddenByItem = {};
487
536
  const func = () => {
488
- Object.keys(this.shapeMap).forEach((id) => {
537
+ shapeIdsToHide.forEach((id) => {
489
538
  if (keepKeyShape && id === 'keyShape') return;
490
539
  const shape = this.shapeMap[id];
491
- if (!shape.isVisible()) {
540
+ if (!shape || shape.attributes.visibility === 'hidden') {
492
541
  this.cacheNotHiddenByItem[id] = true;
493
542
  return;
494
543
  }
495
544
  shape.hide();
496
545
  this.cacheHiddenByItem[id] = true;
546
+ if (!shapeIds) this.visible = false;
497
547
  });
498
548
  };
499
- Promise.all(this.stopAnimations()).then(() => {
549
+ Promise.all(this.stopAnimations(shapeIdsToHide)).then(() => {
500
550
  if (this.destroyed) return;
501
551
  const { animates = {} } = this.displayModel.data;
502
552
  if (animate && animates.hide?.length) {
@@ -504,13 +554,13 @@ export default abstract class Item implements IItem {
504
554
  animates,
505
555
  'hide',
506
556
  undefined,
557
+ shapeIdsToHide,
507
558
  func,
508
559
  );
509
560
  } else {
510
561
  // 2. clear group and remove group
511
562
  func();
512
563
  }
513
- this.visible = false;
514
564
  });
515
565
  }
516
566
 
@@ -545,7 +595,7 @@ export default abstract class Item implements IItem {
545
595
  * @param value state value
546
596
  */
547
597
  public setState(state: string, value: string | boolean) {
548
- const previousStates = clone(this.states);
598
+ const previousStates = cloneJSON(this.states);
549
599
  const existState = this.states.find((item) => item.name === state);
550
600
  if (value) {
551
601
  if (existState) existState.value = value;
@@ -574,7 +624,7 @@ export default abstract class Item implements IItem {
574
624
  */
575
625
  public clearStates(states?: string[]) {
576
626
  // if states is not assigned, clear all the states on the item
577
- const previousStates = clone(this.states);
627
+ const previousStates = cloneJSON(this.states);
578
628
  const newStates = [];
579
629
  let changedStates = [];
580
630
  if (states) {
@@ -623,11 +673,12 @@ export default abstract class Item implements IItem {
623
673
  animates: IAnimates,
624
674
  timing: AnimateTiming,
625
675
  targetStyleMap: Object,
676
+ shapeIdsToShow: string[] | undefined,
626
677
  callback: Function = () => {},
627
678
  ) {
628
679
  let targetStyle = {};
629
680
  if (!targetStyleMap) {
630
- Object.keys(this.shapeMap).forEach((shapeId) => {
681
+ shapeIdsToShow?.forEach((shapeId) => {
631
682
  targetStyle[shapeId] = getShapeAnimateBeginStyles(
632
683
  this.shapeMap[shapeId],
633
684
  );
@@ -639,7 +690,8 @@ export default abstract class Item implements IItem {
639
690
  animates,
640
691
  targetStyle, // targetStylesMap
641
692
  this.shapeMap, // shapeMap
642
- this.group,
693
+ shapeIdsToShow,
694
+ [this.group, this.labelGroup],
643
695
  timing,
644
696
  [],
645
697
  () => {},
@@ -801,15 +853,18 @@ export default abstract class Item implements IItem {
801
853
  /**
802
854
  * Stop all the animations on the item.
803
855
  */
804
- public stopAnimations() {
856
+ public stopAnimations(shapeIds?: string[]) {
805
857
  const promises = [];
806
858
  if (this.animations?.length) {
807
- while (this.animations.length) {
808
- const animate = this.animations.pop();
809
- if (animate.playState !== 'running') break;
810
- promises.push(stopAnimate(animate));
811
- // @ts-ignore
812
- animate.onManualCancel?.();
859
+ for (let i = 0; i < this.animations.length; i++) {
860
+ const animate = this.animations[i];
861
+ if (!shapeIds?.length || shapeIds.includes(animate.effect.target.id)) {
862
+ this.animations.pop();
863
+ if (animate.playState !== 'running') break;
864
+ promises.push(stopAnimate(animate));
865
+ // @ts-ignore
866
+ animate.onManualCancel?.();
867
+ }
813
868
  }
814
869
  }
815
870
  if (this.groupAnimations?.length) {
@@ -848,10 +903,16 @@ export default abstract class Item implements IItem {
848
903
  this.renderExt.onZoom(this.shapeMap, zoom, this.cacheHiddenByItem);
849
904
  }
850
905
 
906
+ /**
907
+ * Update label positions on label canvas by getting viewport position from transformed canvas position.
908
+ */
909
+ public updateLabelPosition(ignoreVisibility: boolean = false) {}
910
+
851
911
  /** Destroy the item. */
852
912
  public destroy() {
853
913
  const func = () => {
854
914
  this.group.destroy();
915
+ this.labelGroup.destroy();
855
916
  this.model = null;
856
917
  this.displayModel = null;
857
918
  this.destroyed = true;
@@ -864,6 +925,7 @@ export default abstract class Item implements IItem {
864
925
  animates,
865
926
  'buildOut',
866
927
  undefined,
928
+ undefined,
867
929
  func,
868
930
  );
869
931
  } else {
@@ -938,12 +1000,12 @@ const updateShapeChange = ({
938
1000
  });
939
1001
  Object.keys(mapper).forEach((shapeAttrName) => {
940
1002
  if (innerModelValue?.hasOwnProperty(shapeAttrName)) return;
941
- const { value: mappedValue } = updateChange({
1003
+ const { value: mappedValue, changed } = updateChange({
942
1004
  innerModel,
943
1005
  mapper,
944
1006
  fieldName: shapeAttrName,
945
1007
  dataChangedFields,
946
1008
  });
947
- shapeConfig[shapeAttrName] = mappedValue;
1009
+ if (changed) shapeConfig[shapeAttrName] = mappedValue;
948
1010
  });
949
1011
  };
package/src/item/node.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Group } from '@antv/g';
2
- import { clone } from '@antv/util';
2
+ import { clone, debounce, throttle } from '@antv/util';
3
3
  import { Point } from '../types/common';
4
- import { ComboDisplayModel, ComboModel, NodeModel } from '../types';
5
- import { DisplayMapper, State, LodStrategyObj } from '../types/item';
4
+ import { ComboDisplayModel, ComboModel, IGraph, NodeModel } from '../types';
5
+ import { DisplayMapper, State, LodLevelRanges } from '../types/item';
6
6
  import { NodeDisplayModel, NodeModelData } from '../types/node';
7
7
  import { ComboStyleSet, NodeStyleSet } from '../types/theme';
8
8
  import { updateShapes } from '../util/shape';
@@ -17,9 +17,11 @@ import { ComboModelData } from '../types/combo';
17
17
  import Item from './item';
18
18
 
19
19
  interface IProps {
20
+ graph: IGraph;
20
21
  model: NodeModel | ComboModel;
21
22
  renderExtensions: any;
22
23
  containerGroup: Group;
24
+ labelContainerGroup?: Group; // TODO: optional?
23
25
  mapper?: DisplayMapper;
24
26
  stateMapper?: {
25
27
  [stateName: string]: DisplayMapper;
@@ -27,7 +29,7 @@ interface IProps {
27
29
  zoom?: number;
28
30
  theme: {
29
31
  styles: NodeStyleSet | ComboStyleSet;
30
- lodStrategy: LodStrategyObj;
32
+ lodLevels: LodLevelRanges;
31
33
  };
32
34
  device?: any; // for 3d shapes
33
35
  onframe?: Function;
@@ -61,7 +63,14 @@ export default class Node extends Item {
61
63
  animate = true,
62
64
  onfinish: Function = () => {},
63
65
  ) {
64
- const { group, renderExt, shapeMap: prevShapeMap, model } = this;
66
+ const {
67
+ group,
68
+ labelGroup,
69
+ renderExt,
70
+ shapeMap: prevShapeMap,
71
+ model,
72
+ graph,
73
+ } = this;
65
74
  renderExt.mergeStyles(displayModel);
66
75
 
67
76
  const firstRendering = !this.shapeMap?.keyShape;
@@ -71,9 +80,16 @@ export default class Node extends Item {
71
80
  diffData,
72
81
  diffState,
73
82
  );
83
+ if (this.shapeMap.labelShape) {
84
+ this.shapeMap.labelShape.attributes.dataIsLabel = true;
85
+ }
86
+ if (this.shapeMap.labelBackgroundShape) {
87
+ this.shapeMap.labelBackgroundShape.attributes.dataIsLabelBackground =
88
+ true;
89
+ }
74
90
 
75
91
  // add shapes to group, and update shapeMap
76
- this.shapeMap = updateShapes(prevShapeMap, shapeMap, group);
92
+ this.shapeMap = updateShapes(prevShapeMap, shapeMap, group, labelGroup);
77
93
 
78
94
  const { animates, disableAnimate, x = 0, y = 0, z = 0 } = displayModel.data;
79
95
  if (firstRendering) {
@@ -81,6 +97,10 @@ export default class Node extends Item {
81
97
  group.style.x = x;
82
98
  group.style.y = y;
83
99
  group.style.z = z;
100
+ const viewportPosition = graph.getViewportByCanvas({ x, y, z });
101
+ labelGroup.style.x = viewportPosition.x;
102
+ labelGroup.style.y = viewportPosition.y;
103
+ labelGroup.style.z = viewportPosition.z;
84
104
  } else {
85
105
  // terminate previous animations
86
106
  this.stopAnimations();
@@ -105,13 +125,18 @@ export default class Node extends Item {
105
125
  animatesExcludePosition, // animates
106
126
  renderExt.mergedStyles, // targetStylesMap
107
127
  this.shapeMap, // shapeMap
108
- group,
128
+ undefined,
129
+ [group, labelGroup],
109
130
  firstRendering ? 'buildIn' : 'update',
110
131
  diffState?.current.map((state) => state.name) || this.changedStates,
111
132
  this.animateFrameListener,
112
133
  (canceled) => onfinish(model.id, canceled),
113
134
  );
114
135
  }
136
+ this.labelGroup.children
137
+ .filter((element) => element.attributes.dataIsLabel)
138
+ .forEach((shape) => (shape.attributes.dataOriginPosition = ''));
139
+ this.updateLabelPosition(true);
115
140
  }
116
141
 
117
142
  /**
@@ -127,7 +152,7 @@ export default class Node extends Item {
127
152
  animate?: boolean,
128
153
  onfinish: Function = () => {},
129
154
  ) {
130
- const { group } = this;
155
+ const { group, labelGroup, graph } = this;
131
156
  const {
132
157
  fx,
133
158
  fy,
@@ -149,6 +174,10 @@ export default class Node extends Item {
149
174
  isNaN(position.z as number)
150
175
  )
151
176
  return;
177
+ const viewportPosition = graph.getViewportByCanvas(position);
178
+ labelGroup.style.x = viewportPosition.x;
179
+ labelGroup.style.y = viewportPosition.y;
180
+ labelGroup.style.z = viewportPosition.z || 0;
152
181
  if (animate && !disableAnimate && animates?.update) {
153
182
  const groupAnimates = animates.update.filter(
154
183
  ({ shapeId, fields = [] }) =>
@@ -160,7 +189,8 @@ export default class Node extends Item {
160
189
  { update: groupAnimates },
161
190
  { group: position } as any, // targetStylesMap
162
191
  this.shapeMap, // shapeMap
163
- group,
192
+ undefined,
193
+ [group],
164
194
  'update',
165
195
  [],
166
196
  this.animateFrameListener,
@@ -175,12 +205,74 @@ export default class Node extends Item {
175
205
  group.style.z = position.z;
176
206
  onfinish(displayModel.id, !animate);
177
207
  }
208
+ /**
209
+ * Update label positions on label canvas by getting viewport position from transformed canvas position.
210
+ */
211
+ public updateLabelPosition(ignoreVisibility?: boolean) {
212
+ if (!ignoreVisibility && this.labelGroup.style.visibility === 'hidden') {
213
+ return;
214
+ }
215
+ const { graph, group, labelGroup, displayModel, shapeMap, renderExt } =
216
+ this;
217
+
218
+ let [x, y, z] = group.getPosition();
219
+ if (group.getAnimations().length) {
220
+ const { x: dataX, y: dataY, z: dataZ } = displayModel.data;
221
+ x = dataX as number;
222
+ y = dataY as number;
223
+ z = dataZ as number;
224
+ }
225
+ const zoom = graph.getZoom();
226
+ const { x: vx, y: vy, z: vz } = graph.getViewportByCanvas({ x, y, z });
227
+ if (labelGroup.style.x !== vx) {
228
+ labelGroup.style.x = vx;
229
+ }
230
+ if (labelGroup.style.y !== vy) {
231
+ labelGroup.style.y = vy;
232
+ }
233
+ if (labelGroup.style.z !== vz) {
234
+ labelGroup.style.z = vz;
235
+ }
236
+
237
+ labelGroup.children.forEach((shape) => {
238
+ if (shape.attributes.dataIsLabelBackground) {
239
+ renderExt.drawLabelBackgroundShape(displayModel, shapeMap);
240
+ return;
241
+ }
242
+ if (shape.attributes.dataIsLabel) {
243
+ // this.throttleUpdateWordWidth(zoom, shape);
244
+ const { wordWrapWidth } = shape.style;
245
+ if (wordWrapWidth) {
246
+ if (!shape.attributes.dataOriginWordWrapWidth) {
247
+ shape.style.dataOriginWordWrapWidth = wordWrapWidth;
248
+ }
249
+ const originWordWrapWidth = shape.attributes.dataOriginWordWrapWidth;
250
+ shape.style.wordWrapWidth = originWordWrapWidth * zoom;
251
+ }
252
+ }
253
+ if (!shape.attributes.dataOriginPosition) {
254
+ shape.attributes.dataOriginPosition = {
255
+ x: shape.style.x,
256
+ y: shape.style.y,
257
+ z: shape.style.z,
258
+ };
259
+ }
260
+ const originPosition = shape.attributes.dataOriginPosition;
261
+ Object.keys(originPosition).forEach((field) => {
262
+ if (!isNaN(shape.style[field])) {
263
+ shape.style[field] = originPosition[field] * zoom;
264
+ }
265
+ });
266
+ });
267
+ }
178
268
 
179
269
  public clone(
180
270
  containerGroup: Group,
271
+ labelContainerGroup: Group,
181
272
  shapeIds?: string[],
182
273
  disableAnimate?: boolean,
183
274
  ) {
275
+ // clone specific shapes but not the whole item
184
276
  if (shapeIds?.length) {
185
277
  const group = new Group();
186
278
  shapeIds.forEach((shapeId) => {
@@ -199,19 +291,24 @@ export default class Node extends Item {
199
291
  clonedModel.data.disableAnimate = disableAnimate;
200
292
  const clonedNode = new Node({
201
293
  model: clonedModel,
294
+ graph: this.graph,
202
295
  renderExtensions: this.renderExtensions,
203
296
  containerGroup,
297
+ labelContainerGroup,
204
298
  mapper: this.mapper,
205
299
  stateMapper: this.stateMapper,
206
300
  zoom: this.zoom,
207
301
  theme: {
208
302
  styles: this.themeStyles,
209
- lodStrategy: this.lodStrategy,
303
+ lodLevels: this.lodLevels,
210
304
  },
211
305
  });
212
306
  Object.keys(this.shapeMap).forEach((shapeId) => {
213
- if (!this.shapeMap[shapeId].isVisible())
307
+ if (!this.shapeMap[shapeId].isVisible()) {
214
308
  clonedNode.shapeMap[shapeId].hide();
309
+ } else {
310
+ clonedNode.shapeMap[shapeId]?.show();
311
+ }
215
312
  });
216
313
  return clonedNode;
217
314
  }