@tsparticles/interaction-particles-attract 3.0.0-beta.3 → 3.0.0-beta.4

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import { ParticlesInteractorBase, getDistances } from "@tsparticles/engine";
1
+ import { ParticlesInteractorBase, getDistances, getRangeValue, } from "@tsparticles/engine";
2
2
  export class Attractor extends ParticlesInteractorBase {
3
3
  constructor(container) {
4
4
  super(container);
@@ -8,7 +8,11 @@ export class Attractor extends ParticlesInteractorBase {
8
8
  init() {
9
9
  }
10
10
  async interact(p1) {
11
- const container = this.container, distance = p1.retina.attractDistance ?? container.retina.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
11
+ const container = this.container;
12
+ if (p1.attractDistance === undefined) {
13
+ p1.attractDistance = getRangeValue(p1.options.move.attract.distance) * container.retina.pixelRatio;
14
+ }
15
+ const distance = p1.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
12
16
  for (const p2 of query) {
13
17
  if (p1 === p2 || !p2.options.move.attract.enable || p2.destroyed || p2.spawning) {
14
18
  continue;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/cjs/Attractor.js CHANGED
@@ -11,7 +11,11 @@ class Attractor extends engine_1.ParticlesInteractorBase {
11
11
  init() {
12
12
  }
13
13
  async interact(p1) {
14
- const container = this.container, distance = p1.retina.attractDistance ?? container.retina.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
14
+ const container = this.container;
15
+ if (p1.attractDistance === undefined) {
16
+ p1.attractDistance = (0, engine_1.getRangeValue)(p1.options.move.attract.distance) * container.retina.pixelRatio;
17
+ }
18
+ const distance = p1.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
15
19
  for (const p2 of query) {
16
20
  if (p1 === p2 || !p2.options.move.attract.enable || p2.destroyed || p2.spawning) {
17
21
  continue;
@@ -0,0 +1 @@
1
+ export {};
package/esm/Attractor.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ParticlesInteractorBase, getDistances } from "@tsparticles/engine";
1
+ import { ParticlesInteractorBase, getDistances, getRangeValue, } from "@tsparticles/engine";
2
2
  export class Attractor extends ParticlesInteractorBase {
3
3
  constructor(container) {
4
4
  super(container);
@@ -8,7 +8,11 @@ export class Attractor extends ParticlesInteractorBase {
8
8
  init() {
9
9
  }
10
10
  async interact(p1) {
11
- const container = this.container, distance = p1.retina.attractDistance ?? container.retina.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
11
+ const container = this.container;
12
+ if (p1.attractDistance === undefined) {
13
+ p1.attractDistance = getRangeValue(p1.options.move.attract.distance) * container.retina.pixelRatio;
14
+ }
15
+ const distance = p1.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
12
16
  for (const p2 of query) {
13
17
  if (p1 === p2 || !p2.options.move.attract.enable || p2.destroyed || p2.spawning) {
14
18
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/interaction-particles-attract",
3
- "version": "3.0.0-beta.3",
3
+ "version": "3.0.0-beta.4",
4
4
  "description": "tsParticles attract particles interaction",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -60,7 +60,7 @@
60
60
  "confettijs",
61
61
  "fireworksjs",
62
62
  "canvas-confetti",
63
- "@tsparticles/plugin",
63
+ "tsparticles-plugin",
64
64
  "@tsparticles/interaction"
65
65
  ],
66
66
  "author": "Matteo Bruni <matteo.bruni@me.com>",
@@ -87,7 +87,7 @@
87
87
  "./package.json": "./package.json"
88
88
  },
89
89
  "dependencies": {
90
- "@tsparticles/engine": "^3.0.0-beta.3"
90
+ "@tsparticles/engine": "^3.0.0-beta.4"
91
91
  },
92
92
  "publishConfig": {
93
93
  "access": "public"