@tsparticles/preset-triangles 4.5.1 → 4.5.2

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.
@@ -1,6 +1,6 @@
1
1
  (function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
2
2
  (function (g) {
3
- /* Preset v4.5.1 */
3
+ /* Preset v4.5.2 */
4
4
  g.__tsParticlesInternals = g.__tsParticlesInternals || {};
5
5
  g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
6
6
  (function (exports) {
@@ -120,7 +120,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
120
120
  }
121
121
  normalize() {
122
122
  const length = this.length;
123
- if (length != none) {
123
+ if (length !== none) {
124
124
  this.multTo(inverseFactorNumerator / length);
125
125
  }
126
126
  }
@@ -867,11 +867,13 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
867
867
  #domArray = [];
868
868
  #eventDispatcher = new EventDispatcher();
869
869
  #initialized = false;
870
+ #loadSequence = 0;
871
+ #loadSequences = new Map();
870
872
  get items() {
871
873
  return this.#domArray;
872
874
  }
873
875
  get version() {
874
- return "4.5.1";
876
+ return "4.5.2";
875
877
  }
876
878
  addEventListener(type, listener) {
877
879
  this.#eventDispatcher.addEventListener(type, listener);
@@ -901,44 +903,60 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
901
903
  return item;
902
904
  }
903
905
  async load(params) {
904
- await this.init();
905
906
  let domSourceElement;
906
907
  if (typeof HTMLElement !== "undefined" && params.element instanceof HTMLElement) {
907
908
  domSourceElement = params.element;
908
909
  }
909
- const { Container } = await Promise.resolve().then(function () { return Container$1; }), id = params.id ?? domSourceElement?.id ?? `tsparticles${Math.floor(getRandom() * loadRandomFactor).toString()}`, { index, url } = params, options = url ? await getDataFromUrl({ fallback: params.options, url, index }) : params.options, currentOptions = itemFromSingleOrMultiple(options, index), { items } = this, oldIndex = items.findIndex(v => v.id.description === id), newItem = new Container({
910
- dispatchCallback: (eventType, args) => {
911
- this.dispatchEvent(eventType, args);
912
- },
913
- id,
914
- onDestroy: (remove) => {
915
- if (!remove) {
916
- return;
917
- }
918
- const mainArr = this.items, idx = mainArr.indexOf(newItem);
919
- if (idx >= removeMinIndex) {
920
- mainArr.splice(idx, removeDeleteCount);
910
+ const id = params.id ?? domSourceElement?.id ?? `tsparticles${Math.floor(getRandom() * loadRandomFactor).toString()}`, loadSequence = ++this.#loadSequence;
911
+ this.#loadSequences.set(id, loadSequence);
912
+ try {
913
+ await this.init();
914
+ const { Container } = await Promise.resolve().then(function () { return Container$1; }), { index, url } = params, options = url ? await getDataFromUrl({ fallback: params.options, url, index }) : params.options;
915
+ if (this.#loadSequences.get(id) !== loadSequence) {
916
+ return undefined;
917
+ }
918
+ const currentOptions = itemFromSingleOrMultiple(options, index), { items } = this, oldIndex = items.findIndex(v => v.id.description === id), newItem = new Container({
919
+ dispatchCallback: (eventType, args) => {
920
+ this.dispatchEvent(eventType, args);
921
+ },
922
+ id,
923
+ onDestroy: (remove) => {
924
+ if (!remove) {
925
+ return;
926
+ }
927
+ const mainArr = this.items, idx = mainArr.indexOf(newItem);
928
+ if (idx >= removeMinIndex) {
929
+ mainArr.splice(idx, removeDeleteCount);
930
+ }
931
+ },
932
+ pluginManager: this.pluginManager,
933
+ sourceOptions: currentOptions,
934
+ });
935
+ if (oldIndex >= loadMinIndex) {
936
+ const old = this.item(oldIndex), deleteCount = old ? one : none;
937
+ if (old && !old.destroyed) {
938
+ old.destroy(false);
921
939
  }
922
- },
923
- pluginManager: this.pluginManager,
924
- sourceOptions: currentOptions,
925
- });
926
- if (oldIndex >= loadMinIndex) {
927
- const old = this.item(oldIndex), deleteCount = old ? one : none;
928
- if (old && !old.destroyed) {
929
- old.destroy(false);
940
+ items.splice(oldIndex, deleteCount, newItem);
930
941
  }
931
- items.splice(oldIndex, deleteCount, newItem);
942
+ else {
943
+ items.push(newItem);
944
+ }
945
+ const sourceCanvas = typeof OffscreenCanvas !== "undefined" && params.element instanceof OffscreenCanvas
946
+ ? params.element
947
+ : getCanvasFromContainer(getDomContainer(id, domSourceElement));
948
+ newItem.canvas.loadCanvas(sourceCanvas);
949
+ await newItem.start();
950
+ if (newItem.destroyed) {
951
+ return undefined;
952
+ }
953
+ return newItem;
932
954
  }
933
- else {
934
- items.push(newItem);
955
+ finally {
956
+ if (this.#loadSequences.get(id) === loadSequence) {
957
+ this.#loadSequences.delete(id);
958
+ }
935
959
  }
936
- const sourceCanvas = typeof OffscreenCanvas !== "undefined" && params.element instanceof OffscreenCanvas
937
- ? params.element
938
- : getCanvasFromContainer(getDomContainer(id, domSourceElement));
939
- newItem.canvas.loadCanvas(sourceCanvas);
940
- await newItem.start();
941
- return newItem;
942
960
  }
943
961
  async refresh(refresh = true) {
944
962
  if (!refresh) {
@@ -2325,6 +2343,13 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2325
2343
  }
2326
2344
  }
2327
2345
 
2346
+ function hasEnabledBlend(particleOptions) {
2347
+ if (!particleOptions || typeof particleOptions !== "object" || !("blend" in particleOptions)) {
2348
+ return false;
2349
+ }
2350
+ const blend = particleOptions.blend;
2351
+ return !!blend && typeof blend === "object" && "enable" in blend && !!blend.enable;
2352
+ }
2328
2353
  class BlendPlugin {
2329
2354
  id = "blend";
2330
2355
  async getPlugin(container) {
@@ -2346,12 +2371,31 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2346
2371
  options.blend.load(source?.blend);
2347
2372
  }
2348
2373
  needsPlugin(options) {
2349
- return !!options?.blend?.enable || !!options?.particles?.blend?.enable;
2374
+ if (options?.blend?.enable ||
2375
+ options?.particles?.blend?.enable ||
2376
+ Object.values(options?.particles?.groups ?? {}).some(hasEnabledBlend)) {
2377
+ return true;
2378
+ }
2379
+ const emitters = options?.["emitters"];
2380
+ let emitterList = [];
2381
+ if (Array.isArray(emitters)) {
2382
+ emitterList = emitters;
2383
+ }
2384
+ else if (emitters) {
2385
+ emitterList = [emitters];
2386
+ }
2387
+ return emitterList.some(emitter => {
2388
+ if (!emitter || typeof emitter !== "object" || !("particles" in emitter)) {
2389
+ return false;
2390
+ }
2391
+ const particles = emitter.particles;
2392
+ return Array.isArray(particles) ? particles.some(hasEnabledBlend) : hasEnabledBlend(particles);
2393
+ });
2350
2394
  }
2351
2395
  }
2352
2396
 
2353
2397
  async function loadBlendPlugin(engine) {
2354
- engine.checkVersion("4.5.1");
2398
+ engine.checkVersion("4.5.2");
2355
2399
  await engine.pluginManager.register(e => {
2356
2400
  e.pluginManager.addPlugin(new BlendPlugin());
2357
2401
  });
@@ -2388,7 +2432,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2388
2432
  }
2389
2433
 
2390
2434
  async function loadCircleShape(engine) {
2391
- engine.checkVersion("4.5.1");
2435
+ engine.checkVersion("4.5.2");
2392
2436
  await engine.pluginManager.register(e => {
2393
2437
  e.pluginManager.addShape(["circle"], () => {
2394
2438
  return Promise.resolve(new CircleDrawer());
@@ -2436,7 +2480,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2436
2480
  }
2437
2481
 
2438
2482
  async function loadHexColorPlugin(engine) {
2439
- engine.checkVersion("4.5.1");
2483
+ engine.checkVersion("4.5.2");
2440
2484
  await engine.pluginManager.register(e => {
2441
2485
  e.pluginManager.addColorManager("hex", new HexColorManager());
2442
2486
  });
@@ -2489,7 +2533,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2489
2533
  }
2490
2534
 
2491
2535
  async function loadHslColorPlugin(engine) {
2492
- engine.checkVersion("4.5.1");
2536
+ engine.checkVersion("4.5.2");
2493
2537
  await engine.pluginManager.register(e => {
2494
2538
  e.pluginManager.addColorManager("hsl", new HslColorManager());
2495
2539
  });
@@ -2521,7 +2565,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2521
2565
  }
2522
2566
 
2523
2567
  async function loadMovePlugin(engine) {
2524
- engine.checkVersion("4.5.1");
2568
+ engine.checkVersion("4.5.2");
2525
2569
  if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
2526
2570
  addErrorMessages(ErrorMessages$1);
2527
2571
  }
@@ -2731,7 +2775,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2731
2775
  }
2732
2776
 
2733
2777
  async function loadOpacityUpdater(engine) {
2734
- engine.checkVersion("4.5.1");
2778
+ engine.checkVersion("4.5.2");
2735
2779
  await engine.pluginManager.register(e => {
2736
2780
  e.pluginManager.addParticleUpdater("opacity", container => {
2737
2781
  return Promise.resolve(new OpacityUpdater(container));
@@ -3060,7 +3104,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3060
3104
  }
3061
3105
 
3062
3106
  async function loadOutModesUpdater(engine) {
3063
- engine.checkVersion("4.5.1");
3107
+ engine.checkVersion("4.5.2");
3064
3108
  await engine.pluginManager.register(e => {
3065
3109
  e.pluginManager.addParticleUpdater("outModes", container => {
3066
3110
  return Promise.resolve(new OutOfCanvasUpdater(container));
@@ -3139,7 +3183,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3139
3183
  }
3140
3184
 
3141
3185
  async function loadPaintUpdater(engine) {
3142
- engine.checkVersion("4.5.1");
3186
+ engine.checkVersion("4.5.2");
3143
3187
  await engine.pluginManager.register(e => {
3144
3188
  e.pluginManager.addParticleUpdater("paint", container => {
3145
3189
  return Promise.resolve(new PaintUpdater(e.pluginManager, container));
@@ -3194,7 +3238,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3194
3238
  }
3195
3239
 
3196
3240
  async function loadRgbColorPlugin(engine) {
3197
- engine.checkVersion("4.5.1");
3241
+ engine.checkVersion("4.5.2");
3198
3242
  await engine.pluginManager.register(e => {
3199
3243
  e.pluginManager.addColorManager("rgb", new RgbColorManager());
3200
3244
  });
@@ -3279,7 +3323,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3279
3323
  }
3280
3324
 
3281
3325
  async function loadSizeUpdater(engine) {
3282
- engine.checkVersion("4.5.1");
3326
+ engine.checkVersion("4.5.2");
3283
3327
  await engine.pluginManager.register(e => {
3284
3328
  e.pluginManager.addParticleUpdater("size", container => {
3285
3329
  return Promise.resolve(new SizeUpdater(container));
@@ -3288,7 +3332,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3288
3332
  }
3289
3333
 
3290
3334
  async function loadBasic(engine) {
3291
- engine.checkVersion("4.5.1");
3335
+ engine.checkVersion("4.5.2");
3292
3336
  await engine.pluginManager.register(async (e) => {
3293
3337
  await Promise.all([
3294
3338
  loadBlendPlugin(e),
@@ -3494,7 +3538,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3494
3538
  const clickEvent = "click", mouseDownEvent = "pointerdown", mouseUpEvent = "pointerup", mouseLeaveEvent = "pointerleave", mouseMoveEvent = "pointermove", touchStartEvent = "touchstart", touchEndEvent = "touchend", touchMoveEvent = "touchmove", touchCancelEvent = "touchcancel";
3495
3539
 
3496
3540
  async function loadInteractivityPlugin(engine) {
3497
- engine.checkVersion("4.5.1");
3541
+ engine.checkVersion("4.5.2");
3498
3542
  if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
3499
3543
  addErrorMessages(ErrorMessages);
3500
3544
  }
@@ -3534,8 +3578,9 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3534
3578
  this.#canvasSize = canvasSize;
3535
3579
  }
3536
3580
  contains(point) {
3537
- if (super.contains(point))
3581
+ if (super.contains(point)) {
3538
3582
  return true;
3583
+ }
3539
3584
  const { width, height } = this.#canvasSize, { x, y } = point;
3540
3585
  return (super.contains({ x: x - width, y }) ||
3541
3586
  super.contains({ x: x + width, y }) ||
@@ -3547,8 +3592,9 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3547
3592
  super.contains({ x: x + width, y: y - height }));
3548
3593
  }
3549
3594
  intersects(range) {
3550
- if (super.intersects(range))
3595
+ if (super.intersects(range)) {
3551
3596
  return true;
3597
+ }
3552
3598
  const { width, height } = this.#canvasSize, pos = range.position, shifts = [
3553
3599
  { x: -width, y: 0 },
3554
3600
  { x: width, y: 0 },
@@ -3569,8 +3615,9 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3569
3615
  const rect = range;
3570
3616
  shiftedRange = new Rectangle(shiftedPos.x, shiftedPos.y, rect.size.width, rect.size.height);
3571
3617
  }
3572
- if (super.intersects(shiftedRange))
3618
+ if (super.intersects(shiftedRange)) {
3573
3619
  return true;
3620
+ }
3574
3621
  }
3575
3622
  return false;
3576
3623
  }
@@ -3580,14 +3627,18 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3580
3627
  return grid.query(this);
3581
3628
  }
3582
3629
  const xShifts = [originPoint.x], yShifts = [originPoint.y];
3583
- if (crossesLeft)
3630
+ if (crossesLeft) {
3584
3631
  xShifts.push(width);
3585
- if (crossesRight)
3632
+ }
3633
+ if (crossesRight) {
3586
3634
  xShifts.push(-width);
3587
- if (crossesTop)
3635
+ }
3636
+ if (crossesTop) {
3588
3637
  yShifts.push(height);
3589
- if (crossesBottom)
3638
+ }
3639
+ if (crossesBottom) {
3590
3640
  yShifts.push(-height);
3641
+ }
3591
3642
  const particles = new Set();
3592
3643
  for (const dx of xShifts) {
3593
3644
  for (const dy of yShifts) {
@@ -3797,7 +3848,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3797
3848
  }
3798
3849
 
3799
3850
  async function loadParticlesLinksInteraction(engine) {
3800
- engine.checkVersion("4.5.1");
3851
+ engine.checkVersion("4.5.2");
3801
3852
  await engine.pluginManager.register((e) => {
3802
3853
  const pluginManager = e.pluginManager;
3803
3854
  ensureInteractivityPluginLoaded(e);
@@ -4025,7 +4076,8 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
4025
4076
  });
4026
4077
  }
4027
4078
  drawParticles(delta) {
4028
- const { particles, actualOptions } = this.#container, clearedPlugin = this.clear();
4079
+ const { particles, actualOptions } = this.#container;
4080
+ this.clear();
4029
4081
  particles.update(delta);
4030
4082
  this.draw(ctx => {
4031
4083
  const width = this.#canvasManager.size.width, height = this.#canvasManager.size.height;
@@ -4047,9 +4099,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
4047
4099
  }
4048
4100
  }
4049
4101
  for (const plugin of this.#getLayerPlugins(DrawLayer.BackgroundMask)) {
4050
- if (plugin !== clearedPlugin) {
4051
- plugin.canvasPaint?.();
4052
- }
4102
+ plugin.canvasPaint?.();
4053
4103
  }
4054
4104
  for (const plugin of this.#getLayerPlugins(DrawLayer.CanvasSetup)) {
4055
4105
  plugin.drawSettingsSetup?.(ctx, delta);
@@ -4139,6 +4189,9 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
4139
4189
  ctx.clearRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
4140
4190
  });
4141
4191
  }
4192
+ updateBackgroundElement() {
4193
+ this.#resolveBackgroundElement();
4194
+ }
4142
4195
  #applyPostDrawUpdaters(particle) {
4143
4196
  for (const updater of this.#postDrawUpdaters) {
4144
4197
  updater.afterDraw?.(particle);
@@ -4337,7 +4390,14 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
4337
4390
  }
4338
4391
  if (typeof background.element === "string") {
4339
4392
  if (typeof document !== "undefined") {
4340
- const node = document.querySelector(background.element);
4393
+ let node;
4394
+ try {
4395
+ node = document.querySelector(background.element);
4396
+ }
4397
+ catch {
4398
+ this.#warnOnce("background-element-invalid-selector", `Background element selector "${background.element}" is invalid`);
4399
+ return;
4400
+ }
4341
4401
  if (node && this.#isSupportedElement(node)) {
4342
4402
  this.#backgroundElement = node;
4343
4403
  }
@@ -5161,10 +5221,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5161
5221
  runParticleCreatedPlugins(container, this);
5162
5222
  }
5163
5223
  isInsideCanvas(direction) {
5164
- return this.#getInsideCanvasResult({ direction }).inside;
5224
+ return this.#getInsideCanvasResult(direction).inside;
5165
5225
  }
5166
5226
  isInsideCanvasForOutMode(outMode, direction) {
5167
- return this.#getInsideCanvasResult({ direction, outMode }).inside;
5227
+ return this.#getInsideCanvasResult(direction, outMode).inside;
5168
5228
  }
5169
5229
  isShowingBack() {
5170
5230
  if (!this.roll) {
@@ -5281,7 +5341,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5281
5341
  });
5282
5342
  }
5283
5343
  #getDefaultInsideCanvasResult(direction, outMode) {
5284
- const radius = this.getRadius(), canvasSize = this.#container.canvas.size, position = this.position, isBounce = outMode === OutMode.bounce;
5344
+ const radius = this.getRadius(), canvasSize = this.#container.canvas.size, position = this.position, isBounce = outMode === OutMode.bounce || outMode === OutMode.split;
5285
5345
  if (direction === OutModeDirection.bottom) {
5286
5346
  return {
5287
5347
  inside: isBounce ? position.y + radius < canvasSize.height : position.y - radius < canvasSize.height,
@@ -5323,12 +5383,16 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5323
5383
  radius: this.getRadius(),
5324
5384
  };
5325
5385
  }
5326
- #getInsideCanvasResult(data) {
5327
- const defaultResult = this.#getDefaultInsideCanvasResult(data.direction, data.outMode), container = this.#container, shapeDrawer = this.shape ? container.shapeDrawers.get(this.shape) : undefined, effectDrawer = this.effect ? container.effectDrawers.get(this.effect) : undefined, shapeCheck = shapeDrawer?.isInsideCanvas, effectCheck = effectDrawer?.isInsideCanvas;
5328
- if (!shapeCheck && !effectCheck) {
5386
+ #getInsideCanvasResult(direction, outMode) {
5387
+ const defaultResult = this.#getDefaultInsideCanvasResult(direction, outMode), container = this.#container, shapeDrawer = this.shape ? container.shapeDrawers.get(this.shape) : undefined, effectDrawer = this.effect ? container.effectDrawers.get(this.effect) : undefined;
5388
+ if (!shapeDrawer?.isInsideCanvas && !effectDrawer?.isInsideCanvas) {
5329
5389
  return defaultResult;
5330
5390
  }
5331
- const callbackData = this.#getInsideCanvasCallbackData(data.direction, data.outMode), shapeResult = shapeCheck ? this.#normalizeInsideCanvasResult(shapeCheck(callbackData), "shape") : undefined, effectResult = effectCheck ? this.#normalizeInsideCanvasResult(effectCheck(callbackData), "effect") : undefined;
5391
+ const callbackData = this.#getInsideCanvasCallbackData(direction, outMode), shapeResult = shapeDrawer?.isInsideCanvas
5392
+ ? this.#normalizeInsideCanvasResult(shapeDrawer.isInsideCanvas(callbackData), "shape")
5393
+ : undefined, effectResult = effectDrawer?.isInsideCanvas
5394
+ ? this.#normalizeInsideCanvasResult(effectDrawer.isInsideCanvas(callbackData), "effect")
5395
+ : undefined;
5332
5396
  if (shapeResult && effectResult) {
5333
5397
  const margin = Math.max(shapeResult.margin ?? defaultAngle, effectResult.margin ?? defaultAngle);
5334
5398
  return {
@@ -5394,8 +5458,8 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5394
5458
  }
5395
5459
 
5396
5460
  class SpatialHashGrid {
5397
- #cellSize;
5398
5461
  #cells = new Map();
5462
+ #cellSize;
5399
5463
  #circlePool = [];
5400
5464
  #circlePoolIdx;
5401
5465
  #pendingCellSize;
@@ -6053,8 +6117,8 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
6053
6117
  particleCreatedPlugins;
6054
6118
  particleDestroyedPlugins;
6055
6119
  particlePositionPlugins;
6056
- particleUpdaters;
6057
6120
  particles;
6121
+ particleUpdaters;
6058
6122
  peakNits;
6059
6123
  plugins;
6060
6124
  retina;
@@ -6348,6 +6412,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
6348
6412
  refresh = plugin.updateActualOptions() || refresh;
6349
6413
  }
6350
6414
  }
6415
+ this.canvas.render.updateBackgroundElement();
6351
6416
  return refresh;
6352
6417
  }
6353
6418
  #initPlugins(allContainerPlugins) {