@antv/g6 5.0.0-alpha.3 → 5.0.0-alpha.5

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 (58) hide show
  1. package/dist/g6.min.js +9 -9
  2. package/esm/item/edge.js +6 -3
  3. package/esm/item/edge.js.map +1 -1
  4. package/esm/item/item.js +2 -9
  5. package/esm/item/item.js.map +1 -1
  6. package/esm/item/node.js +2 -2
  7. package/esm/item/node.js.map +1 -1
  8. package/esm/runtime/controller/item.js +9 -7
  9. package/esm/runtime/controller/item.js.map +1 -1
  10. package/esm/stdlib/behavior/drag-node.js +5 -1
  11. package/esm/stdlib/behavior/drag-node.js.map +1 -1
  12. package/esm/stdlib/behavior/hover-activate.js +0 -1
  13. package/esm/stdlib/behavior/hover-activate.js.map +1 -1
  14. package/esm/stdlib/behavior/zoom-canvas-3d.d.ts +8 -0
  15. package/esm/stdlib/behavior/zoom-canvas-3d.js +27 -3
  16. package/esm/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
  17. package/esm/stdlib/behavior/zoom-canvas.d.ts +8 -0
  18. package/esm/stdlib/behavior/zoom-canvas.js +8 -1
  19. package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
  20. package/esm/stdlib/item/node/base.js +1 -1
  21. package/esm/stdlib/item/node/base.js.map +1 -1
  22. package/esm/util/animate.d.ts +5 -0
  23. package/esm/util/animate.js +11 -5
  24. package/esm/util/animate.js.map +1 -1
  25. package/lib/item/edge.js +6 -3
  26. package/lib/item/edge.js.map +1 -1
  27. package/lib/item/item.js +1 -8
  28. package/lib/item/item.js.map +1 -1
  29. package/lib/item/node.js +2 -2
  30. package/lib/item/node.js.map +1 -1
  31. package/lib/runtime/controller/item.js +9 -7
  32. package/lib/runtime/controller/item.js.map +1 -1
  33. package/lib/stdlib/behavior/drag-node.js +5 -1
  34. package/lib/stdlib/behavior/drag-node.js.map +1 -1
  35. package/lib/stdlib/behavior/hover-activate.js +0 -1
  36. package/lib/stdlib/behavior/hover-activate.js.map +1 -1
  37. package/lib/stdlib/behavior/zoom-canvas-3d.d.ts +8 -0
  38. package/lib/stdlib/behavior/zoom-canvas-3d.js +27 -3
  39. package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
  40. package/lib/stdlib/behavior/zoom-canvas.d.ts +8 -0
  41. package/lib/stdlib/behavior/zoom-canvas.js +8 -1
  42. package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
  43. package/lib/stdlib/item/node/base.js +1 -1
  44. package/lib/stdlib/item/node/base.js.map +1 -1
  45. package/lib/util/animate.d.ts +5 -0
  46. package/lib/util/animate.js +13 -6
  47. package/lib/util/animate.js.map +1 -1
  48. package/package.json +1 -1
  49. package/src/item/edge.ts +4 -3
  50. package/src/item/item.ts +2 -7
  51. package/src/item/node.ts +2 -2
  52. package/src/runtime/controller/item.ts +11 -7
  53. package/src/stdlib/behavior/drag-node.ts +5 -1
  54. package/src/stdlib/behavior/hover-activate.ts +0 -2
  55. package/src/stdlib/behavior/zoom-canvas-3d.ts +45 -2
  56. package/src/stdlib/behavior/zoom-canvas.ts +15 -0
  57. package/src/stdlib/item/node/base.ts +1 -0
  58. package/src/util/animate.ts +12 -5
@@ -331,7 +331,7 @@ export const animateShapes = (
331
331
  let i = 0;
332
332
  const groupKeys = Object.keys(timingAnimateGroups);
333
333
  if (!groupKeys.length) return;
334
- let animations = [];
334
+ const animations = [];
335
335
  let canceled = false;
336
336
  const onfinish = () => {
337
337
  if (i >= groupKeys.length) {
@@ -350,11 +350,8 @@ export const animateShapes = (
350
350
  ).filter(Boolean);
351
351
  groupAnimations.forEach((animation) => {
352
352
  animation.onframe = onAnimatesFrame;
353
+ animations.push(animation);
353
354
  });
354
- if (i === 0) {
355
- // collect the first group animations
356
- animations = groupAnimations;
357
- }
358
355
  i++;
359
356
  };
360
357
  onfinish();
@@ -428,3 +425,13 @@ export const fadeOut = (id, shape, hiddenShape, animateConfig) => {
428
425
  const animation = shape.animate([{ opacity }, { opacity: 0 }], animateConfig);
429
426
  animation.onfinish = () => shape.hide();
430
427
  };
428
+
429
+ /**
430
+ * Make the animation to the end frame and clear it from the target shape.
431
+ * @param animation
432
+ */
433
+ export const stopAnimate = (animation) => {
434
+ const timing = animation.effect.getTiming();
435
+ animation.currentTime = Number(timing.duration) + Number(timing.delay || 0);
436
+ animation.cancel();
437
+ };