Skip to content

Commit

Permalink
fix: links won't link non-existing particles
Browse files Browse the repository at this point in the history
  • Loading branch information
matteobruni committed Nov 3, 2020
1 parent b886cd6 commit 078c7f9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions core/main/src/Core/Particle/Mover.ts
Expand Up @@ -8,16 +8,15 @@ import type { IDelta } from "../Interfaces/IDelta";
* @category Core
*/
export class Mover {
constructor(private readonly container: Container, private readonly particle: Particle) {
}
constructor(private readonly container: Container, private readonly particle: Particle) {}

public move(delta: IDelta): void {
const particle = this.particle;

particle.bubble.inRange = false;
particle.links = [];

for (const [ , plugin ] of this.container.plugins) {
for (const [, plugin] of this.container.plugins) {
if (particle.destroyed) {
break;
}
Expand Down
2 changes: 1 addition & 1 deletion core/main/src/Core/Retina.ts
Expand Up @@ -61,7 +61,7 @@ export class Retina {

if (mediaQuery.addEventListener !== undefined) {
mediaQuery.addEventListener("change", handleChange);
} else {
} else if (mediaQuery.addListener !== undefined) {
mediaQuery.addListener(handleChange);
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/main/src/Interactions/Particles/Linker.ts
Expand Up @@ -33,7 +33,7 @@ export class Linker implements IParticlesInteractor {
for (const p2 of query) {
const linkOpt2 = p2.particlesOptions.links;

if (p1 === p2 || !linkOpt2.enable || linkOpt1.id !== linkOpt2.id) {
if (p1 === p2 || !linkOpt2.enable || linkOpt1.id !== linkOpt2.id || p2.spawning || p2.destroyed) {
continue;
}

Expand Down

0 comments on commit 078c7f9

Please sign in to comment.