@antv/g6 5.0.0-alpha.4 → 5.0.0-alpha.6

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 (42) hide show
  1. package/dist/g6.min.js +9 -9
  2. package/esm/item/edge.js +2 -1
  3. package/esm/item/edge.js.map +1 -1
  4. package/esm/item/node.js +1 -2
  5. package/esm/item/node.js.map +1 -1
  6. package/esm/runtime/controller/item.js +14 -2
  7. package/esm/runtime/controller/item.js.map +1 -1
  8. package/esm/stdlib/behavior/zoom-canvas-3d.js +0 -4
  9. package/esm/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
  10. package/esm/stdlib/item/node/base.d.ts +1 -1
  11. package/esm/stdlib/item/node/base.js +95 -51
  12. package/esm/stdlib/item/node/base.js.map +1 -1
  13. package/esm/stdlib/theme/dark.js +26 -25
  14. package/esm/stdlib/theme/dark.js.map +1 -1
  15. package/esm/stdlib/theme/light.js +26 -25
  16. package/esm/stdlib/theme/light.js.map +1 -1
  17. package/esm/types/node.d.ts +1 -0
  18. package/lib/item/edge.js +2 -1
  19. package/lib/item/edge.js.map +1 -1
  20. package/lib/item/node.js +1 -2
  21. package/lib/item/node.js.map +1 -1
  22. package/lib/runtime/controller/item.js +14 -2
  23. package/lib/runtime/controller/item.js.map +1 -1
  24. package/lib/stdlib/behavior/zoom-canvas-3d.js +0 -4
  25. package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
  26. package/lib/stdlib/item/node/base.d.ts +1 -1
  27. package/lib/stdlib/item/node/base.js +95 -51
  28. package/lib/stdlib/item/node/base.js.map +1 -1
  29. package/lib/stdlib/theme/dark.js +26 -25
  30. package/lib/stdlib/theme/dark.js.map +1 -1
  31. package/lib/stdlib/theme/light.js +26 -25
  32. package/lib/stdlib/theme/light.js.map +1 -1
  33. package/lib/types/node.d.ts +1 -0
  34. package/package.json +1 -1
  35. package/src/item/edge.ts +1 -1
  36. package/src/item/node.ts +1 -2
  37. package/src/runtime/controller/item.ts +12 -3
  38. package/src/stdlib/behavior/zoom-canvas-3d.ts +0 -4
  39. package/src/stdlib/item/node/base.ts +119 -64
  40. package/src/stdlib/theme/dark.ts +26 -24
  41. package/src/stdlib/theme/light.ts +26 -24
  42. package/src/types/node.ts +1 -0
package/src/item/node.ts CHANGED
@@ -79,9 +79,8 @@ export default class Node extends Item {
79
79
  this.updatePosition(displayModel, diffData, onfinish);
80
80
  }
81
81
 
82
- const { haloShape, labelBackgroundShape } = this.shapeMap;
82
+ const { haloShape } = this.shapeMap;
83
83
  haloShape?.toBack();
84
- labelBackgroundShape?.toBack();
85
84
 
86
85
  super.draw(displayModel, diffData, diffState, onfinish);
87
86
  this.anchorPointsCache = undefined;
@@ -317,9 +317,18 @@ export class ItemController {
317
317
  );
318
318
  }
319
319
  const node = itemMap[id] as Node;
320
- const innerModel = graphCore.getNode(id);
321
-
322
- const relatedEdgeInnerModels = graphCore.getRelatedEdges(id);
320
+ let innerModel;
321
+ try {
322
+ innerModel = graphCore.getNode(id);
323
+ } catch (e) {
324
+ innerModel = graphCore.getNode(Number(id));
325
+ }
326
+ let relatedEdgeInnerModels;
327
+ try {
328
+ relatedEdgeInnerModels = graphCore.getRelatedEdges(id);
329
+ } catch (e) {
330
+ relatedEdgeInnerModels = graphCore.getRelatedEdges(Number(id));
331
+ }
323
332
  const nodeRelatedToUpdate = {};
