@newkrok/three-particles 2.7.1 → 2.8.1

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.
package/dist/index.js CHANGED
@@ -849,6 +849,7 @@ var destroyParticleSystem = (particleSystem) => {
849
849
  else savedParticleSystem.material.dispose();
850
850
  if (savedParticleSystem.parent)
851
851
  savedParticleSystem.parent.remove(savedParticleSystem);
852
+ if (wrapper?.parent) wrapper.parent.remove(wrapper);
852
853
  return false;
853
854
  }
854
855
  );
@@ -1332,8 +1333,8 @@ var createParticleSystem = (config = DEFAULT_PARTICLE_SYSTEM_CONFIG, externalNow
1332
1333
  const cleanupCompletedInstances = (instances) => {
1333
1334
  for (let i = instances.length - 1; i >= 0; i--) {
1334
1335
  const sub = instances[i];
1335
- const points = sub.instance;
1336
- const isActiveArr = points.geometry?.attributes?.isActive?.array;
1336
+ const points = sub.instance instanceof THREE3.Points ? sub.instance : sub.instance.children[0];
1337
+ const isActiveArr = points?.geometry?.attributes?.isActive?.array;
1337
1338
  if (!isActiveArr) {
1338
1339
  sub.dispose();
1339
1340
  instances.splice(i, 1);
@@ -1455,7 +1456,12 @@ var createParticleSystem = (config = DEFAULT_PARTICLE_SYSTEM_CONFIG, externalNow
1455
1456
  }
1456
1457
  destroyParticleSystem(particleSystem);
1457
1458
  };
1458
- const update = (cycleData) => updateParticleSystemInstance(instanceData, cycleData);
1459
+ const update = (cycleData) => {
1460
+ updateParticleSystemInstance(instanceData, cycleData);
1461
+ for (const instances of subEmitterInstancesMap.values()) {
1462
+ for (const sub of instances) sub.update(cycleData);
1463
+ }
1464
+ };
1459
1465
  return {
1460
1466
  instance: wrapper || particleSystem,
1461
1467
  resumeEmitter,