tsparticles 1.37.1 → 1.37.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 (51) hide show
  1. package/Core/Container.d.ts +1 -0
  2. package/Core/Container.js +2 -0
  3. package/Plugins/Absorbers/AbsorberInstance.d.ts +2 -1
  4. package/Plugins/Absorbers/AbsorberInstance.js +21 -9
  5. package/Plugins/Absorbers/Options/Classes/AbsorberSize.d.ts +2 -1
  6. package/Plugins/Absorbers/Options/Classes/AbsorberSize.js +6 -4
  7. package/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.d.ts +9 -0
  8. package/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.js +21 -0
  9. package/Plugins/Absorbers/Options/Interfaces/IAbsorberSize.d.ts +3 -2
  10. package/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.d.ts +4 -0
  11. package/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.js +2 -0
  12. package/Utils/EventListeners.d.ts +1 -0
  13. package/Utils/EventListeners.js +13 -2
  14. package/Utils/Utils.js +4 -7
  15. package/browser/Core/Container.d.ts +1 -0
  16. package/browser/Core/Container.js +2 -0
  17. package/browser/Plugins/Absorbers/AbsorberInstance.d.ts +2 -1
  18. package/browser/Plugins/Absorbers/AbsorberInstance.js +21 -9
  19. package/browser/Plugins/Absorbers/Options/Classes/AbsorberSize.d.ts +2 -1
  20. package/browser/Plugins/Absorbers/Options/Classes/AbsorberSize.js +6 -4
  21. package/browser/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.d.ts +9 -0
  22. package/browser/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.js +17 -0
  23. package/browser/Plugins/Absorbers/Options/Interfaces/IAbsorberSize.d.ts +3 -2
  24. package/browser/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.d.ts +4 -0
  25. package/browser/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.js +1 -0
  26. package/browser/Plugins/PolygonMask/plugin.js +3 -1
  27. package/browser/Utils/EventListeners.d.ts +1 -0
  28. package/browser/Utils/EventListeners.js +14 -3
  29. package/browser/Utils/Utils.js +5 -8
  30. package/esm/Core/Container.d.ts +1 -0
  31. package/esm/Core/Container.js +2 -0
  32. package/esm/Plugins/Absorbers/AbsorberInstance.d.ts +2 -1
  33. package/esm/Plugins/Absorbers/AbsorberInstance.js +21 -9
  34. package/esm/Plugins/Absorbers/Options/Classes/AbsorberSize.d.ts +2 -1
  35. package/esm/Plugins/Absorbers/Options/Classes/AbsorberSize.js +6 -4
  36. package/esm/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.d.ts +9 -0
  37. package/esm/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.js +17 -0
  38. package/esm/Plugins/Absorbers/Options/Interfaces/IAbsorberSize.d.ts +3 -2
  39. package/esm/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.d.ts +4 -0
  40. package/esm/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.js +1 -0
  41. package/esm/Utils/EventListeners.d.ts +1 -0
  42. package/esm/Utils/EventListeners.js +14 -3
  43. package/esm/Utils/Utils.js +5 -8
  44. package/package.json +1 -1
  45. package/report.html +2 -2
  46. package/report.slim.html +2 -2
  47. package/tsparticles.js +326 -30
  48. package/tsparticles.min.js +2 -2
  49. package/tsparticles.pathseg.js +1472 -0
  50. package/tsparticles.slim.js +18 -10
  51. package/tsparticles.slim.min.js +2 -2
@@ -3,7 +3,7 @@
3
3
  var a = factory();
4
4
  for (var i in a) (typeof exports === "object" ? exports : root)[i] = a[i];
5
5
  }
6
- })(this, (function() {
6
+ })(window, (function() {
7
7
  return function() {
8
8
  "use strict";
9
9
  var __webpack_require__ = {};
@@ -939,14 +939,11 @@
939
939
  };
940
940
  }
941
941
  function circleBounce(p1, p2) {
942
- const xVelocityDiff = p1.velocity.x;
943
- const yVelocityDiff = p1.velocity.y;
944
- const pos1 = p1.position;
945
- const pos2 = p2.position;
946
- const xDist = pos2.x - pos1.x;
947
- const yDist = pos2.y - pos1.y;
942
+ const {x: xVelocityDiff, y: yVelocityDiff} = p1.velocity.sub(p2.velocity);
943
+ const [pos1, pos2] = [ p1.position, p2.position ];
944
+ const {dx: xDist, dy: yDist} = getDistances(pos2, pos1);
948
945
  if (xVelocityDiff * xDist + yVelocityDiff * yDist >= 0) {
949
- const angle = -Math.atan2(pos2.y - pos1.y, pos2.x - pos1.x);
946
+ const angle = -Math.atan2(yDist, xDist);
950
947
  const m1 = p1.mass;
951
948
  const m2 = p2.mass;
952
949
  const u1 = p1.velocity.rotate(angle);
@@ -1880,6 +1877,7 @@
1880
1877
  this.mouseDownHandler = () => this.mouseDown();
1881
1878
  this.visibilityChangeHandler = () => this.handleVisibilityChange();
1882
1879
  this.themeChangeHandler = e => this.handleThemeChange(e);
1880
+ this.oldThemeChangeHandler = e => this.handleThemeChange(e);
1883
1881
  this.resizeHandler = () => this.handleWindowResize();
1884
1882
  }
1885
1883
  addListeners() {
@@ -1903,9 +1901,17 @@
1903
1901
  } else {
1904
1902
  container.interactivity.element = container.canvas.element;
1905
1903
  }
1906
- const mediaMatch = typeof matchMedia !== "undefined" && matchMedia("(prefers-color-scheme: dark)");
1904
+ const mediaMatch = !isSsr() && typeof matchMedia !== "undefined" && matchMedia("(prefers-color-scheme: dark)");
1907
1905
  if (mediaMatch) {
1908
- manageListener(mediaMatch, "change", this.themeChangeHandler, add);
1906
+ if (mediaMatch.addEventListener !== undefined) {
1907
+ manageListener(mediaMatch, "change", this.themeChangeHandler, add);
1908
+ } else if (mediaMatch.addListener !== undefined) {
1909
+ if (add) {
1910
+ mediaMatch.addListener(this.oldThemeChangeHandler);
1911
+ } else {
1912
+ mediaMatch.removeListener(this.oldThemeChangeHandler);
1913
+ }
1914
+ }
1909
1915
  }
1910
1916
  const interactivityEl = container.interactivity.element;
1911
1917
  if (!interactivityEl) {
@@ -6308,6 +6314,7 @@
6308
6314
  this.zLayers = 100;
6309
6315
  this.pageHidden = false;
6310
6316
  this._sourceOptions = sourceOptions;
6317
+ this._initialSourceOptions = sourceOptions;
6311
6318
  this.retina = new Retina(this);
6312
6319
  this.canvas = new Canvas(this);
6313
6320
  this.particles = new Particles(this);
@@ -6607,6 +6614,7 @@
6607
6614
  this.drawers.set(type, drawer);
6608
6615
  }
6609
6616
  }
6617
+ this._options.load(this._initialSourceOptions);
6610
6618
  this._options.load(this._sourceOptions);
6611
6619
  this.actualOptions = new Options;
6612
6620
  this.actualOptions.load(this._options);