324
333
  relatedEdgeInnerModels.forEach((edge) => {
325
334
  edgeToUpdate[edge.id] = edge;
@@ -90,10 +90,6 @@ export default class ZoomCanvas3D extends Behavior {
90
90
  },
91
91
  { passive: false },
92
92
  );
93
- // const { minZoom, maxZoom } = this.options;
94
- // const camera = this.graph.canvas.getCamera();
95
- // camera.setMinDistance(-minDistance);
96
- // camera.setMaxDistance(maxDistance);
97
93
 
98
94
  if (this.options.trigger === 'wheel') {
99
95
  return {
@@ -35,7 +35,7 @@ export abstract class BaseNode {
35
35
  lodStrategy?: lodStrategyObj;
36
36
  boundsCache: {
37
37
  keyShapeLocal?: AABB;
38
- labelShapeLocal?: AABB;
38
+ labelShapeGeometry?: AABB;
39
39
  };
40
40
  // cache the zoom level infomations
41
41
  protected zoomCache: {
@@ -140,10 +140,11 @@ export abstract class BaseNode {
140
140
  .forEach((id) => {
141
141
  const shape = shapeMap[id];
142
142
  if (shape?.getAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY)) {
143
- this.boundsCache[`${id}Local`] =
144
- id === 'labelShape'
145
- ? shape.getGeometryBounds()
146
- : shape.getLocalBounds();
143
+ if (id === 'labelShape') {
144
+ this.boundsCache[`${id}Geometry`] = shape.getGeometryBounds();
145
+ } else {
146
+ this.boundsCache[`${id}Local`] = shape.getLocalBounds();
147
+ }
147
148
  shape.setAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY, false);
148
149
  }
149
150
  });
@@ -243,28 +244,29 @@ export abstract class BaseNode {
243
244
  switch (position) {
244
245
  case 'center':
245
246
  positionPreset.y = keyShapeBox.center[1];
247
+ positionPreset.textBaseline = 'middle';
246
248
  break;
247
249
  case 'top':
248
250
  positionPreset.y = keyShapeBox.min[1];
249
251
  positionPreset.textBaseline = 'bottom';
250
- positionPreset.offsetY = -4;
252
+ positionPreset.offsetY = -2;
251
253
  break;
252
254
  case 'left':
253
255
  positionPreset.x = keyShapeBox.min[0];
254
256
  positionPreset.y = keyShapeBox.center[1];
255
257
  positionPreset.textAlign = 'right';
256
258
  positionPreset.textBaseline = 'middle';
257
- positionPreset.offsetX = -8;
259
+ positionPreset.offsetX = -4;
258
260
  break;
259
261
  case 'right':
260
262
  positionPreset.x = keyShapeBox.max[0];
261
263
  positionPreset.y = keyShapeBox.center[1];
262
264
  positionPreset.textAlign = 'left';
263
265
  positionPreset.textBaseline = 'middle';
264
- positionPreset.offsetX = 8;
266
+ positionPreset.offsetX = 4;
265
267
  break;
266
268
  default: // at bottom by default
267
- positionPreset.offsetY = 4;
269
+ positionPreset.offsetY = 2;
268
270
  break;
269
271
  }
270
272
  const offsetX = (
@@ -297,34 +299,28 @@ export abstract class BaseNode {
297
299
  const { labelShape } = shapeMap;
298
300
  if (!labelShape || !model.data.labelShape) return;
299
301
  if (
300
- !this.boundsCache.labelShapeLocal ||
302
+ !this.boundsCache.labelShapeGeometry ||
301
303
  labelShape.getAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY)
302
304
  ) {
303
- this.boundsCache.labelShapeLocal = labelShape.getGeometryBounds();
305
+ this.boundsCache.labelShapeGeometry = labelShape.getGeometryBounds();
304
306
  labelShape.setAttribute(LOCAL_BOUNDS_DIRTY_FLAG_KEY, false);
305
307
  }
306
308
  // label's local bounds, will take scale into acount
307
- const { labelShapeLocal: textBBox } = this.boundsCache;
308
- const labelWidth = Math.min(
309
- textBBox.max[0] - textBBox.min[0],
309
+ const { labelShapeGeometry: textBBoxGeo } = this.boundsCache;
310
+ const height = textBBoxGeo.max[1] - textBBoxGeo.min[1];
311
+ const width = Math.min(
312
+ textBBoxGeo.max[0] - textBBoxGeo.min[0] + 2,
310
313
  labelShape.attributes.wordWrapWidth,
311
314
  );
312
- const height = textBBox.max[1] - textBBox.min[1];
313
- const labelAspectRatio = labelWidth / (textBBox.max[1] - textBBox.min[1]);
314
- const width = labelAspectRatio * height;
315
315
 
316
316
  const { padding, ...backgroundStyle } =
317
317
  this.mergedStyles.labelBackgroundShape;
318
- const y =
319
- labelShape.attributes.y -
320
- (labelShape.attributes.textBaseline === 'top'
321
- ? padding[0]
322
- : height / 2 + padding[0]);
318
+
323
319
  const bgStyle: any = {
324
320
  fill: '#fff',
325
321
  ...backgroundStyle,
326
- x: textBBox.center[0] - width / 2 - padding[3],
327
- y,
322
+ x: labelShape.attributes.x + textBBoxGeo.min[0] - padding[3],
323
+ y: labelShape.attributes.y + textBBoxGeo.min[1] - padding[0],
328
324
  width: width + padding[1] + padding[3],
329
325
  height: height + padding[0] + padding[2],
330
326
  };
@@ -395,6 +391,7 @@ export abstract class BaseNode {
395
391
  ...attributes,
396
392
  stroke: attributes.fill,
397
393
  ...haloShapeStyle,
394
+ batchKey: 'halo',
398
395
  },
399
396
  shapeMap,
400
397
  model,
@@ -464,20 +461,26 @@ export abstract class BaseNode {
464
461
  keyShapeStyle,
465
462
  this.boundsCache.keyShapeLocal,
466
463
  );
467
- const keyShapeWidth = keyShapeBBox.max[0] - keyShapeBBox.min[0];
464
+ const keyShapeSize = Math.min(
465
+ keyShapeBBox.max[0] - keyShapeBBox.min[0],
466
+ keyShapeBBox.max[1] - keyShapeBBox.min[1],
467
+ );
468
468
  const shapes = {};
469
- individualConfigs.forEach((config) => {
469
+ individualConfigs.forEach((config, i) => {
470
470
  const { position, ...individualStyle } = config;
471
471
  const id = `${position}BadgeShape`;
472
472
  const style = {
473
473
  ...commonStyle,
474
474
  ...individualStyle,
475
475
  };
476
+ const colorFromPalette = commonStyle.palette
477
+ ? commonStyle.palette[i % commonStyle.palette.length]
478
+ : '#7E92B5';
476
479
  const {
477
480
  text = '',
478
481
  type,
479
- color,
480
- size = keyShapeWidth / 3,
482
+ color = colorFromPalette,
483
+ size = keyShapeSize / 3,
481
484
  textColor,
482
485
  zIndex = 2,
483
486
  offsetX = 0,
@@ -490,55 +493,67 @@ export abstract class BaseNode {
490
493
  const pos = { x: 0, y: 0 };
491
494
  switch (position) {
492
495
  case 'rightTop':
493
- pos.x = keyShapeBBox.max[0] - bgHeight / 2 + offsetX;
494
- pos.y = keyShapeBBox.min[1] + size / 4 + offsetY;
496
+ case 'topRight':
497
+ pos.x = keyShapeBBox.max[0] / 2 + offsetX;
498
+ pos.y = keyShapeBBox.min[1] * 0.44 - bgHeight + offsetY;
495
499
  break;
496
500
  case 'right':
497
- pos.x = keyShapeBBox.max[0] - bgHeight / 2 + offsetX;
498
- pos.y = offsetY;
501
+ pos.x = keyShapeBBox.max[0] / 2 + offsetX;
502
+ pos.y = -bgHeight / 2 + offsetY;
499
503
  break;
500
504
  case 'rightBottom':
501
505
  case 'bottomRight':
502
- pos.x = keyShapeBBox.max[0] - bgHeight / 2 + offsetX;
503
- pos.y = keyShapeBBox.max[1] - size / 4 + offsetY;
506
+ pos.x = keyShapeBBox.max[0] / 2 + offsetX;
507
+ pos.y = keyShapeBBox.max[1] * 0.44 + offsetY;
504
508
  break;
505
509
  case 'leftTop':
506
510
  case 'topLeft':
507
- pos.x = keyShapeBBox.min[0] + bgHeight / 2 + offsetX;
508
- pos.y = keyShapeBBox.min[1] + size / 4 + offsetY;
511
+ pos.x = keyShapeBBox.min[0] / 2 + offsetX;
512
+ pos.y = keyShapeBBox.min[1] * 0.44 - bgHeight + offsetY;
509
513
  break;
510
514
  case 'left':
511
- pos.x = keyShapeBBox.min[0] + bgHeight / 2 + offsetX;
512
- pos.y = offsetY;
515
+ pos.x = keyShapeBBox.min[0] / 2 + offsetX;
516
+ pos.y = -bgHeight / 2 + offsetY;
513
517
  break;
514
518
  case 'leftBottom':
515
519
  case 'bottomLeft':
516
- pos.x = keyShapeBBox.min[0] + bgHeight / 2 + offsetX;
517
- pos.y = keyShapeBBox.max[1] - size / 4 + offsetY;
520
+ pos.x = keyShapeBBox.min[0] / 2 + offsetX;
521
+ pos.y = keyShapeBBox.max[1] * 0.44 + offsetY;
518
522
  break;
519
523
  case 'top':
520
524
  pos.x = offsetX;
521
- pos.y = keyShapeBBox.min[1] + size / 4;
525
+ pos.y = keyShapeBBox.min[1] * 0.44 - bgHeight + offsetY;
522
526
  break;
523
527
  default:
524
528
  // bottom
525
529
  pos.x = offsetX;
526
- pos.y = keyShapeBBox.max[1] - size / 4;
530
+ pos.y = keyShapeBBox.max[1] * 0.44 + offsetY;
527
531
  break;
528
532
  }
529
533
 
534
+ const positionLowerCase = position.toLowerCase();
535
+ const isLeft = positionLowerCase.includes('left');
536
+ const isCenter = !isLeft && !positionLowerCase.includes('right');
537
+
530
538
  // a radius rect (as container) + a text / icon
539
+ const fontSize = bgHeight - 3;
540
+ let textAlign = isLeft ? 'right' : 'left';
541
+ let textX = isLeft ? pos.x - 3 : pos.x + 2;
542
+ if (isCenter) {
543
+ textAlign = 'center';
544
+ textX = pos.x;
545
+ }
531
546
  shapes[id] = this.upsertShape(
532
547
  'text',
533
548
  id,
534
549
  {
535
550
  text,
536
551
  fill: textColor,
537
- fontSize: bgHeight - 3,
538
- x: pos.x,
539
- y: pos.y,
552
+ fontSize,
553
+ x: textX,
554
+ y: pos.y + bgHeight / 2,
540
555
  ...otherStyles,
541
- textAlign: position.includes('right') ? 'left' : 'right',
556
+ textAlign,
542
557
  textBaseline: 'middle',
543
558
  zIndex: (zIndex as number) + 1,
544
559
  } as GShapeStyle,
@@ -553,6 +568,8 @@ export abstract class BaseNode {
553
568
  (text as string).length <= 1
554
569
  ? bgHeight
555
570
  : Math.max(bgHeight, bbox.max[0] - bbox.min[0]) + 8;
571
+ let bgX = isLeft ? pos.x - bgWidth : pos.x;
572
+ if (isCenter) bgX = pos.x - bgWidth / 2;
556
573
  shapes[bgShapeId] = this.upsertShape(
557
574
  'rect',
558
575
  bgShapeId,
@@ -561,10 +578,10 @@ export abstract class BaseNode {
561
578
  fill: color,
562
579
  height: bgHeight,
563
580
  width: bgWidth,
564
- x: bbox.min[0] - 3, // begin at the border, minus half height
565
- y: bbox.min[1],
566
581
  radius: bgHeight / 2,
567
582
  zIndex,
583
+ x: bgX,
584
+ y: pos.y,
568
585
  ...otherStyles,
569
586
  } as GShapeStyle,
570
587
  shapeMap,
@@ -661,8 +678,39 @@ export abstract class BaseNode {
661
678
  const { position = 'bottom' } = labelStyle;
662
679
  if (!labelShape || !labelShape.isVisible()) return;
663
680
 
664
- if (position === 'bottom') labelShape.style.transformOrigin = '0';
665
- else labelShape.style.transformOrigin = '';
681
+ const keyShapeLocal = this.boundsCache.keyShapeLocal;
682
+ if (zoom < 1) {
683
+ // if it is zoom-out, do not scale the gap between keyShape and labelShape, differentiate from zoom-in by adjusting transformOrigin
684
+ if (position === 'bottom') labelShape.style.transformOrigin = '0';
685
+ else labelShape.style.transformOrigin = '';
686
+ } else {
687
+ switch (position) {
688
+ case 'bottom':
689
+ labelShape.style.transformOrigin = `0 ${
690
+ keyShapeLocal.max[1] - labelShape.attributes.y
691
+ }`;
692
+ break;
693
+ case 'right':
694
+ labelShape.style.transformOrigin = `${
695
+ keyShapeLocal.max[0] - labelShape.attributes.x
696
+ } 0`;
697
+ break;
698
+ case 'top':
699
+ labelShape.style.transformOrigin = `0 ${
700
+ keyShapeLocal.min[1] - labelShape.attributes.y
701
+ }`;
702
+ break;
703
+ case 'left':
704
+ labelShape.style.transformOrigin = `${
705
+ keyShapeLocal.min[0] - labelShape.attributes.x
706
+ } 0`;
707
+ break;
708
+ default:
709
+ // center
710
+ labelShape.style.transformOrigin = ``;
711
+ break;
712
+ }
713
+ }
666
714
  labelShape.style.transform = `scale(${balanceRatio}, ${balanceRatio})`;
667
715
  const wordWrapWidth = this.zoomCache.wordWrapWidth * zoom;
668
716
  labelShape.style.wordWrapWidth = wordWrapWidth;
@@ -670,40 +718,47 @@ export abstract class BaseNode {
670
718
  if (!labelBackgroundShape || !labelBackgroundShape.isVisible()) return;
671
719
 
672
720
  const { padding } = this.mergedStyles.labelBackgroundShape;
673
- const { width, height } = labelBackgroundShape.attributes;
721
+ const { width, height, x, y } = labelBackgroundShape.attributes;
674
722
  const [paddingTop, paddingRight, paddingBottom, paddingLeft] =
675
723
  padding as number[];
676
724
 
677
725
  switch (position) {
678
726
  case 'top':
727
+ // if it is zoom-out, do not scale the gap between keyShape and labelShape, differentiate from zoom-in by adjusting transformOrigin
679
728
  labelBackgroundShape.style.transformOrigin = `${
680
729
  paddingLeft + (width - paddingLeft - paddingRight) / 2
681
- } ${height - paddingBottom}`;
730
+ } ${zoom < 1 ? height - paddingBottom : keyShapeLocal.min[1] - y}`;
682
731
  break;
683
732
  case 'left':
684
- labelBackgroundShape.style.transformOrigin = `${width - paddingRight} ${
685
- paddingTop + (height - paddingTop - paddingBottom) / 2
686
- }`;
733
+ labelBackgroundShape.style.transformOrigin = `${
734
+ zoom < 1 ? width - paddingRight : keyShapeLocal.min[0] - x
735
+ } ${paddingTop + (height - paddingTop - paddingBottom) / 2}`;
687
736
  break;
688
737
  case 'right':
689
- labelBackgroundShape.style.transformOrigin = `${paddingLeft} ${
690
- paddingTop + (height - paddingTop - paddingBottom) / 2
691
- }`;
738
+ labelBackgroundShape.style.transformOrigin = `${
739
+ zoom < 1 ? paddingLeft : keyShapeLocal.max[0] - x
740
+ } ${paddingTop + (height - paddingTop - paddingBottom) / 2}`;
692
741
  break;
693
742
  case 'bottom':
743
+ labelBackgroundShape.style.transformOrigin = `${
744
+ paddingLeft + (width - paddingLeft - paddingRight) / 2
745
+ } ${
746
+ zoom < 1
747
+ ? paddingTop + (height - paddingTop - paddingBottom) / 2
748
+ : keyShapeLocal.max[1] - y
749
+ }`;
750
+ break;
694
751
  default:
752
+ // center
695
753
  labelBackgroundShape.style.transformOrigin = `${
696
754
  paddingLeft + (width - paddingLeft - paddingRight) / 2
697
755
  } ${paddingTop + (height - paddingTop - paddingBottom) / 2}`;
698
756
  }
699
757
 
700
- const labelBBox = labelShape.getGeometryBounds();
701
- const labelWidth = Math.min(
702
- labelBBox.max[0] - labelBBox.min[0],
703
- this.zoomCache.wordWrapWidth,
704
- );
758
+ const labelBBox = labelShape.getLocalBounds();
759
+ const labelWidth = labelBBox.max[0] - labelBBox.min[0];
705
760
  const xAxistRatio =
706
- ((labelWidth + paddingLeft + paddingRight) * balanceRatio) / width;
761
+ (labelWidth + (paddingLeft + paddingRight) * balanceRatio) / width;
707
762
 
708
763
  labelBackgroundShape.style.transform = `scale(${xAxistRatio}, ${balanceRatio})`;
709
764
  }
@@ -16,16 +16,16 @@ const nodeStroke = '#D0E4FF';
16
16
  export default {
17
17
  node: {
18
18
  palette: [
19
- '#227EFF',
20
- '#AD5CFF',
21
- '#00B8B8',
22
- '#FA822D',
23
- '#F252AF',
24
- '#1EB8F5',
25
- '#108A44',
26
- '#F4B106',
27
- '#5241A8',
28
- '#95CF21',
19
+ '#4089FF',
20
+ '#CD75FF',
21
+ '#06B8A8',
22
+ '#FF8834',
23
+ '#5888C3',
24
+ '#FA73CD',
25
+ '#07BCE0',
26
+ '#CB962A',
27
+ '#23AD61',
28
+ '#FF8075',
29
29
  ],
30
30
  lodStrategy: {
31
31
  levels: [
@@ -66,7 +66,7 @@ export default {
66
66
  lineWidth: 0,
67
67
  fill: '#000',
68
68
  opacity: 0.75,
69
- zIndex: -1,
69
+ zIndex: 1,
70
70
  lod: 0,
71
71
  },
72
72
  iconShape: {
@@ -85,7 +85,7 @@ export default {
85
85
  lod: 0,
86
86
  },
87
87
  badgeShapes: {
88
- color: 'rgb(140, 140, 140)',
88
+ palette: ['#7E92B5', '#F86254', '#EDB74B'],
89
89
  textColor: '#fff',
90
90
  zIndex: 3,
91
91
  lod: -1,
@@ -160,16 +160,17 @@ export default {
160
160
  },
161
161
  edge: {
162
162
  palette: [
163
- '#63A4FF',
164
- '#CD9CFF',
165
- '#2DEFEF',
166
- '#FFBDA1',
167
- '#F49FD0',
168
- '#80DBFF',
169
- '#41CB7C',
170
- '#FFD362',
171
- '#A192E8',
172
- '#CEFB75',
163
+ '#637088',
164
+ '#2A59A6',
165
+ '#854CA6',
166
+ '#04786D',
167
+ '#A65822',
168
+ '#39587F',
169
+ '#A34B85',
170
+ '#057A92',
171
+ '#84621B',
172
+ '#17703F',
173
+ '#A6534C',
173
174
  ],
174
175
  lodStrategy: {
175
176
  levels: [
@@ -191,6 +192,7 @@ export default {
191
192
  lineWidth: 1,
192
193
  stroke: edgeMainStroke,
193
194
  increasedLineWidthForHitTesting: 2,
195
+ zIndex: 1,
194
196
  },
195
197
  labelShape: {
196
198
  ...DEFAULT_TEXT_STYLE,
@@ -198,7 +200,7 @@ export default {
198
200
  opacity: 0.85,
199
201
  position: 'middle',
200
202
  textBaseline: 'middle',
201
- zIndex: 2,
203
+ zIndex: 3,
202
204
  textOverflow: 'ellipsis',
203
205
  wordWrap: true,
204
206
  maxLines: 1,
@@ -210,7 +212,7 @@ export default {
210
212
  lineWidth: 0,
211
213
  fill: '#000',
212
214
  opacity: 0.75,
213
- zIndex: 1,
215
+ zIndex: 2,
214
216
  lod: 0,
215
217
  },
216
218
  iconShape: {
@@ -18,16 +18,16 @@ const nodeStroke = 'rgba(0,0,0,0.85)';
18
18
  export default {
19
19
  node: {
20
20
  palette: [
21
- '#227EFF',
22
- '#AD5CFF',
23
- '#00B8B8',
24
- '#FA822D',
25
- '#F252AF',
26
- '#1EB8F5',
27
- '#108A44',
28
- '#F4B106',
29
- '#5241A8',
30
- '#95CF21',
21
+ '#4089FF',
22
+ '#CD75FF',
23
+ '#06B8A8',
24
+ '#FF8834',
25
+ '#5888C3',
26
+ '#FA73CD',
27
+ '#07BCE0',
28
+ '#CB962A',
29
+ '#23AD61',
30
+ '#FF8075',
31
31
  ],
32
32
  lodStrategy: {
33
33
  levels: [
@@ -67,7 +67,7 @@ export default {
67
67
  lineWidth: 0,
68
68
  fill: '#fff',
69
69
  opacity: 0.75,
70
- zIndex: -1,
70
+ zIndex: 1,
71
71
  lod: 0,
72
72
  },
73
73
  iconShape: {
@@ -85,7 +85,7 @@ export default {
85
85
  lod: 0,
86
86
  },
87
87
  badgeShapes: {
88
- color: 'rgb(140, 140, 140)',
88
+ palette: ['#7E92B5', '#F86254', '#EDB74B'],
89
89
  textColor: '#fff',
90
90
  zIndex: 3,
91
91
  lod: -1,
@@ -160,16 +160,17 @@ export default {
160
160
  },
161
161
  edge: {
162
162
  palette: [
163
- '#63A4FF',
164
- '#CD9CFF',
165
- '#2DEFEF',
166
- '#FFBDA1',
167
- '#F49FD0',
168
- '#80DBFF',
169
- '#41CB7C',
170
- '#FFD362',
171
- '#A192E8',
172
- '#CEFB75',
163
+ '#99ADD1',
164
+ '#4089FF',
165
+ '#CD75FF',
166
+ '#06B8A8',
167
+ '#FF8834',
168
+ '#5888C3',
169
+ '#FA73CD',
170
+ '#07BCE0',
171
+ '#CB962A',
172
+ '#23AD61',
173
+ '#FF8075',
173
174
  ],
174
175
  lodStrategy: {
175
176
  levels: [
@@ -191,13 +192,14 @@ export default {
191
192
  lineWidth: 1,
192
193
  stroke: edgeMainStroke,
193
194
  increasedLineWidthForHitTesting: 2,
195
+ zIndex: 1,
194
196
  },
195
197
  labelShape: {
196
198
  ...DEFAULT_TEXT_STYLE,
197
199
  fill: textColor,
198
200
  position: 'middle',
199
201
  textBaseline: 'middle',
200
- zIndex: 2,
202
+ zIndex: 3,
201
203
  textOverflow: 'ellipsis',
202
204
  wordWrap: true,
203
205
  maxLines: 1,
@@ -209,7 +211,7 @@ export default {
209
211
  lineWidth: 0,
210
212
  fill: '#fff',
211
213
  opacity: 0.75,
212
- zIndex: 1,
214
+ zIndex: 2,
213
215
  lod: 0,
214
216
  },
215
217
  iconShape: {
package/src/types/node.ts CHANGED
@@ -89,6 +89,7 @@ export interface NodeShapeStyles extends ItemShapeStyles {
89
89
  badgeShapes?: ShapeStyle & {
90
90
  // common badge styles
91
91
  color?: string;
92
+ palette?: string[];
92
93
  textColor?: string;
93
94
  // individual styles and their position
94
95
  [key: number]: ShapeStyle & {