@tsparticles/interaction-external-bubble 3.0.0-alpha.1 → 3.0.0-beta.0

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 (46) hide show
  1. package/README.md +25 -19
  2. package/browser/Bubbler.js +211 -234
  3. package/browser/Options/Classes/Bubble.js +1 -1
  4. package/browser/Options/Classes/BubbleBase.js +2 -2
  5. package/browser/Options/Classes/BubbleDiv.js +0 -10
  6. package/browser/Utils.js +11 -0
  7. package/browser/index.js +2 -2
  8. package/cjs/Bubbler.js +218 -252
  9. package/cjs/Options/Classes/Bubble.js +1 -1
  10. package/cjs/Options/Classes/BubbleBase.js +1 -1
  11. package/cjs/Options/Classes/BubbleDiv.js +0 -10
  12. package/cjs/Utils.js +15 -0
  13. package/cjs/index.js +2 -13
  14. package/esm/Bubbler.js +211 -234
  15. package/esm/Options/Classes/Bubble.js +1 -1
  16. package/esm/Options/Classes/BubbleBase.js +2 -2
  17. package/esm/Options/Classes/BubbleDiv.js +0 -10
  18. package/esm/Utils.js +11 -0
  19. package/esm/index.js +2 -2
  20. package/package.json +6 -5
  21. package/report.html +4 -4
  22. package/tsparticles.interaction.external.bubble.js +255 -262
  23. package/tsparticles.interaction.external.bubble.min.js +1 -1
  24. package/tsparticles.interaction.external.bubble.min.js.LICENSE.txt +1 -8
  25. package/types/Bubbler.d.ts +8 -9
  26. package/types/{IBubblerProcessParam.d.ts → Interfaces.d.ts} +2 -2
  27. package/types/Options/Classes/Bubble.d.ts +1 -1
  28. package/types/Options/Classes/BubbleBase.d.ts +1 -2
  29. package/types/Options/Classes/BubbleDiv.d.ts +1 -3
  30. package/types/Utils.d.ts +1 -0
  31. package/types/index.d.ts +1 -1
  32. package/umd/Bubbler.js +211 -234
  33. package/umd/Options/Classes/Bubble.js +2 -2
  34. package/umd/Options/Classes/BubbleBase.js +1 -1
  35. package/umd/Options/Classes/BubbleDiv.js +1 -11
  36. package/umd/Utils.js +25 -0
  37. package/umd/index.js +2 -2
  38. /package/browser/{IBubblerProcessParam.js → Enums.js} +0 -0
  39. /package/browser/{ProcessBubbleType.js → Interfaces.js} +0 -0
  40. /package/cjs/{IBubblerProcessParam.js → Enums.js} +0 -0
  41. /package/cjs/{ProcessBubbleType.js → Interfaces.js} +0 -0
  42. /package/esm/{IBubblerProcessParam.js → Enums.js} +0 -0
  43. /package/esm/{ProcessBubbleType.js → Interfaces.js} +0 -0
  44. /package/types/{ProcessBubbleType.d.ts → Enums.d.ts} +0 -0
  45. /package/umd/{IBubblerProcessParam.js → Enums.js} +0 -0
  46. /package/umd/{ProcessBubbleType.js → Interfaces.js} +0 -0
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v3.0.0-alpha.1
7
+ * v3.0.0-beta.0
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
@@ -91,10 +91,10 @@ __webpack_require__.r(__webpack_exports__);
91
91
 
92
92
  // EXPORTS
93
93
  __webpack_require__.d(__webpack_exports__, {
94
- "Bubble": () => (/* reexport */ Bubble),
95
- "BubbleBase": () => (/* reexport */ BubbleBase),
96
- "BubbleDiv": () => (/* reexport */ BubbleDiv),
97
- "loadExternalBubbleInteraction": () => (/* binding */ loadExternalBubbleInteraction)
94
+ Bubble: () => (/* reexport */ Bubble),
95
+ BubbleBase: () => (/* reexport */ BubbleBase),
96
+ BubbleDiv: () => (/* reexport */ BubbleDiv),
97
+ loadExternalBubbleInteraction: () => (/* binding */ loadExternalBubbleInteraction)
98
98
  });
99
99
 
100
100
  // EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
@@ -124,7 +124,7 @@ class BubbleBase {
124
124
  this.opacity = data.opacity;
125
125
  }
126
126
  if (data.color !== undefined) {
127
- const sourceColor = this.color instanceof Array ? undefined : this.color;
127
+ const sourceColor = (0,engine_root_window_.isArray)(this.color) ? undefined : this.color;
128
128
  this.color = (0,engine_root_window_.executeOnSingleOrMultiple)(data.color, color => {
129
129
  return engine_root_window_.OptionsColor.create(sourceColor, color);
130
130
  });
@@ -136,26 +136,16 @@ class BubbleBase {
136
136
  }
137
137
  ;// CONCATENATED MODULE: ./dist/browser/Options/Classes/BubbleDiv.js
138
138
 
139
-
140
139
  class BubbleDiv extends BubbleBase {
141
140
  constructor() {
142
141
  super();
143
142
  this.selectors = [];
144
143
  }
145
- get ids() {
146
- return (0,engine_root_window_.executeOnSingleOrMultiple)(this.selectors, t => t.replace("#", ""));
147
- }
148
- set ids(value) {
149
- this.selectors = (0,engine_root_window_.executeOnSingleOrMultiple)(value, t => `#${t}`);
150
- }
151
144
  load(data) {
152
145
  super.load(data);
153
146
  if (!data) {
154
147
  return;
155
148
  }
156
- if (data.ids !== undefined) {
157
- this.ids = data.ids;
158
- }
159
149
  if (data.selectors !== undefined) {
160
150
  this.selectors = data.selectors;
161
151
  }
@@ -178,8 +168,7 @@ class Bubble extends BubbleBase {
178
168
  });
179
169
  }
180
170
  }
181
- ;// CONCATENATED MODULE: ./dist/browser/Bubbler.js
182
-
171
+ ;// CONCATENATED MODULE: ./dist/browser/Utils.js
183
172
 
