@tsparticles/interaction-external-bubble 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.
@@ -1,6 +1,7 @@
1
1
  import { Circle, ExternalInteractorBase, Rectangle, colorMix, divMode, divModeExecute, getDistance, getRangeMax, isDivModeEnabled, isInArray, itemFromSingleOrMultiple, mouseLeaveEvent, mouseMoveEvent, rangeColorToHsl, rgbToHsl, } from "@tsparticles/engine";
2
2
  import { Bubble } from "./Options/Classes/Bubble.js";
3
3
  import { calculateBubbleValue } from "./Utils.js";
4
+ const bubbleMode = "bubble";
4
5
  export class Bubbler extends ExternalInteractorBase {
5
6
  constructor(container) {
6
7
  super(container);
@@ -210,7 +211,7 @@ export class Bubbler extends ExternalInteractorBase {
210
211
  container.bubble = {};
211
212
  }
212
213
  this.handleClickMode = (mode) => {
213
- if (mode !== "bubble") {
214
+ if (mode !== bubbleMode) {
214
215
  return;
215
216
  }
216
217
  if (!container.bubble) {
@@ -240,22 +241,22 @@ export class Bubbler extends ExternalInteractorBase {
240
241
  }
241
242
  async interact(delta) {
242
243
  const options = this.container.actualOptions, events = options.interactivity.events, onHover = events.onHover, onClick = events.onClick, hoverEnabled = onHover.enable, hoverMode = onHover.mode, clickEnabled = onClick.enable, clickMode = onClick.mode, divs = events.onDiv;
243
- if (hoverEnabled && isInArray("bubble", hoverMode)) {
244
+ if (hoverEnabled && isInArray(bubbleMode, hoverMode)) {
244
245
  this._hoverBubble();
245
246
  }
246
- else if (clickEnabled && isInArray("bubble", clickMode)) {
247
+ else if (clickEnabled && isInArray(bubbleMode, clickMode)) {
247
248
  this._clickBubble();
248
249
  }
249
250
  else {
250
- divModeExecute("bubble", divs, (selector, div) => this._singleSelectorHover(delta, selector, div));
251
+ divModeExecute(bubbleMode, divs, (selector, div) => this._singleSelectorHover(delta, selector, div));
251
252
  }
252
253
  }
253
254
  isEnabled(particle) {
254
- const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? options.interactivity).events, { onClick, onDiv, onHover } = events, divBubble = isDivModeEnabled("bubble", onDiv);
255
+ const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? options.interactivity).events, { onClick, onDiv, onHover } = events, divBubble = isDivModeEnabled(bubbleMode, onDiv);
255
256
  if (!(divBubble || (onHover.enable && mouse.position) || (onClick.enable && mouse.clickPosition))) {
256
257
  return false;
257
258
  }
258
- return isInArray("bubble", onHover.mode) || isInArray("bubble", onClick.mode) || divBubble;
259
+ return isInArray(bubbleMode, onHover.mode) || isInArray(bubbleMode, onClick.mode) || divBubble;
259
260
  }
260
261
  loadModeOptions(options, ...sources) {
261
262
  if (!options.bubble) {
package/cjs/Bubbler.js CHANGED
@@ -4,6 +4,7 @@ exports.Bubbler = void 0;
4
4
  const engine_1 = require("@tsparticles/engine");
5
5
  const Bubble_js_1 = require("./Options/Classes/Bubble.js");
6
6
  const Utils_js_1 = require("./Utils.js");
7
+ const bubbleMode = "bubble";
7
8
  class Bubbler extends engine_1.ExternalInteractorBase {
8
9
  constructor(container) {
9
10
  super(container);
@@ -213,7 +214,7 @@ class Bubbler extends engine_1.ExternalInteractorBase {
213
214
  container.bubble = {};
214
215
  }
215
216
  this.handleClickMode = (mode) => {
216
- if (mode !== "bubble") {
217
+ if (mode !== bubbleMode) {
217
218
  return;
218
219
  }
219
220
  if (!container.bubble) {
@@ -243,22 +244,22 @@ class Bubbler extends engine_1.ExternalInteractorBase {
243
244
  }
244
245
  async interact(delta) {
245
246
  const options = this.container.actualOptions, events = options.interactivity.events, onHover = events.onHover, onClick = events.onClick, hoverEnabled = onHover.enable, hoverMode = onHover.mode, clickEnabled = onClick.enable, clickMode = onClick.mode, divs = events.onDiv;
246
- if (hoverEnabled && (0, engine_1.isInArray)("bubble", hoverMode)) {
247
+ if (hoverEnabled && (0, engine_1.isInArray)(bubbleMode, hoverMode)) {
247
248
  this._hoverBubble();
248
249
  }
249
- else if (clickEnabled && (0, engine_1.isInArray)("bubble", clickMode)) {
250
+ else if (clickEnabled && (0, engine_1.isInArray)(bubbleMode, clickMode)) {
250
251
  this._clickBubble();
251
252
  }
252
253
  else {
253
- (0, engine_1.divModeExecute)("bubble", divs, (selector, div) => this._singleSelectorHover(delta, selector, div));
254
+ (0, engine_1.divModeExecute)(bubbleMode, divs, (selector, div) => this._singleSelectorHover(delta, selector, div));
254
255
  }
255
256
  }
256
257
  isEnabled(particle) {
257
- const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? options.interactivity).events, { onClick, onDiv, onHover } = events, divBubble = (0, engine_1.isDivModeEnabled)("bubble", onDiv);
258
+ const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? options.interactivity).events, { onClick, onDiv, onHover } = events, divBubble = (0, engine_1.isDivModeEnabled)(bubbleMode, onDiv);
258
259
  if (!(divBubble || (onHover.enable && mouse.position) || (onClick.enable && mouse.clickPosition))) {
259
260
  return false;
260
261
  }
261
- return (0, engine_1.isInArray)("bubble", onHover.mode) || (0, engine_1.isInArray)("bubble", onClick.mode) || divBubble;
262
+ return (0, engine_1.isInArray)(bubbleMode, onHover.mode) || (0, engine_1.isInArray)(bubbleMode, onClick.mode) || divBubble;
262
263
  }
263
264
  loadModeOptions(options, ...sources) {
264
265
  if (!options.bubble) {
package/esm/Bubbler.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Circle, ExternalInteractorBase, Rectangle, colorMix, divMode, divModeExecute, getDistance, getRangeMax, isDivModeEnabled, isInArray, itemFromSingleOrMultiple, mouseLeaveEvent, mouseMoveEvent, rangeColorToHsl, rgbToHsl, } from "@tsparticles/engine";
2
2
  import { Bubble } from "./Options/Classes/Bubble.js";
3
3
  import { calculateBubbleValue } from "./Utils.js";
4
+ const bubbleMode = "bubble";
4
5
  export class Bubbler extends ExternalInteractorBase {
5
6
  constructor(container) {
6
7
  super(container);
@@ -210,7 +211,7 @@ export class Bubbler extends ExternalInteractorBase {
210
211
  container.bubble = {};
211
212
  }
212
213
  this.handleClickMode = (mode) => {
213
- if (mode !== "bubble") {
214
+ if (mode !== bubbleMode) {
214
215
  return;
215
216
  }
216
217
  if (!container.bubble) {
@@ -240,22 +241,22 @@ export class Bubbler extends ExternalInteractorBase {
240
241
  }
241
242
  async interact(delta) {
242
243
  const options = this.container.actualOptions, events = options.interactivity.events, onHover = events.onHover, onClick = events.onClick, hoverEnabled = onHover.enable, hoverMode = onHover.mode, clickEnabled = onClick.enable, clickMode = onClick.mode, divs = events.onDiv;
243
- if (hoverEnabled && isInArray("bubble", hoverMode)) {
244
+ if (hoverEnabled && isInArray(bubbleMode, hoverMode)) {
244
245
  this._hoverBubble();
245
246
  }
246
- else if (clickEnabled && isInArray("bubble", clickMode)) {
247
+ else if (clickEnabled && isInArray(bubbleMode, clickMode)) {
247
248
  this._clickBubble();
248
249
  }
249
250
  else {
250
- divModeExecute("bubble", divs, (selector, div) => this._singleSelectorHover(delta, selector, div));
251
+ divModeExecute(bubbleMode, divs, (selector, div) => this._singleSelectorHover(delta, selector, div));
251
252
  }
252
253
  }
253
254
  isEnabled(particle) {
254
- const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? options.interactivity).events, { onClick, onDiv, onHover } = events, divBubble = isDivModeEnabled("bubble", onDiv);
255
+ const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? options.interactivity).events, { onClick, onDiv, onHover } = events, divBubble = isDivModeEnabled(bubbleMode, onDiv);
255
256
  if (!(divBubble || (onHover.enable && mouse.position) || (onClick.enable && mouse.clickPosition))) {
256
257
  return false;
257
258
  }
258
- return isInArray("bubble", onHover.mode) || isInArray("bubble", onClick.mode) || divBubble;
259
+ return isInArray(bubbleMode, onHover.mode) || isInArray(bubbleMode, onClick.mode) || divBubble;
259
260
  }
260
261
  loadModeOptions(options, ...sources) {
261
262
  if (!options.bubble) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/interaction-external-bubble",
3
- "version": "3.0.0-beta.3",
3
+ "version": "3.0.0-beta.4",
4
4
  "description": "tsParticles bubble external 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"