@tsparticles/interaction-external-bubble 3.0.0-beta.3 → 3.0.0-beta.5
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/browser/Bubbler.js +7 -6
- package/cjs/Bubbler.js +7 -6
- package/esm/Bubbler.js +7 -6
- package/package.json +3 -3
- package/report.html +4 -22
- package/tsparticles.interaction.external.bubble.js +8 -7
- package/tsparticles.interaction.external.bubble.min.js +1 -1
- package/tsparticles.interaction.external.bubble.min.js.LICENSE.txt +1 -1
- package/types/Bubbler.d.ts +2 -2
- package/umd/Bubbler.js +7 -6
package/browser/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 !==
|
|
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(
|
|
244
|
+
if (hoverEnabled && isInArray(bubbleMode, hoverMode)) {
|
|
244
245
|
this._hoverBubble();
|
|
245
246
|
}
|
|
246
|
-
else if (clickEnabled && isInArray(
|
|
247
|
+
else if (clickEnabled && isInArray(bubbleMode, clickMode)) {
|
|
247
248
|
this._clickBubble();
|
|
248
249
|
}
|
|
249
250
|
else {
|
|
250
|
-
divModeExecute(
|
|
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(
|
|
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(
|
|
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 !==
|
|
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)(
|
|
247
|
+
if (hoverEnabled && (0, engine_1.isInArray)(bubbleMode, hoverMode)) {
|
|
247
248
|
this._hoverBubble();
|
|
248
249
|
}
|
|
249
|
-
else if (clickEnabled && (0, engine_1.isInArray)(
|
|
250
|
+
else if (clickEnabled && (0, engine_1.isInArray)(bubbleMode, clickMode)) {
|
|
250
251
|
this._clickBubble();
|
|
251
252
|
}
|
|
252
253
|
else {
|
|
253
|
-
(0, engine_1.divModeExecute)(
|
|
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)(
|
|
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)(
|
|
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 !==
|
|
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(
|
|
244
|
+
if (hoverEnabled && isInArray(bubbleMode, hoverMode)) {
|
|
244
245
|
this._hoverBubble();
|
|
245
246
|
}
|
|
246
|
-
else if (clickEnabled && isInArray(
|
|
247
|
+
else if (clickEnabled && isInArray(bubbleMode, clickMode)) {
|
|
247
248
|
this._clickBubble();
|
|
248
249
|
}
|
|
249
250
|
else {
|
|
250
|
-
divModeExecute(
|
|
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(
|
|
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(
|
|
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
|
+
"version": "3.0.0-beta.5",
|
|
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
|
-
"
|
|
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.
|
|
90
|
+
"@tsparticles/engine": "^3.0.0-beta.5"
|
|
91
91
|
},
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|