184
173
  function calculateBubbleValue(particleValue, modeValue, optionsValue, ratio) {
185
174
  if (modeValue >= optionsValue) {
@@ -190,9 +179,242 @@ function calculateBubbleValue(particleValue, modeValue, optionsValue, ratio) {
190
179
  return (0,engine_root_window_.clamp)(value, modeValue, particleValue);
191
180
  }
192
181
  }
182
+ ;// CONCATENATED MODULE: ./dist/browser/Bubbler.js
183
+
184
+
185
+
193
186
  class Bubbler extends engine_root_window_.ExternalInteractorBase {
194
187
  constructor(container) {
195
188
  super(container);
189
+ this._clickBubble = () => {
190
+ const container = this.container,
191
+ options = container.actualOptions,
192
+ mouseClickPos = container.interactivity.mouse.clickPosition,
193
+ bubbleOptions = options.interactivity.modes.bubble;
194
+ if (!bubbleOptions || !mouseClickPos) {
195
+ return;
196
+ }
197
+ if (!container.bubble) {
198
+ container.bubble = {};
199
+ }
200
+ const distance = container.retina.bubbleModeDistance;
201
+ if (!distance || distance < 0) {
202
+ return;
203
+ }
204
+ const query = container.particles.quadTree.queryCircle(mouseClickPos, distance, p => this.isEnabled(p)),
205
+ {
206
+ bubble
207
+ } = container;
208
+ for (const particle of query) {
209
+ if (!bubble.clicking) {
210
+ continue;
211
+ }
212
+ particle.bubble.inRange = !bubble.durationEnd;
213
+ const pos = particle.getPosition(),
214
+ distMouse = (0,engine_root_window_.getDistance)(pos, mouseClickPos),
215
+ timeSpent = (new Date().getTime() - (container.interactivity.mouse.clickTime || 0)) / 1000;
216
+ if (timeSpent > bubbleOptions.duration) {
217
+ bubble.durationEnd = true;
218
+ }
219
+ if (timeSpent > bubbleOptions.duration * 2) {
220
+ bubble.clicking = false;
221
+ bubble.durationEnd = false;
222
+ }
223
+ const sizeData = {
224
+ bubbleObj: {
225
+ optValue: container.retina.bubbleModeSize,
226
+ value: particle.bubble.radius
227
+ },
228
+ particlesObj: {
229
+ optValue: (0,engine_root_window_.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio,
230
+ value: particle.size.value
231
+ },
232
+ type: "size"
233
+ };
234
+ this._process(particle, distMouse, timeSpent, sizeData);
235
+ const opacityData = {
236
+ bubbleObj: {
237
+ optValue: bubbleOptions.opacity,
238
+ value: particle.bubble.opacity
239
+ },
240
+ particlesObj: {
241
+ optValue: (0,engine_root_window_.getRangeMax)(particle.options.opacity.value),
242
+ value: particle.opacity?.value ?? 1
243
+ },
244
+ type: "opacity"
245
+ };
246
+ this._process(particle, distMouse, timeSpent, opacityData);
247
+ if (!bubble.durationEnd && distMouse <= distance) {
248
+ this._hoverBubbleColor(particle, distMouse);
249
+ } else {
250
+ delete particle.bubble.color;
251
+ }
252
+ }
253
+ };
254
+ this._hoverBubble = () => {
255
+ const container = this.container,
256
+ mousePos = container.interactivity.mouse.position,
257
+ distance = container.retina.bubbleModeDistance;
258
+ if (!distance || distance < 0 || mousePos === undefined) {
259
+ return;
260
+ }
261
+ const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));
262
+ for (const particle of query) {
263
+ particle.bubble.inRange = true;
264
+ const pos = particle.getPosition(),
265
+ pointDistance = (0,engine_root_window_.getDistance)(pos, mousePos),
266
+ ratio = 1 - pointDistance / distance;
267
+ if (pointDistance <= distance) {
268
+ if (ratio >= 0 && container.interactivity.status === engine_root_window_.mouseMoveEvent) {
269
+ this._hoverBubbleSize(particle, ratio);
270
+ this._hoverBubbleOpacity(particle, ratio);
271
+ this._hoverBubbleColor(particle, ratio);
272
+ }
273
+ } else {
274
+ this.reset(particle);
275
+ }
276
+ if (container.interactivity.status === engine_root_window_.mouseLeaveEvent) {
277
+ this.reset(particle);
278
+ }
279
+ }
280
+ };
281
+ this._hoverBubbleColor = (particle, ratio, divBubble) => {
282
+ const options = this.container.actualOptions,
283
+ bubbleOptions = divBubble ?? options.interactivity.modes.bubble;
284
+ if (!bubbleOptions) {
285
+ return;
286
+ }
287
+ if (!particle.bubble.finalColor) {
288
+ const modeColor = bubbleOptions.color;
289
+ if (!modeColor) {
290
+ return;
291
+ }
292
+ const bubbleColor = (0,engine_root_window_.itemFromSingleOrMultiple)(modeColor);
293
+ particle.bubble.finalColor = (0,engine_root_window_.rangeColorToHsl)(bubbleColor);
294
+ }
295
+ if (!particle.bubble.finalColor) {
296
+ return;
297
+ }
298
+ if (bubbleOptions.mix) {
299
+ particle.bubble.color = undefined;
300
+ const pColor = particle.getFillColor();
301
+ particle.bubble.color = pColor ? (0,engine_root_window_.rgbToHsl)((0,engine_root_window_.colorMix)(pColor, particle.bubble.finalColor, 1 - ratio, ratio)) : particle.bubble.finalColor;
302
+ } else {
303
+ particle.bubble.color = particle.bubble.finalColor;
304
+ }
305
+ };
306
+ this._hoverBubbleOpacity = (particle, ratio, divBubble) => {
307
+ const container = this.container,
308
+ options = container.actualOptions,
309
+ modeOpacity = divBubble?.opacity ?? options.interactivity.modes.bubble?.opacity;
310
+ if (!modeOpacity) {
311
+ return;
312
+ }
313
+ const optOpacity = particle.options.opacity.value,
314
+ pOpacity = particle.opacity?.value ?? 1,
315
+ opacity = calculateBubbleValue(pOpacity, modeOpacity, (0,engine_root_window_.getRangeMax)(optOpacity), ratio);
316
+ if (opacity !== undefined) {
317
+ particle.bubble.opacity = opacity;
318
+ }
319
+ };
320
+ this._hoverBubbleSize = (particle, ratio, divBubble) => {
321
+ const container = this.container,
322
+ modeSize = divBubble?.size ? divBubble.size * container.retina.pixelRatio : container.retina.bubbleModeSize;
323
+ if (modeSize === undefined) {
324
+ return;
325
+ }
326
+ const optSize = (0,engine_root_window_.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio,
327
+ pSize = particle.size.value,
328
+ size = calculateBubbleValue(pSize, modeSize, optSize, ratio);
329
+ if (size !== undefined) {
330
+ particle.bubble.radius = size;
331
+ }
332
+ };
333
+ this._process = (particle, distMouse, timeSpent, data) => {
334
+ const container = this.container,
335
+ bubbleParam = data.bubbleObj.optValue,
336
+ options = container.actualOptions,
337
+ bubbleOptions = options.interactivity.modes.bubble;
338
+ if (!bubbleOptions || bubbleParam === undefined) {
339
+ return;
340
+ }
341
+ const bubbleDuration = bubbleOptions.duration,
342
+ bubbleDistance = container.retina.bubbleModeDistance,
343
+ particlesParam = data.particlesObj.optValue,
344
+ pObjBubble = data.bubbleObj.value,
345
+ pObj = data.particlesObj.value || 0,
346
+ type = data.type;
347
+ if (!bubbleDistance || bubbleDistance < 0 || bubbleParam === particlesParam) {
348
+ return;
349
+ }
350
+ if (!container.bubble) {
351
+ container.bubble = {};
352
+ }
353
+ if (container.bubble.durationEnd) {
354
+ if (pObjBubble) {
355
+ if (type === "size") {
356
+ delete particle.bubble.radius;
357
+ }
358
+ if (type === "opacity") {
359
+ delete particle.bubble.opacity;
360
+ }
361
+ }
362
+ } else {
363
+ if (distMouse <= bubbleDistance) {
364
+ const obj = pObjBubble ?? pObj;
365
+ if (obj !== bubbleParam) {
366
+ const value = pObj - timeSpent * (pObj - bubbleParam) / bubbleDuration;
367
+ if (type === "size") {
368
+ particle.bubble.radius = value;
369
+ }
370
+ if (type === "opacity") {
371
+ particle.bubble.opacity = value;
372
+ }
373
+ }
374
+ } else {
375
+ if (type === "size") {
376
+ delete particle.bubble.radius;
377
+ }
378
+ if (type === "opacity") {
379
+ delete particle.bubble.opacity;
380
+ }
381
+ }
382
+ }
383
+ };
384
+ this._singleSelectorHover = (delta, selector, div) => {
385
+ const container = this.container,
386
+ selectors = document.querySelectorAll(selector),
387
+ bubble = container.actualOptions.interactivity.modes.bubble;
388
+ if (!bubble || !selectors.length) {
389
+ return;
390
+ }
391
+ selectors.forEach(item => {
392
+ const elem = item,
393
+ pxRatio = container.retina.pixelRatio,
394
+ pos = {
395
+ x: (elem.offsetLeft + elem.offsetWidth / 2) * pxRatio,
396
+ y: (elem.offsetTop + elem.offsetHeight / 2) * pxRatio
397
+ },
398
+ repulseRadius = elem.offsetWidth / 2 * pxRatio,
399
+ area = div.type === "circle" ? new engine_root_window_.Circle(pos.x, pos.y, repulseRadius) : new engine_root_window_.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio),
400
+ query = container.particles.quadTree.query(area, p => this.isEnabled(p));
401
+ for (const particle of query) {
402
+ if (!area.contains(particle.getPosition())) {
403
+ continue;
404
+ }
405
+ particle.bubble.inRange = true;
406
+ const divs = bubble.divs,
407
+ divBubble = (0,engine_root_window_.divMode)(divs, elem);
408
+ if (!particle.bubble.div || particle.bubble.div !== elem) {
409
+ this.clear(particle, delta, true);
410
+ particle.bubble.div = elem;
411
+ }
412
+ this._hoverBubbleSize(particle, 1, divBubble);
413
+ this._hoverBubbleOpacity(particle, 1, divBubble);
414
+ this._hoverBubbleColor(particle, 1, divBubble);
415
+ }
416
+ });
417
+ };
196
418
  if (!container.bubble) {
197
419
  container.bubble = {};
198
420
  }
@@ -237,274 +459,45 @@ class Bubbler extends engine_root_window_.ExternalInteractorBase {
237
459
  clickMode = onClick.mode,
238
460
  divs = events.onDiv;
239
461
  if (hoverEnabled && (0,engine_root_window_.isInArray)("bubble", hoverMode)) {
240
- this.hoverBubble(delta);
462
+ this._hoverBubble();
241
463
  } else if (clickEnabled && (0,engine_root_window_.isInArray)("bubble", clickMode)) {
242
- this.clickBubble(delta);
464
+ this._clickBubble();
243
465
  } else {
244
- (0,engine_root_window_.divModeExecute)("bubble", divs, (selector, div) => this.singleSelectorHover(delta, selector, div));
466
+ (0,engine_root_window_.divModeExecute)("bubble", divs, (selector, div) => this._singleSelectorHover(delta, selector, div));
245
467
  }
246
468
  }
247
469
  isEnabled(particle) {
248
- var _a;
249
470
  const container = this.container,
250
471
  options = container.actualOptions,
251
472
  mouse = container.interactivity.mouse,
252
- events = ((_a = particle === null || particle === void 0 ? void 0 : particle.interactivity) !== null && _a !== void 0 ? _a : options.interactivity).events,
253
- divs = events.onDiv,
254
- divBubble = (0,engine_root_window_.isDivModeEnabled)("bubble", divs);
255
- if (!(divBubble || events.onHover.enable && mouse.position || events.onClick.enable && mouse.clickPosition)) {
473
+ events = (particle?.interactivity ?? options.interactivity).events,
474
+ {
475
+ onClick,
476
+ onDiv,
477
+ onHover
478
+ } = events,
479
+ divBubble = (0,engine_root_window_.isDivModeEnabled)("bubble", onDiv);
480
+ if (!(divBubble || onHover.enable && mouse.position || onClick.enable && mouse.clickPosition)) {
256
481
  return false;
257
482
  }
258
- const hoverMode = events.onHover.mode;
259
- const clickMode = events.onClick.mode;
260
- return (0,engine_root_window_.isInArray)("bubble", hoverMode) || (0,engine_root_window_.isInArray)("bubble", clickMode) || divBubble;
483
+ return (0,engine_root_window_.isInArray)("bubble", onHover.mode) || (0,engine_root_window_.isInArray)("bubble", onClick.mode) || divBubble;
261
484
  }
262
485
  loadModeOptions(options, ...sources) {
263
486
  if (!options.bubble) {
264
487
  options.bubble = new Bubble();
265
488
  }
266
489
  for (const source of sources) {
267
- options.bubble.load(source === null || source === void 0 ? void 0 : source.bubble);
490
+ options.bubble.load(source?.bubble);
268
491
  }
269
492
  }
270
493
  reset(particle) {
271
494
  particle.bubble.inRange = false;
272
495
  }
273
- clickBubble(delta) {
274
- var _a, _b;
275
- const container = this.container,
276
- options = container.actualOptions,
277
- mouseClickPos = container.interactivity.mouse.clickPosition,
278
- bubble = options.interactivity.modes.bubble;
279
- if (!bubble || !mouseClickPos) {
280
- return;
281
- }
282
- if (!container.bubble) {
283
- container.bubble = {};
284
- }
285
- const distance = container.retina.bubbleModeDistance;
286
- if (!distance || distance < 0) {
287
- return;
288
- }
289
- const query = container.particles.quadTree.queryCircle(mouseClickPos, distance, p => this.isEnabled(p));
290
- for (const particle of query) {
291
- if (!container.bubble.clicking) {
292
- continue;
293
- }
294
- particle.bubble.inRange = !container.bubble.durationEnd;
295
- const pos = particle.getPosition(),
296
- distMouse = (0,engine_root_window_.getDistance)(pos, mouseClickPos),
297
- timeSpent = (new Date().getTime() - (container.interactivity.mouse.clickTime || 0)) / 1000;
298
- if (timeSpent > bubble.duration) {
299
- container.bubble.durationEnd = true;
300
- }
301
- if (timeSpent > bubble.duration * 2) {
302
- container.bubble.clicking = false;
303
- container.bubble.durationEnd = false;
304
- }
305
- const sizeData = {
306
- bubbleObj: {
307
- optValue: container.retina.bubbleModeSize,
308
- value: particle.bubble.radius
309
- },
310
- particlesObj: {
311
- optValue: (0,engine_root_window_.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio,
312
- value: particle.size.value
313
- },
314
- type: "size"
315
- };
316
- this.process(particle, distMouse, timeSpent, sizeData);
317
- const opacityData = {
318
- bubbleObj: {
319
- optValue: bubble.opacity,
320
- value: particle.bubble.opacity
321
- },
322
- particlesObj: {
323
- optValue: (0,engine_root_window_.getRangeMax)(particle.options.opacity.value),
324
- value: (_b = (_a = particle.opacity) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 1
325
- },
326
- type: "opacity"
327
- };
328
- this.process(particle, distMouse, timeSpent, opacityData);
329
- if (!container.bubble.durationEnd) {
330
- if (distMouse <= distance) {
331
- this.hoverBubbleColor(particle, distMouse);
332
- } else {
333
- delete particle.bubble.color;
334
- }
335
- } else {
336
- delete particle.bubble.color;
337
- }
338
- }
339
- }
340
- hoverBubble(delta) {
341
- const container = this.container,
342
- mousePos = container.interactivity.mouse.position,
343
- distance = container.retina.bubbleModeDistance;
344
- if (!distance || distance < 0 || mousePos === undefined) {
345
- return;
346
- }
347
- const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));
348
- for (const particle of query) {
349
- particle.bubble.inRange = true;
350
- const pos = particle.getPosition(),
351
- pointDistance = (0,engine_root_window_.getDistance)(pos, mousePos),
352
- ratio = 1 - pointDistance / distance;
353
- if (pointDistance <= distance) {
354
- if (ratio >= 0 && container.interactivity.status === engine_root_window_.mouseMoveEvent) {
355
- this.hoverBubbleSize(particle, ratio);
356
- this.hoverBubbleOpacity(particle, ratio);
357
- this.hoverBubbleColor(particle, ratio);
358
- }
359
- } else {
360
- this.reset(particle);
361
- }
362
- if (container.interactivity.status === engine_root_window_.mouseLeaveEvent) {
363
- this.reset(particle);
364
- }
365
- }
366
- }
367
- hoverBubbleColor(particle, ratio, divBubble) {
368
- const options = this.container.actualOptions;
369
- const bubbleOptions = divBubble !== null && divBubble !== void 0 ? divBubble : options.interactivity.modes.bubble;
370
- if (!bubbleOptions) {
371
- return;
372
- }
373
- if (!particle.bubble.finalColor) {
374
- const modeColor = bubbleOptions.color;
375
- if (!modeColor) {
376
- return;
377
- }
378
- const bubbleColor = (0,engine_root_window_.itemFromSingleOrMultiple)(modeColor);
379
- particle.bubble.finalColor = (0,engine_root_window_.rangeColorToHsl)(bubbleColor);
380
- }
381
- if (!particle.bubble.finalColor) {
382
- return;
383
- }
384
- if (bubbleOptions.mix) {
385
- particle.bubble.color = undefined;
386
- const pColor = particle.getFillColor();
387
- particle.bubble.color = pColor ? (0,engine_root_window_.rgbToHsl)((0,engine_root_window_.colorMix)(pColor, particle.bubble.finalColor, 1 - ratio, ratio)) : particle.bubble.finalColor;
388
- } else {
389
- particle.bubble.color = particle.bubble.finalColor;
390
- }
391
- }
392
- hoverBubbleOpacity(particle, ratio, divBubble) {
393
- var _a, _b, _c, _d;
394
- const container = this.container,
395
- options = container.actualOptions,
396
- modeOpacity = (_a = divBubble === null || divBubble === void 0 ? void 0 : divBubble.opacity) !== null && _a !== void 0 ? _a : (_b = options.interactivity.modes.bubble) === null || _b === void 0 ? void 0 : _b.opacity;
397
- if (!modeOpacity) {
398
- return;
399
- }
400
- const optOpacity = particle.options.opacity.value;
401
- const pOpacity = (_d = (_c = particle.opacity) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : 1;
402
- const opacity = calculateBubbleValue(pOpacity, modeOpacity, (0,engine_root_window_.getRangeMax)(optOpacity), ratio);
403
- if (opacity !== undefined) {
404
- particle.bubble.opacity = opacity;
405
- }
406
- }
407
- hoverBubbleSize(particle, ratio, divBubble) {
408
- const container = this.container,
409
- modeSize = (divBubble === null || divBubble === void 0 ? void 0 : divBubble.size) ? divBubble.size * container.retina.pixelRatio : container.retina.bubbleModeSize;
410
- if (modeSize === undefined) {
411
- return;
412
- }
413
- const optSize = (0,engine_root_window_.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio;
414
- const pSize = particle.size.value;
415
- const size = calculateBubbleValue(pSize, modeSize, optSize, ratio);
416
- if (size !== undefined) {
417
- particle.bubble.radius = size;
418
- }
419
- }
420
- process(particle, distMouse, timeSpent, data) {
421
- const container = this.container,
422
- bubbleParam = data.bubbleObj.optValue,
423
- options = container.actualOptions,
424
- bubble = options.interactivity.modes.bubble;
425
- if (!bubble || bubbleParam === undefined) {
426
- return;
427
- }
428
- const bubbleDuration = bubble.duration,
429
- bubbleDistance = container.retina.bubbleModeDistance,
430
- particlesParam = data.particlesObj.optValue,
431
- pObjBubble = data.bubbleObj.value,
432
- pObj = data.particlesObj.value || 0,
433
- type = data.type;
434
- if (!bubbleDistance || bubbleDistance < 0 || bubbleParam === particlesParam) {
435
- return;
436
- }
437
- if (!container.bubble) {
438
- container.bubble = {};
439
- }
440
- if (!container.bubble.durationEnd) {
441
- if (distMouse <= bubbleDistance) {
442
- const obj = pObjBubble !== null && pObjBubble !== void 0 ? pObjBubble : pObj;
443
- if (obj !== bubbleParam) {
444
- const value = pObj - timeSpent * (pObj - bubbleParam) / bubbleDuration;
445
- if (type === "size") {
446
- particle.bubble.radius = value;
447
- }
448
- if (type === "opacity") {
449
- particle.bubble.opacity = value;
450
- }
451
- }
452
- } else {
453
- if (type === "size") {
454
- delete particle.bubble.radius;
455
- }
456
- if (type === "opacity") {
457
- delete particle.bubble.opacity;
458
- }
459
- }
460
- } else if (pObjBubble) {
461
- if (type === "size") {
462
- delete particle.bubble.radius;
463
- }
464
- if (type === "opacity") {
465
- delete particle.bubble.opacity;
466
- }
467
- }
468
- }
469
- singleSelectorHover(delta, selector, div) {
470
- const container = this.container,
471
- selectors = document.querySelectorAll(selector),
472
- bubble = container.actualOptions.interactivity.modes.bubble;
473
- if (!bubble || !selectors.length) {
474
- return;
475
- }
476
- selectors.forEach(item => {
477
- const elem = item,
478
- pxRatio = container.retina.pixelRatio,
479
- pos = {
480
- x: (elem.offsetLeft + elem.offsetWidth / 2) * pxRatio,
481
- y: (elem.offsetTop + elem.offsetHeight / 2) * pxRatio
482
- },
483
- repulseRadius = elem.offsetWidth / 2 * pxRatio,
484
- area = div.type === "circle" ? new engine_root_window_.Circle(pos.x, pos.y, repulseRadius) : new engine_root_window_.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio),
485
- query = container.particles.quadTree.query(area, p => this.isEnabled(p));
486
- for (const particle of query) {
487
- if (!area.contains(particle.getPosition())) {
488
- continue;
489
- }
490
- particle.bubble.inRange = true;
491
- const divs = bubble.divs;
492
- const divBubble = (0,engine_root_window_.divMode)(divs, elem);
493
- if (!particle.bubble.div || particle.bubble.div !== elem) {
494
- this.clear(particle, delta, true);
495
- particle.bubble.div = elem;
496
- }
497
- this.hoverBubbleSize(particle, 1, divBubble);
498
- this.hoverBubbleOpacity(particle, 1, divBubble);
499
- this.hoverBubbleColor(particle, 1, divBubble);
500
- }
501
- });
502
- }
503
496
  }
504
497
  ;// CONCATENATED MODULE: ./dist/browser/index.js
505
498
 
506
- async function loadExternalBubbleInteraction(engine) {
507
- await engine.addInteractor("externalBubble", container => new Bubbler(container));
499
+ async function loadExternalBubbleInteraction(engine, refresh = true) {
500
+ await engine.addInteractor("externalBubble", container => new Bubbler(container), refresh);
508
501
  }
509
502
 
510
503
 
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.interaction.external.bubble.min.js.LICENSE.txt */
2
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var i="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in i)("object"==typeof exports?exports:e)[o]=i[o]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},i={};function o(e){var l=i[e];if(void 0!==l)return l.exports;var b=i[e]={exports:{}};return t[e](b,b.exports,o),b.exports}o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return(()=>{o.r(l),o.d(l,{Bubble:()=>b,BubbleBase:()=>t,BubbleDiv:()=>i,loadExternalBubbleInteraction:()=>r});var e=o(533);class t{constructor(){this.distance=200,this.duration=.4,this.mix=!1}load(t){if(t){if(void 0!==t.distance&&(this.distance=t.distance),void 0!==t.duration&&(this.duration=t.duration),void 0!==t.mix&&(this.mix=t.mix),void 0!==t.opacity&&(this.opacity=t.opacity),void 0!==t.color){const i=this.color instanceof Array?void 0:this.color;this.color=(0,e.executeOnSingleOrMultiple)(t.color,(t=>e.OptionsColor.create(i,t)))}void 0!==t.size&&(this.size=t.size)}}}class i extends t{constructor(){super(),this.selectors=[]}get ids(){return(0,e.executeOnSingleOrMultiple)(this.selectors,(e=>e.replace("#","")))}set ids(t){this.selectors=(0,e.executeOnSingleOrMultiple)(t,(e=>`#${e}`))}load(e){super.load(e),e&&(void 0!==e.ids&&(this.ids=e.ids),void 0!==e.selectors&&(this.selectors=e.selectors))}}class b extends t{load(t){super.load(t),t&&(this.divs=(0,e.executeOnSingleOrMultiple)(t.divs,(e=>{const t=new i;return t.load(e),t})))}}function n(t,i,o,l){if(i>=o){const b=t+(i-o)*l;return(0,e.clamp)(b,t,i)}if(i<o){const b=t-(o-i)*l;return(0,e.clamp)(b,i,t)}}class s extends e.ExternalInteractorBase{constructor(e){super(e),e.bubble||(e.bubble={}),this.handleClickMode=t=>{"bubble"===t&&(e.bubble||(e.bubble={}),e.bubble.clicking=!0)}}clear(e,t,i){e.bubble.inRange&&!i||(delete e.bubble.div,delete e.bubble.opacity,delete e.bubble.radius,delete e.bubble.color)}init(){const e=this.container,t=e.actualOptions.interactivity.modes.bubble;t&&(e.retina.bubbleModeDistance=t.distance*e.retina.pixelRatio,void 0!==t.size&&(e.retina.bubbleModeSize=t.size*e.retina.pixelRatio))}async interact(t){const i=this.container.actualOptions.interactivity.events,o=i.onHover,l=i.onClick,b=o.enable,n=o.mode,s=l.enable,r=l.mode,a=i.onDiv;b&&(0,e.isInArray)("bubble",n)?this.hoverBubble(t):s&&(0,e.isInArray)("bubble",r)?this.clickBubble(t):(0,e.divModeExecute)("bubble",a,((e,i)=>this.singleSelectorHover(t,e,i)))}isEnabled(t){var i;const o=this.container,l=o.actualOptions,b=o.interactivity.mouse,n=(null!==(i=null==t?void 0:t.interactivity)&&void 0!==i?i:l.interactivity).events,s=n.onDiv,r=(0,e.isDivModeEnabled)("bubble",s);if(!(r||n.onHover.enable&&b.position||n.onClick.enable&&b.clickPosition))return!1;const a=n.onHover.mode,u=n.onClick.mode;return(0,e.isInArray)("bubble",a)||(0,e.isInArray)("bubble",u)||r}loadModeOptions(e,...t){e.bubble||(e.bubble=new b);for(const i of t)e.bubble.load(null==i?void 0:i.bubble)}reset(e){e.bubble.inRange=!1}clickBubble(t){var i,o;const l=this.container,b=l.actualOptions,n=l.interactivity.mouse.clickPosition,s=b.interactivity.modes.bubble;if(!s||!n)return;l.bubble||(l.bubble={});const r=l.retina.bubbleModeDistance;if(!r||r<0)return;const a=l.particles.quadTree.queryCircle(n,r,(e=>this.isEnabled(e)));for(const t of a){if(!l.bubble.clicking)continue;t.bubble.inRange=!l.bubble.durationEnd;const b=t.getPosition(),a=(0,e.getDistance)(b,n),u=((new Date).getTime()-(l.interactivity.mouse.clickTime||0))/1e3;u>s.duration&&(l.bubble.durationEnd=!0),u>2*s.duration&&(l.bubble.clicking=!1,l.bubble.durationEnd=!1);const c={bubbleObj:{optValue:l.retina.bubbleModeSize,value:t.bubble.radius},particlesObj:{optValue:(0,e.getRangeMax)(t.options.size.value)*l.retina.pixelRatio,value:t.size.value},type:"size"};this.process(t,a,u,c);const d={bubbleObj:{optValue:s.opacity,value:t.bubble.opacity},particlesObj:{optValue:(0,e.getRangeMax)(t.options.opacity.value),value:null!==(o=null===(i=t.opacity)||void 0===i?void 0:i.value)&&void 0!==o?o:1},type:"opacity"};this.process(t,a,u,d),l.bubble.durationEnd?delete t.bubble.color:a<=r?this.hoverBubbleColor(t,a):delete t.bubble.color}}hoverBubble(t){const i=this.container,o=i.interactivity.mouse.position,l=i.retina.bubbleModeDistance;if(!l||l<0||void 0===o)return;const b=i.particles.quadTree.queryCircle(o,l,(e=>this.isEnabled(e)));for(const t of b){t.bubble.inRange=!0;const b=t.getPosition(),n=(0,e.getDistance)(b,o),s=1-n/l;n<=l?s>=0&&i.interactivity.status===e.mouseMoveEvent&&(this.hoverBubbleSize(t,s),this.hoverBubbleOpacity(t,s),this.hoverBubbleColor(t,s)):this.reset(t),i.interactivity.status===e.mouseLeaveEvent&&this.reset(t)}}hoverBubbleColor(t,i,o){const l=this.container.actualOptions,b=null!=o?o:l.interactivity.modes.bubble;if(b){if(!t.bubble.finalColor){const i=b.color;if(!i)return;const o=(0,e.itemFromSingleOrMultiple)(i);t.bubble.finalColor=(0,e.rangeColorToHsl)(o)}if(t.bubble.finalColor)if(b.mix){t.bubble.color=void 0;const o=t.getFillColor();t.bubble.color=o?(0,e.rgbToHsl)((0,e.colorMix)(o,t.bubble.finalColor,1-i,i)):t.bubble.finalColor}else t.bubble.color=t.bubble.finalColor}}hoverBubbleOpacity(t,i,o){var l,b,s,r;const a=this.container.actualOptions,u=null!==(l=null==o?void 0:o.opacity)&&void 0!==l?l:null===(b=a.interactivity.modes.bubble)||void 0===b?void 0:b.opacity;if(!u)return;const c=t.options.opacity.value,d=n(null!==(r=null===(s=t.opacity)||void 0===s?void 0:s.value)&&void 0!==r?r:1,u,(0,e.getRangeMax)(c),i);void 0!==d&&(t.bubble.opacity=d)}hoverBubbleSize(t,i,o){const l=this.container,b=(null==o?void 0:o.size)?o.size*l.retina.pixelRatio:l.retina.bubbleModeSize;if(void 0===b)return;const s=(0,e.getRangeMax)(t.options.size.value)*l.retina.pixelRatio,r=n(t.size.value,b,s,i);void 0!==r&&(t.bubble.radius=r)}process(e,t,i,o){const l=this.container,b=o.bubbleObj.optValue,n=l.actualOptions.interactivity.modes.bubble;if(!n||void 0===b)return;const s=n.duration,r=l.retina.bubbleModeDistance,a=o.particlesObj.optValue,u=o.bubbleObj.value,c=o.particlesObj.value||0,d=o.type;if(r&&!(r<0)&&b!==a)if(l.bubble||(l.bubble={}),l.bubble.durationEnd)u&&("size"===d&&delete e.bubble.radius,"opacity"===d&&delete e.bubble.opacity);else if(t<=r){if((null!=u?u:c)!==b){const t=c-i*(c-b)/s;"size"===d&&(e.bubble.radius=t),"opacity"===d&&(e.bubble.opacity=t)}}else"size"===d&&delete e.bubble.radius,"opacity"===d&&delete e.bubble.opacity}singleSelectorHover(t,i,o){const l=this.container,b=document.querySelectorAll(i),n=l.actualOptions.interactivity.modes.bubble;n&&b.length&&b.forEach((i=>{const b=i,s=l.retina.pixelRatio,r={x:(b.offsetLeft+b.offsetWidth/2)*s,y:(b.offsetTop+b.offsetHeight/2)*s},a=b.offsetWidth/2*s,u="circle"===o.type?new e.Circle(r.x,r.y,a):new e.Rectangle(b.offsetLeft*s,b.offsetTop*s,b.offsetWidth*s,b.offsetHeight*s),c=l.particles.quadTree.query(u,(e=>this.isEnabled(e)));for(const i of c){if(!u.contains(i.getPosition()))continue;i.bubble.inRange=!0;const o=n.divs,l=(0,e.divMode)(o,b);i.bubble.div&&i.bubble.div===b||(this.clear(i,t,!0),i.bubble.div=b),this.hoverBubbleSize(i,1,l),this.hoverBubbleOpacity(i,1,l),this.hoverBubbleColor(i,1,l)}}))}}async function r(e){await e.addInteractor("externalBubble",(e=>new s(e)))}})(),l})()));
2
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var i="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in i)("object"==typeof exports?exports:e)[o]=i[o]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},i={};function o(e){var b=i[e];if(void 0!==b)return b.exports;var n=i[e]={exports:{}};return t[e](n,n.exports,o),n.exports}o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var b={};return(()=>{o.r(b),o.d(b,{Bubble:()=>n,BubbleBase:()=>t,BubbleDiv:()=>i,loadExternalBubbleInteraction:()=>r});var e=o(533);class t{constructor(){this.distance=200,this.duration=.4,this.mix=!1}load(t){if(t){if(void 0!==t.distance&&(this.distance=t.distance),void 0!==t.duration&&(this.duration=t.duration),void 0!==t.mix&&(this.mix=t.mix),void 0!==t.opacity&&(this.opacity=t.opacity),void 0!==t.color){const i=(0,e.isArray)(this.color)?void 0:this.color;this.color=(0,e.executeOnSingleOrMultiple)(t.color,(t=>e.OptionsColor.create(i,t)))}void 0!==t.size&&(this.size=t.size)}}}class i extends t{constructor(){super(),this.selectors=[]}load(e){super.load(e),e&&void 0!==e.selectors&&(this.selectors=e.selectors)}}class n extends t{load(t){super.load(t),t&&(this.divs=(0,e.executeOnSingleOrMultiple)(t.divs,(e=>{const t=new i;return t.load(e),t})))}}function l(t,i,o,b){if(i>=o){const n=t+(i-o)*b;return(0,e.clamp)(n,t,i)}if(i<o){const n=t-(o-i)*b;return(0,e.clamp)(n,i,t)}}class s extends e.ExternalInteractorBase{constructor(t){super(t),this._clickBubble=()=>{const t=this.container,i=t.actualOptions,o=t.interactivity.mouse.clickPosition,b=i.interactivity.modes.bubble;if(!b||!o)return;t.bubble||(t.bubble={});const n=t.retina.bubbleModeDistance;if(!n||n<0)return;const l=t.particles.quadTree.queryCircle(o,n,(e=>this.isEnabled(e))),{bubble:s}=t;for(const i of l){if(!s.clicking)continue;i.bubble.inRange=!s.durationEnd;const l=i.getPosition(),r=(0,e.getDistance)(l,o),a=((new Date).getTime()-(t.interactivity.mouse.clickTime||0))/1e3;a>b.duration&&(s.durationEnd=!0),a>2*b.duration&&(s.clicking=!1,s.durationEnd=!1);const c={bubbleObj:{optValue:t.retina.bubbleModeSize,value:i.bubble.radius},particlesObj:{optValue:(0,e.getRangeMax)(i.options.size.value)*t.retina.pixelRatio,value:i.size.value},type:"size"};this._process(i,r,a,c);const u={bubbleObj:{optValue:b.opacity,value:i.bubble.opacity},particlesObj:{optValue:(0,e.getRangeMax)(i.options.opacity.value),value:i.opacity?.value??1},type:"opacity"};this._process(i,r,a,u),!s.durationEnd&&r<=n?this._hoverBubbleColor(i,r):delete i.bubble.color}},this._hoverBubble=()=>{const t=this.container,i=t.interactivity.mouse.position,o=t.retina.bubbleModeDistance;if(!o||o<0||void 0===i)return;const b=t.particles.quadTree.queryCircle(i,o,(e=>this.isEnabled(e)));for(const n of b){n.bubble.inRange=!0;const b=n.getPosition(),l=(0,e.getDistance)(b,i),s=1-l/o;l<=o?s>=0&&t.interactivity.status===e.mouseMoveEvent&&(this._hoverBubbleSize(n,s),this._hoverBubbleOpacity(n,s),this._hoverBubbleColor(n,s)):this.reset(n),t.interactivity.status===e.mouseLeaveEvent&&this.reset(n)}},this._hoverBubbleColor=(t,i,o)=>{const b=this.container.actualOptions,n=o??b.interactivity.modes.bubble;if(n){if(!t.bubble.finalColor){const i=n.color;if(!i)return;const o=(0,e.itemFromSingleOrMultiple)(i);t.bubble.finalColor=(0,e.rangeColorToHsl)(o)}if(t.bubble.finalColor)if(n.mix){t.bubble.color=void 0;const o=t.getFillColor();t.bubble.color=o?(0,e.rgbToHsl)((0,e.colorMix)(o,t.bubble.finalColor,1-i,i)):t.bubble.finalColor}else t.bubble.color=t.bubble.finalColor}},this._hoverBubbleOpacity=(t,i,o)=>{const b=this.container.actualOptions,n=o?.opacity??b.interactivity.modes.bubble?.opacity;if(!n)return;const s=t.options.opacity.value,r=l(t.opacity?.value??1,n,(0,e.getRangeMax)(s),i);void 0!==r&&(t.bubble.opacity=r)},this._hoverBubbleSize=(t,i,o)=>{const b=this.container,n=o?.size?o.size*b.retina.pixelRatio:b.retina.bubbleModeSize;if(void 0===n)return;const s=(0,e.getRangeMax)(t.options.size.value)*b.retina.pixelRatio,r=l(t.size.value,n,s,i);void 0!==r&&(t.bubble.radius=r)},this._process=(e,t,i,o)=>{const b=this.container,n=o.bubbleObj.optValue,l=b.actualOptions.interactivity.modes.bubble;if(!l||void 0===n)return;const s=l.duration,r=b.retina.bubbleModeDistance,a=o.particlesObj.optValue,c=o.bubbleObj.value,u=o.particlesObj.value||0,d=o.type;if(r&&!(r<0)&&n!==a)if(b.bubble||(b.bubble={}),b.bubble.durationEnd)c&&("size"===d&&delete e.bubble.radius,"opacity"===d&&delete e.bubble.opacity);else if(t<=r){if((c??u)!==n){const t=u-i*(u-n)/s;"size"===d&&(e.bubble.radius=t),"opacity"===d&&(e.bubble.opacity=t)}}else"size"===d&&delete e.bubble.radius,"opacity"===d&&delete e.bubble.opacity},this._singleSelectorHover=(t,i,o)=>{const b=this.container,n=document.querySelectorAll(i),l=b.actualOptions.interactivity.modes.bubble;l&&n.length&&n.forEach((i=>{const n=i,s=b.retina.pixelRatio,r={x:(n.offsetLeft+n.offsetWidth/2)*s,y:(n.offsetTop+n.offsetHeight/2)*s},a=n.offsetWidth/2*s,c="circle"===o.type?new e.Circle(r.x,r.y,a):new e.Rectangle(n.offsetLeft*s,n.offsetTop*s,n.offsetWidth*s,n.offsetHeight*s),u=b.particles.quadTree.query(c,(e=>this.isEnabled(e)));for(const i of u){if(!c.contains(i.getPosition()))continue;i.bubble.inRange=!0;const o=l.divs,b=(0,e.divMode)(o,n);i.bubble.div&&i.bubble.div===n||(this.clear(i,t,!0),i.bubble.div=n),this._hoverBubbleSize(i,1,b),this._hoverBubbleOpacity(i,1,b),this._hoverBubbleColor(i,1,b)}}))},t.bubble||(t.bubble={}),this.handleClickMode=e=>{"bubble"===e&&(t.bubble||(t.bubble={}),t.bubble.clicking=!0)}}clear(e,t,i){e.bubble.inRange&&!i||(delete e.bubble.div,delete e.bubble.opacity,delete e.bubble.radius,delete e.bubble.color)}init(){const e=this.container,t=e.actualOptions.interactivity.modes.bubble;t&&(e.retina.bubbleModeDistance=t.distance*e.retina.pixelRatio,void 0!==t.size&&(e.retina.bubbleModeSize=t.size*e.retina.pixelRatio))}async interact(t){const i=this.container.actualOptions.interactivity.events,o=i.onHover,b=i.onClick,n=o.enable,l=o.mode,s=b.enable,r=b.mode,a=i.onDiv;n&&(0,e.isInArray)("bubble",l)?this._hoverBubble():s&&(0,e.isInArray)("bubble",r)?this._clickBubble():(0,e.divModeExecute)("bubble",a,((e,i)=>this._singleSelectorHover(t,e,i)))}isEnabled(t){const i=this.container,o=i.actualOptions,b=i.interactivity.mouse,n=(t?.interactivity??o.interactivity).events,{onClick:l,onDiv:s,onHover:r}=n,a=(0,e.isDivModeEnabled)("bubble",s);return!!(a||r.enable&&b.position||l.enable&&b.clickPosition)&&((0,e.isInArray)("bubble",r.mode)||(0,e.isInArray)("bubble",l.mode)||a)}loadModeOptions(e,...t){e.bubble||(e.bubble=new n);for(const i of t)e.bubble.load(i?.bubble)}reset(e){e.bubble.inRange=!1}}async function r(e,t=!0){await e.addInteractor("externalBubble",(e=>new s(e)),t)}})(),b})()));
@@ -1,8 +1 @@
1
- /*!
2
- * Author : Matteo Bruni
3
- * MIT license: https://opensource.org/licenses/MIT
4
- * Demo / Generator : https://particles.js.org/
5
- * GitHub : https://www.github.com/matteobruni/tsparticles
6
- * How to use? : Check the GitHub README
7
- * v3.0.0-alpha.1
8
- */
1
+ /*! tsParticles Bubble External Interaction v3.0.0-beta.0 by Matteo Bruni */