@tsparticles/interaction-external-grab 4.0.0-alpha.3 → 4.0.0-alpha.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.
- package/557.min.js +2 -0
- package/557.min.js.LICENSE.txt +1 -0
- package/browser/Grabber.js +11 -10
- package/browser/index.js +5 -3
- package/cjs/Grabber.js +11 -10
- package/cjs/index.js +5 -3
- package/dist_browser_Grabber_js.js +2 -2
- package/esm/Grabber.js +11 -10
- package/esm/index.js +5 -3
- package/package.json +3 -2
- package/report.html +1 -1
- package/tsparticles.interaction.external.grab.js +48 -20
- package/tsparticles.interaction.external.grab.min.js +1 -1
- package/tsparticles.interaction.external.grab.min.js.LICENSE.txt +1 -1
- package/types/Grabber.d.ts +4 -3
- package/types/Options/Classes/GrabOptions.d.ts +3 -3
- package/types/Types.d.ts +4 -3
- package/umd/Grabber.js +12 -11
- package/umd/index.js +6 -4
- package/346.min.js +0 -2
- package/346.min.js.LICENSE.txt +0 -1
package/557.min.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 557.min.js.LICENSE.txt */
|
|
2
|
+
(this.webpackChunk_tsparticles_interaction_external_grab=this.webpackChunk_tsparticles_interaction_external_grab||[]).push([[557],{557(t,n,e){e.d(n,{Grabber:()=>a});var i=e(303),o=e(702),r=e(583);function s(t,n,e,o,r){t.canvas.draw((s=>{const a=n.getPosition();!function(t,n,e,o,r,s,a=!1){(0,i.drawLine)(t,e,o),t.strokeStyle=(0,i.getStyleFromRgb)(r,a,s),t.lineWidth=n,t.stroke()}(s,n.retina.linksWidth??0,a,r,e,o,t.hdr)}))}class a extends o.ExternalInteractorBase{constructor(t,n){super(t),this._engine=n}clear(){}init(){const t=this.container,n=t.actualOptions.interactivity?.modes.grab;n&&(t.retina.grabModeDistance=n.distance*t.retina.pixelRatio)}interact(t){const n=this.container,e=n.actualOptions.interactivity;if(!e?.modes.grab||!e.events.onHover.enable||t.status!==o.mouseMoveEvent)return;const r=t.mouse.position;if(!r)return;const a=n.retina.grabModeDistance;if(!a||a<0)return;const c=n.particles.quadTree.queryCircle(r,a,(n=>this.isEnabled(t,n)));for(const t of c){const o=t.getPosition(),c=(0,i.getDistance)(o,r);if(c>a)continue;const l=e.modes.grab.links,b=l.opacity,g=b-c*b/a;if(g<=0)continue;const d=l.color??t.options.links?.color;if(!n.particles.grabLineColor&&d){const t=e.modes.grab.links;n.particles.grabLineColor=(0,i.getLinkRandomColor)(this._engine,d,t.blink,t.consent)}const u=(0,i.getLinkColor)(t,void 0,n.particles.grabLineColor);u&&s(n,t,u,g,r)}}isEnabled(t,n){const e=this.container,o=t.mouse,r=(n?.interactivity??e.actualOptions.interactivity)?.events;return!!r?.onHover.enable&&!!o.position&&(0,i.isInArray)("grab",r.onHover.mode)}loadModeOptions(t,...n){t.grab??=new r.f;for(const e of n)t.grab.load(e?.grab)}reset(){}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tsParticles Grab External Interaction v4.0.0-alpha.4 by Matteo Bruni */
|
package/browser/Grabber.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getDistance, getLinkColor, getLinkRandomColor, isInArray, } from "@tsparticles/engine";
|
|
2
|
+
import { ExternalInteractorBase, mouseMoveEvent, } from "@tsparticles/plugin-interactivity";
|
|
2
3
|
import { Grab } from "./Options/Classes/Grab.js";
|
|
3
4
|
import { drawGrab } from "./Utils.js";
|
|
4
5
|
const grabMode = "grab", minDistance = 0, minOpacity = 0;
|
|
@@ -10,20 +11,20 @@ export class Grabber extends ExternalInteractorBase {
|
|
|
10
11
|
clear() {
|
|
11
12
|
}
|
|
12
13
|
init() {
|
|
13
|
-
const container = this.container, grab = container.actualOptions.interactivity
|
|
14
|
+
const container = this.container, grab = container.actualOptions.interactivity?.modes.grab;
|
|
14
15
|
if (!grab) {
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
17
18
|
container.retina.grabModeDistance = grab.distance * container.retina.pixelRatio;
|
|
18
19
|
}
|
|
19
|
-
interact() {
|
|
20
|
+
interact(interactivityData) {
|
|
20
21
|
const container = this.container, options = container.actualOptions, interactivity = options.interactivity;
|
|
21
|
-
if (!interactivity
|
|
22
|
+
if (!interactivity?.modes.grab ||
|
|
22
23
|
!interactivity.events.onHover.enable ||
|
|
23
|
-
|
|
24
|
+
interactivityData.status !== mouseMoveEvent) {
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
26
|
-
const mousePos =
|
|
27
|
+
const mousePos = interactivityData.mouse.position;
|
|
27
28
|
if (!mousePos) {
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
@@ -31,7 +32,7 @@ export class Grabber extends ExternalInteractorBase {
|
|
|
31
32
|
if (!distance || distance < minDistance) {
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
34
|
-
const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));
|
|
35
|
+
const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(interactivityData, p));
|
|
35
36
|
for (const particle of query) {
|
|
36
37
|
const pos = particle.getPosition(), pointDistance = getDistance(pos, mousePos);
|
|
37
38
|
if (pointDistance > distance) {
|
|
@@ -53,9 +54,9 @@ export class Grabber extends ExternalInteractorBase {
|
|
|
53
54
|
drawGrab(container, particle, colorLine, opacityLine, mousePos);
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
isEnabled(particle) {
|
|
57
|
-
const container = this.container, mouse =
|
|
58
|
-
return events
|
|
57
|
+
isEnabled(interactivityData, particle) {
|
|
58
|
+
const container = this.container, mouse = interactivityData.mouse, events = (particle?.interactivity ?? container.actualOptions.interactivity)?.events;
|
|
59
|
+
return !!events?.onHover.enable && !!mouse.position && isInArray(grabMode, events.onHover.mode);
|
|
59
60
|
}
|
|
60
61
|
loadModeOptions(options, ...sources) {
|
|
61
62
|
options.grab ??= new Grab();
|
package/browser/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export function loadExternalGrabInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
3
|
-
engine.register(e => {
|
|
4
|
-
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.4");
|
|
3
|
+
engine.register(async (e) => {
|
|
4
|
+
const { loadInteractivityPlugin } = await import("@tsparticles/plugin-interactivity");
|
|
5
|
+
loadInteractivityPlugin(e);
|
|
6
|
+
e.addInteractor?.("externalGrab", async (container) => {
|
|
5
7
|
const { Grabber } = await import("./Grabber.js");
|
|
6
8
|
return new Grabber(container, engine);
|
|
7
9
|
});
|
package/cjs/Grabber.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getDistance, getLinkColor, getLinkRandomColor, isInArray, } from "@tsparticles/engine";
|
|
2
|
+
import { ExternalInteractorBase, mouseMoveEvent, } from "@tsparticles/plugin-interactivity";
|
|
2
3
|
import { Grab } from "./Options/Classes/Grab.js";
|
|
3
4
|
import { drawGrab } from "./Utils.js";
|
|
4
5
|
const grabMode = "grab", minDistance = 0, minOpacity = 0;
|
|
@@ -10,20 +11,20 @@ export class Grabber extends ExternalInteractorBase {
|
|
|
10
11
|
clear() {
|
|
11
12
|
}
|
|
12
13
|
init() {
|
|
13
|
-
const container = this.container, grab = container.actualOptions.interactivity
|
|
14
|
+
const container = this.container, grab = container.actualOptions.interactivity?.modes.grab;
|
|
14
15
|
if (!grab) {
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
17
18
|
container.retina.grabModeDistance = grab.distance * container.retina.pixelRatio;
|
|
18
19
|
}
|
|
19
|
-
interact() {
|
|
20
|
+
interact(interactivityData) {
|
|
20
21
|
const container = this.container, options = container.actualOptions, interactivity = options.interactivity;
|
|
21
|
-
if (!interactivity
|
|
22
|
+
if (!interactivity?.modes.grab ||
|
|
22
23
|
!interactivity.events.onHover.enable ||
|
|
23
|
-
|
|
24
|
+
interactivityData.status !== mouseMoveEvent) {
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
26
|
-
const mousePos =
|
|
27
|
+
const mousePos = interactivityData.mouse.position;
|
|
27
28
|
if (!mousePos) {
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
@@ -31,7 +32,7 @@ export class Grabber extends ExternalInteractorBase {
|
|
|
31
32
|
if (!distance || distance < minDistance) {
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
34
|
-
const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));
|
|
35
|
+
const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(interactivityData, p));
|
|
35
36
|
for (const particle of query) {
|
|
36
37
|
const pos = particle.getPosition(), pointDistance = getDistance(pos, mousePos);
|
|
37
38
|
if (pointDistance > distance) {
|
|
@@ -53,9 +54,9 @@ export class Grabber extends ExternalInteractorBase {
|
|
|
53
54
|
drawGrab(container, particle, colorLine, opacityLine, mousePos);
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
isEnabled(particle) {
|
|
57
|
-
const container = this.container, mouse =
|
|
58
|
-
return events
|
|
57
|
+
isEnabled(interactivityData, particle) {
|
|
58
|
+
const container = this.container, mouse = interactivityData.mouse, events = (particle?.interactivity ?? container.actualOptions.interactivity)?.events;
|
|
59
|
+
return !!events?.onHover.enable && !!mouse.position && isInArray(grabMode, events.onHover.mode);
|
|
59
60
|
}
|
|
60
61
|
loadModeOptions(options, ...sources) {
|
|
61
62
|
options.grab ??= new Grab();
|
package/cjs/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export function loadExternalGrabInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
3
|
-
engine.register(e => {
|
|
4
|
-
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.4");
|
|
3
|
+
engine.register(async (e) => {
|
|
4
|
+
const { loadInteractivityPlugin } = await import("@tsparticles/plugin-interactivity");
|
|
5
|
+
loadInteractivityPlugin(e);
|
|
6
|
+
e.addInteractor?.("externalGrab", async (container) => {
|
|
5
7
|
const { Grabber } = await import("./Grabber.js");
|
|
6
8
|
return new Grabber(container, engine);
|
|
7
9
|
});
|
|
@@ -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
|
-
* v4.0.0-alpha.
|
|
7
|
+
* v4.0.0-alpha.4
|
|
8
8
|
*/
|
|
9
9
|
"use strict";
|
|
10
10
|
/*
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
\*********************************/
|
|
24
24
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
25
|
|
|
26
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Grabber: () => (/* binding */ Grabber)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var
|
|
26
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Grabber: () => (/* binding */ Grabber)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\");\n/* harmony import */ var _Options_Classes_Grab_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Grab.js */ \"./dist/browser/Options/Classes/Grab.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\n\nconst grabMode = \"grab\",\n minDistance = 0,\n minOpacity = 0;\nclass Grabber extends _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_1__.ExternalInteractorBase {\n constructor(container, engine) {\n super(container);\n this._engine = engine;\n }\n clear() {}\n init() {\n const container = this.container,\n grab = container.actualOptions.interactivity?.modes.grab;\n if (!grab) {\n return;\n }\n container.retina.grabModeDistance = grab.distance * container.retina.pixelRatio;\n }\n interact(interactivityData) {\n const container = this.container,\n options = container.actualOptions,\n interactivity = options.interactivity;\n if (!interactivity?.modes.grab || !interactivity.events.onHover.enable || interactivityData.status !== _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_1__.mouseMoveEvent) {\n return;\n }\n const mousePos = interactivityData.mouse.position;\n if (!mousePos) {\n return;\n }\n const distance = container.retina.grabModeDistance;\n if (!distance || distance < minDistance) {\n return;\n }\n const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(interactivityData, p));\n for (const particle of query) {\n const pos = particle.getPosition(),\n pointDistance = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(pos, mousePos);\n if (pointDistance > distance) {\n continue;\n }\n const grabLineOptions = interactivity.modes.grab.links,\n lineOpacity = grabLineOptions.opacity,\n opacityLine = lineOpacity - pointDistance * lineOpacity / distance;\n if (opacityLine <= minOpacity) {\n continue;\n }\n const optColor = grabLineOptions.color ?? particle.options.links?.color;\n if (!container.particles.grabLineColor && optColor) {\n const linksOptions = interactivity.modes.grab.links;\n container.particles.grabLineColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getLinkRandomColor)(this._engine, optColor, linksOptions.blink, linksOptions.consent);\n }\n const colorLine = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getLinkColor)(particle, undefined, container.particles.grabLineColor);\n if (!colorLine) {\n continue;\n }\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_3__.drawGrab)(container, particle, colorLine, opacityLine, mousePos);\n }\n }\n isEnabled(interactivityData, particle) {\n const container = this.container,\n mouse = interactivityData.mouse,\n events = (particle?.interactivity ?? container.actualOptions.interactivity)?.events;\n return !!events?.onHover.enable && !!mouse.position && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(grabMode, events.onHover.mode);\n }\n loadModeOptions(options, ...sources) {\n options.grab ??= new _Options_Classes_Grab_js__WEBPACK_IMPORTED_MODULE_2__.Grab();\n for (const source of sources) {\n options.grab.load(source?.grab);\n }\n }\n reset() {}\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-grab/./dist/browser/Grabber.js?\n}");
|
|
27
27
|
|
|
28
28
|
/***/ },
|
|
29
29
|
|
package/esm/Grabber.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getDistance, getLinkColor, getLinkRandomColor, isInArray, } from "@tsparticles/engine";
|
|
2
|
+
import { ExternalInteractorBase, mouseMoveEvent, } from "@tsparticles/plugin-interactivity";
|
|
2
3
|
import { Grab } from "./Options/Classes/Grab.js";
|
|
3
4
|
import { drawGrab } from "./Utils.js";
|
|
4
5
|
const grabMode = "grab", minDistance = 0, minOpacity = 0;
|
|
@@ -10,20 +11,20 @@ export class Grabber extends ExternalInteractorBase {
|
|
|
10
11
|
clear() {
|
|
11
12
|
}
|
|
12
13
|
init() {
|
|
13
|
-
const container = this.container, grab = container.actualOptions.interactivity
|
|
14
|
+
const container = this.container, grab = container.actualOptions.interactivity?.modes.grab;
|
|
14
15
|
if (!grab) {
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
17
18
|
container.retina.grabModeDistance = grab.distance * container.retina.pixelRatio;
|
|
18
19
|
}
|
|
19
|
-
interact() {
|
|
20
|
+
interact(interactivityData) {
|
|
20
21
|
const container = this.container, options = container.actualOptions, interactivity = options.interactivity;
|
|
21
|
-
if (!interactivity
|
|
22
|
+
if (!interactivity?.modes.grab ||
|
|
22
23
|
!interactivity.events.onHover.enable ||
|
|
23
|
-
|
|
24
|
+
interactivityData.status !== mouseMoveEvent) {
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
26
|
-
const mousePos =
|
|
27
|
+
const mousePos = interactivityData.mouse.position;
|
|
27
28
|
if (!mousePos) {
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
@@ -31,7 +32,7 @@ export class Grabber extends ExternalInteractorBase {
|
|
|
31
32
|
if (!distance || distance < minDistance) {
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
34
|
-
const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));
|
|
35
|
+
const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(interactivityData, p));
|
|
35
36
|
for (const particle of query) {
|
|
36
37
|
const pos = particle.getPosition(), pointDistance = getDistance(pos, mousePos);
|
|
37
38
|
if (pointDistance > distance) {
|
|
@@ -53,9 +54,9 @@ export class Grabber extends ExternalInteractorBase {
|
|
|
53
54
|
drawGrab(container, particle, colorLine, opacityLine, mousePos);
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
isEnabled(particle) {
|
|
57
|
-
const container = this.container, mouse =
|
|
58
|
-
return events
|
|
57
|
+
isEnabled(interactivityData, particle) {
|
|
58
|
+
const container = this.container, mouse = interactivityData.mouse, events = (particle?.interactivity ?? container.actualOptions.interactivity)?.events;
|
|
59
|
+
return !!events?.onHover.enable && !!mouse.position && isInArray(grabMode, events.onHover.mode);
|
|
59
60
|
}
|
|
60
61
|
loadModeOptions(options, ...sources) {
|
|
61
62
|
options.grab ??= new Grab();
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export function loadExternalGrabInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
3
|
-
engine.register(e => {
|
|
4
|
-
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.4");
|
|
3
|
+
engine.register(async (e) => {
|
|
4
|
+
const { loadInteractivityPlugin } = await import("@tsparticles/plugin-interactivity");
|
|
5
|
+
loadInteractivityPlugin(e);
|
|
6
|
+
e.addInteractor?.("externalGrab", async (container) => {
|
|
5
7
|
const { Grabber } = await import("./Grabber.js");
|
|
6
8
|
return new Grabber(container, engine);
|
|
7
9
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-external-grab",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.4",
|
|
4
4
|
"description": "tsParticles grab external interaction",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -87,7 +87,8 @@
|
|
|
87
87
|
"./package.json": "./package.json"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@tsparticles/engine": "4.0.0-alpha.
|
|
90
|
+
"@tsparticles/engine": "4.0.0-alpha.4",
|
|
91
|
+
"@tsparticles/plugin-interactivity": "4.0.0-alpha.4"
|
|
91
92
|
},
|
|
92
93
|
"publishConfig": {
|
|
93
94
|
"access": "public"
|
package/report.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8"/>
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
6
|
-
<title>@tsparticles/interaction-external-grab [
|
|
6
|
+
<title>@tsparticles/interaction-external-grab [21 Jan 2026 at 14:43]</title>
|
|
7
7
|
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX5VutmxeNnWDjjswTKTyfgluNDGbUpWissXhF3s7mlSml+czWkg3D0l1nNjGNjz3myOQOa1KM/jOS6ebdbAVTCi4gljHSFrviza7tOgRWcS0MOUX9zdNgag5w7rRqA44Lzw0hr1WqES36dFliSJFlh2rXIae3FFcDDgKdxrUIDePr8jGcSClV1u7A9xeN0ModY/pHMxmR1EzRh8TJiwqsHmKW0l4FCEZI+jHio+JdPPE9qwQtTRxku2D8sIeRL2LnxWSllANCQGOIiqVHAz2ye2JR0DcH+HoxDkaADLjgxjKQ+AwCX/g0+DNgdG0ukYCONAe+dbc2IAc6fwt1ARoDSezNHxV2Cmzwv3O6lDMV55edBGwGK9n1+x2F8EDfAGCxug8MhpsMEcTEAWf3rx2vZhe/LAmtIn/6apE6PN0ULKgywD9mmdxbmFl3OvD5AS5fW5zLbv/YHmcsBTjf/afDz3MaZTVCfAP9z6/Bw6ycv8EUBWJIn9zYcoAWWlW9+OzO3vkTy8H+RANLmdrpOuYWdZYEXpo+TlCJrW5EARb7fF+bWdqf3hhyZI1nWJQHgznErZhbjoEsWqi8dQNoE294aldzFurwSABL2XXMf9+H1VQGke9exw5P/AnA5Pv5ngMul7LOvO922iwACu8WkCwLCafvM4CeWPxfA8lNHcWZSoi8EwMAIciKX2Z4SWCMAa3snCZ/G4EA8D6CMLNFsGQhkkz/gQNEBbPCbWsxGUpYVu3z8IyNAknwJkfPMEhLyrdi5RTyUVACkw4GSFRNWJNEW+fgPGwHD8/JxnRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
|
|
8
8
|
|
|
9
9
|
<script>
|
|
@@ -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
|
-
* v4.0.0-alpha.
|
|
7
|
+
* v4.0.0-alpha.4
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
*/
|
|
17
17
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
18
18
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
19
|
-
module.exports = factory(require("@tsparticles/engine"));
|
|
19
|
+
module.exports = factory(require("@tsparticles/engine"), require("@tsparticles/plugin-interactivity"));
|
|
20
20
|
else if(typeof define === 'function' && define.amd)
|
|
21
|
-
define(["@tsparticles/engine"], factory);
|
|
21
|
+
define(["@tsparticles/engine", "@tsparticles/plugin-interactivity"], factory);
|
|
22
22
|
else {
|
|
23
|
-
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
|
|
23
|
+
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine"), require("@tsparticles/plugin-interactivity")) : factory(root["window"], root["window"]);
|
|
24
24
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
25
25
|
}
|
|
26
|
-
})(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__) => {
|
|
26
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__, __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__) => {
|
|
27
27
|
return /******/ (() => { // webpackBootstrap
|
|
28
28
|
/******/ "use strict";
|
|
29
29
|
/******/ var __webpack_modules__ = ({
|
|
@@ -54,7 +54,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
54
54
|
\*******************************/
|
|
55
55
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
56
56
|
|
|
57
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Grab: () => (/* reexport safe */ _Options_Classes_Grab_js__WEBPACK_IMPORTED_MODULE_0__.Grab),\n/* harmony export */ GrabLinks: () => (/* reexport safe */ _Options_Classes_GrabLinks_js__WEBPACK_IMPORTED_MODULE_1__.GrabLinks),\n/* harmony export */ loadExternalGrabInteraction: () => (/* binding */ loadExternalGrabInteraction)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_Grab_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/Grab.js */ \"./dist/browser/Options/Classes/Grab.js\");\n/* harmony import */ var _Options_Classes_GrabLinks_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/GrabLinks.js */ \"./dist/browser/Options/Classes/GrabLinks.js\");\nfunction loadExternalGrabInteraction(engine) {\n engine.checkVersion(\"4.0.0-alpha.
|
|
57
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Grab: () => (/* reexport safe */ _Options_Classes_Grab_js__WEBPACK_IMPORTED_MODULE_0__.Grab),\n/* harmony export */ GrabLinks: () => (/* reexport safe */ _Options_Classes_GrabLinks_js__WEBPACK_IMPORTED_MODULE_1__.GrabLinks),\n/* harmony export */ loadExternalGrabInteraction: () => (/* binding */ loadExternalGrabInteraction)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_Grab_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/Grab.js */ \"./dist/browser/Options/Classes/Grab.js\");\n/* harmony import */ var _Options_Classes_GrabLinks_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/GrabLinks.js */ \"./dist/browser/Options/Classes/GrabLinks.js\");\nfunction loadExternalGrabInteraction(engine) {\n engine.checkVersion(\"4.0.0-alpha.4\");\n engine.register(async e => {\n const {\n loadInteractivityPlugin\n } = await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\", 19));\n loadInteractivityPlugin(e);\n e.addInteractor?.(\"externalGrab\", async container => {\n const {\n Grabber\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_Grabber_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./Grabber.js */ \"./dist/browser/Grabber.js\"));\n return new Grabber(container, engine);\n });\n });\n}\n\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-grab/./dist/browser/index.js?\n}");
|
|
58
58
|
|
|
59
59
|
/***/ },
|
|
60
60
|
|
|
@@ -66,6 +66,16 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
66
66
|
|
|
67
67
|
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
68
68
|
|
|
69
|
+
/***/ },
|
|
70
|
+
|
|
71
|
+
/***/ "@tsparticles/plugin-interactivity"
|
|
72
|
+
/*!***************************************************************************************************************************************************************************!*\
|
|
73
|
+
!*** external {"commonjs":"@tsparticles/plugin-interactivity","commonjs2":"@tsparticles/plugin-interactivity","amd":"@tsparticles/plugin-interactivity","root":"window"} ***!
|
|
74
|
+
\***************************************************************************************************************************************************************************/
|
|
75
|
+
(module) {
|
|
76
|
+
|
|
77
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
78
|
+
|
|
69
79
|
/***/ }
|
|
70
80
|
|
|
71
81
|
/******/ });
|
|
@@ -104,6 +114,36 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
104
114
|
/******/ __webpack_require__.m = __webpack_modules__;
|
|
105
115
|
/******/
|
|
106
116
|
/************************************************************************/
|
|
117
|
+
/******/ /* webpack/runtime/create fake namespace object */
|
|
118
|
+
/******/ (() => {
|
|
119
|
+
/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
|
|
120
|
+
/******/ var leafPrototypes;
|
|
121
|
+
/******/ // create a fake namespace object
|
|
122
|
+
/******/ // mode & 1: value is a module id, require it
|
|
123
|
+
/******/ // mode & 2: merge all properties of value into the ns
|
|
124
|
+
/******/ // mode & 4: return value when already ns object
|
|
125
|
+
/******/ // mode & 16: return value when it's Promise-like
|
|
126
|
+
/******/ // mode & 8|1: behave like require
|
|
127
|
+
/******/ __webpack_require__.t = function(value, mode) {
|
|
128
|
+
/******/ if(mode & 1) value = this(value);
|
|
129
|
+
/******/ if(mode & 8) return value;
|
|
130
|
+
/******/ if(typeof value === 'object' && value) {
|
|
131
|
+
/******/ if((mode & 4) && value.__esModule) return value;
|
|
132
|
+
/******/ if((mode & 16) && typeof value.then === 'function') return value;
|
|
133
|
+
/******/ }
|
|
134
|
+
/******/ var ns = Object.create(null);
|
|
135
|
+
/******/ __webpack_require__.r(ns);
|
|
136
|
+
/******/ var def = {};
|
|
137
|
+
/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
|
|
138
|
+
/******/ for(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) {
|
|
139
|
+
/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
|
|
140
|
+
/******/ }
|
|
141
|
+
/******/ def['default'] = () => (value);
|
|
142
|
+
/******/ __webpack_require__.d(ns, def);
|
|
143
|
+
/******/ return ns;
|
|
144
|
+
/******/ };
|
|
145
|
+
/******/ })();
|
|
146
|
+
/******/
|
|
107
147
|
/******/ /* webpack/runtime/define property getters */
|
|
108
148
|
/******/ (() => {
|
|
109
149
|
/******/ // define getter functions for harmony exports
|
|
@@ -138,18 +178,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
138
178
|
/******/ };
|
|
139
179
|
/******/ })();
|
|
140
180
|
/******/
|
|
141
|
-
/******/ /* webpack/runtime/global */
|
|
142
|
-
/******/ (() => {
|
|
143
|
-
/******/ __webpack_require__.g = (function() {
|
|
144
|
-
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
145
|
-
/******/ try {
|
|
146
|
-
/******/ return this || new Function('return this')();
|
|
147
|
-
/******/ } catch (e) {
|
|
148
|
-
/******/ if (typeof window === 'object') return window;
|
|
149
|
-
/******/ }
|
|
150
|
-
/******/ })();
|
|
151
|
-
/******/ })();
|
|
152
|
-
/******/
|
|
153
181
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
154
182
|
/******/ (() => {
|
|
155
183
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
@@ -214,8 +242,8 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
214
242
|
/******/ /* webpack/runtime/publicPath */
|
|
215
243
|
/******/ (() => {
|
|
216
244
|
/******/ var scriptUrl;
|
|
217
|
-
/******/ if (
|
|
218
|
-
/******/ var document =
|
|
245
|
+
/******/ if (globalThis.importScripts) scriptUrl = globalThis.location + "";
|
|
246
|
+
/******/ var document = globalThis.document;
|
|
219
247
|
/******/ if (!scriptUrl && document) {
|
|
220
248
|
/******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
|
|
221
249
|
/******/ scriptUrl = document.currentScript.src;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.interaction.external.grab.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 r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var
|
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"),require("@tsparticles/plugin-interactivity"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/plugin-interactivity"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine"),require("@tsparticles/plugin-interactivity")):t(e.window,e.window);for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(this,((e,t)=>(()=>{var r,i,o,n,a={303(t){t.exports=e},583(e,t,r){r.d(t,{f:()=>n});var i=r(303),o=r(586);class n{constructor(){this.distance=100,this.links=new o.q}load(e){(0,i.isNull)(e)||(void 0!==e.distance&&(this.distance=e.distance),this.links.load(e.links))}}},586(e,t,r){r.d(t,{q:()=>o});var i=r(303);class o{constructor(){this.blink=!1,this.consent=!1,this.opacity=1}load(e){(0,i.isNull)(e)||(void 0!==e.blink&&(this.blink=e.blink),void 0!==e.color&&(this.color=i.OptionsColor.create(this.color,e.color)),void 0!==e.consent&&(this.consent=e.consent),void 0!==e.opacity&&(this.opacity=e.opacity))}}},702(e){e.exports=t}},s={};function c(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return a[e](r,r.exports,c),r.exports}c.m=a,i=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,c.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var o=Object.create(null);c.r(o);var n={};r=r||[null,i({}),i([]),i(i)];for(var a=2&t&&e;("object"==typeof a||"function"==typeof a)&&!~r.indexOf(a);a=i(a))Object.getOwnPropertyNames(a).forEach((t=>n[t]=()=>e[t]));return n.default=()=>e,c.d(o,n),o},c.d=(e,t)=>{for(var r in t)c.o(t,r)&&!c.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},c.f={},c.e=e=>Promise.all(Object.keys(c.f).reduce(((t,r)=>(c.f[r](e,t),t)),[])),c.u=e=>e+".min.js",c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o={},n="@tsparticles/interaction-external-grab:",c.l=(e,t,r,i)=>{if(o[e])o[e].push(t);else{var a,s;if(void 0!==r)for(var l=document.getElementsByTagName("script"),p=0;p<l.length;p++){var u=l[p];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==n+r){a=u;break}}a||(s=!0,(a=document.createElement("script")).charset="utf-8",c.nc&&a.setAttribute("nonce",c.nc),a.setAttribute("data-webpack",n+r),a.src=e),o[e]=[t];var d=(t,r)=>{a.onerror=a.onload=null,clearTimeout(f);var i=o[e];if(delete o[e],a.parentNode&&a.parentNode.removeChild(a),i&&i.forEach((e=>e(r))),t)return t(r)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),s&&document.head.appendChild(a)}},c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;globalThis.importScripts&&(e=globalThis.location+"");var t=globalThis.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=r[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),c.p=e})(),(()=>{var e={800:0};c.f.j=(t,r)=>{var i=c.o(e,t)?e[t]:void 0;if(0!==i)if(i)r.push(i[2]);else{var o=new Promise(((r,o)=>i=e[t]=[r,o]));r.push(i[2]=o);var n=c.p+c.u(t),a=new Error;c.l(n,(r=>{if(c.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var o=r&&("load"===r.type?"missing":r.type),n=r&&r.target&&r.target.src;a.message="Loading chunk "+t+" failed.\n("+o+": "+n+")",a.name="ChunkLoadError",a.type=o,a.request=n,i[1](a)}}),"chunk-"+t,t)}};var t=(t,r)=>{var i,o,[n,a,s]=r,l=0;if(n.some((t=>0!==e[t]))){for(i in a)c.o(a,i)&&(c.m[i]=a[i]);if(s)s(c)}for(t&&t(r);l<n.length;l++)o=n[l],c.o(e,o)&&e[o]&&e[o][0](),e[o]=0},r=this.webpackChunk_tsparticles_interaction_external_grab=this.webpackChunk_tsparticles_interaction_external_grab||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var l={};c.r(l),c.d(l,{Grab:()=>p.f,GrabLinks:()=>u.q,loadExternalGrabInteraction:()=>d});var p=c(583),u=c(586);function d(e){e.checkVersion("4.0.0-alpha.4"),e.register((async t=>{const{loadInteractivityPlugin:r}=await Promise.resolve().then(c.t.bind(c,702,19));r(t),t.addInteractor?.("externalGrab",(async t=>{const{Grabber:r}=await c.e(557).then(c.bind(c,557));return new r(t,e)}))}))}return l})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Grab External Interaction v4.0.0-alpha.
|
|
1
|
+
/*! tsParticles Grab External Interaction v4.0.0-alpha.4 by Matteo Bruni */
|
package/types/Grabber.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { type Engine,
|
|
1
|
+
import { type Engine, type RecursivePartial } from "@tsparticles/engine";
|
|
2
|
+
import { ExternalInteractorBase, type IInteractivityData, type IModes, type InteractivityParticle, type Modes } from "@tsparticles/plugin-interactivity";
|
|
2
3
|
import type { GrabContainer, GrabMode, IGrabMode } from "./Types.js";
|
|
3
4
|
export declare class Grabber extends ExternalInteractorBase<GrabContainer> {
|
|
4
5
|
private readonly _engine;
|
|
5
6
|
constructor(container: GrabContainer, engine: Engine);
|
|
6
7
|
clear(): void;
|
|
7
8
|
init(): void;
|
|
8
|
-
interact(): void;
|
|
9
|
-
isEnabled(particle?:
|
|
9
|
+
interact(interactivityData: IInteractivityData): void;
|
|
10
|
+
isEnabled(interactivityData: IInteractivityData, particle?: InteractivityParticle): boolean;
|
|
10
11
|
loadModeOptions(options: Modes & GrabMode, ...sources: RecursivePartial<(IModes & IGrabMode) | undefined>[]): void;
|
|
11
12
|
reset(): void;
|
|
12
13
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { GrabMode } from "../../Types.js";
|
|
2
|
-
import type {
|
|
3
|
-
export type GrabOptions =
|
|
4
|
-
interactivity
|
|
2
|
+
import type { InteractivityOptions } from "@tsparticles/plugin-interactivity";
|
|
3
|
+
export type GrabOptions = InteractivityOptions & {
|
|
4
|
+
interactivity?: {
|
|
5
5
|
modes: GrabMode;
|
|
6
6
|
};
|
|
7
7
|
};
|
package/types/Types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IRgb, OptionsColor } from "@tsparticles/engine";
|
|
2
|
+
import type { InteractivityContainer, InteractivityParticle } from "@tsparticles/plugin-interactivity";
|
|
2
3
|
import type { Grab } from "./Options/Classes/Grab.js";
|
|
3
4
|
import type { GrabOptions } from "./Options/Classes/GrabOptions.js";
|
|
4
5
|
import type { IGrab } from "./Options/Interfaces/IGrab.js";
|
|
@@ -8,7 +9,7 @@ export interface IGrabMode {
|
|
|
8
9
|
export interface GrabMode {
|
|
9
10
|
grab?: Grab;
|
|
10
11
|
}
|
|
11
|
-
export type GrabContainer =
|
|
12
|
+
export type GrabContainer = InteractivityContainer & {
|
|
12
13
|
actualOptions: GrabOptions;
|
|
13
14
|
particles: {
|
|
14
15
|
grabLineColor?: IRgb | string;
|
|
@@ -17,7 +18,7 @@ export type GrabContainer = Container & {
|
|
|
17
18
|
grabModeDistance?: number;
|
|
18
19
|
};
|
|
19
20
|
};
|
|
20
|
-
export type LinkParticle =
|
|
21
|
+
export type LinkParticle = InteractivityParticle & {
|
|
21
22
|
options: {
|
|
22
23
|
links?: {
|
|
23
24
|
color?: OptionsColor;
|
package/umd/Grabber.js
CHANGED
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Grab.js", "./Utils.js"], factory);
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine", "@tsparticles/plugin-interactivity", "./Options/Classes/Grab.js", "./Utils.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Grabber = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
const plugin_interactivity_1 = require("@tsparticles/plugin-interactivity");
|
|
14
15
|
const Grab_js_1 = require("./Options/Classes/Grab.js");
|
|
15
16
|
const Utils_js_1 = require("./Utils.js");
|
|
16
17
|
const grabMode = "grab", minDistance = 0, minOpacity = 0;
|
|
17
|
-
class Grabber extends
|
|
18
|
+
class Grabber extends plugin_interactivity_1.ExternalInteractorBase {
|
|
18
19
|
constructor(container, engine) {
|
|
19
20
|
super(container);
|
|
20
21
|
this._engine = engine;
|
|
@@ -22,20 +23,20 @@
|
|
|
22
23
|
clear() {
|
|
23
24
|
}
|
|
24
25
|
init() {
|
|
25
|
-
const container = this.container, grab = container.actualOptions.interactivity
|
|
26
|
+
const container = this.container, grab = container.actualOptions.interactivity?.modes.grab;
|
|
26
27
|
if (!grab) {
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
29
30
|
container.retina.grabModeDistance = grab.distance * container.retina.pixelRatio;
|
|
30
31
|
}
|
|
31
|
-
interact() {
|
|
32
|
+
interact(interactivityData) {
|
|
32
33
|
const container = this.container, options = container.actualOptions, interactivity = options.interactivity;
|
|
33
|
-
if (!interactivity
|
|
34
|
+
if (!interactivity?.modes.grab ||
|
|
34
35
|
!interactivity.events.onHover.enable ||
|
|
35
|
-
|
|
36
|
+
interactivityData.status !== plugin_interactivity_1.mouseMoveEvent) {
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
|
-
const mousePos =
|
|
39
|
+
const mousePos = interactivityData.mouse.position;
|
|
39
40
|
if (!mousePos) {
|
|
40
41
|
return;
|
|
41
42
|
}
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
if (!distance || distance < minDistance) {
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
|
-
const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));
|
|
47
|
+
const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(interactivityData, p));
|
|
47
48
|
for (const particle of query) {
|
|
48
49
|
const pos = particle.getPosition(), pointDistance = (0, engine_1.getDistance)(pos, mousePos);
|
|
49
50
|
if (pointDistance > distance) {
|
|
@@ -65,9 +66,9 @@
|
|
|
65
66
|
(0, Utils_js_1.drawGrab)(container, particle, colorLine, opacityLine, mousePos);
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
|
-
isEnabled(particle) {
|
|
69
|
-
const container = this.container, mouse =
|
|
70
|
-
return events
|
|
69
|
+
isEnabled(interactivityData, particle) {
|
|
70
|
+
const container = this.container, mouse = interactivityData.mouse, events = (particle?.interactivity ?? container.actualOptions.interactivity)?.events;
|
|
71
|
+
return !!events?.onHover.enable && !!mouse.position && (0, engine_1.isInArray)(grabMode, events.onHover.mode);
|
|
71
72
|
}
|
|
72
73
|
loadModeOptions(options, ...sources) {
|
|
73
74
|
options.grab ??= new Grab_js_1.Grab();
|
package/umd/index.js
CHANGED
|
@@ -48,10 +48,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
48
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
49
|
exports.loadExternalGrabInteraction = loadExternalGrabInteraction;
|
|
50
50
|
function loadExternalGrabInteraction(engine) {
|
|
51
|
-
engine.checkVersion("4.0.0-alpha.
|
|
52
|
-
engine.register(e => {
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
engine.checkVersion("4.0.0-alpha.4");
|
|
52
|
+
engine.register(async (e) => {
|
|
53
|
+
const { loadInteractivityPlugin } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/plugin-interactivity"))) : new Promise((resolve_1, reject_1) => { require(["@tsparticles/plugin-interactivity"], resolve_1, reject_1); }).then(__importStar));
|
|
54
|
+
loadInteractivityPlugin(e);
|
|
55
|
+
e.addInteractor?.("externalGrab", async (container) => {
|
|
56
|
+
const { Grabber } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./Grabber.js"))) : new Promise((resolve_2, reject_2) => { require(["./Grabber.js"], resolve_2, reject_2); }).then(__importStar));
|
|
55
57
|
return new Grabber(container, engine);
|
|
56
58
|
});
|
|
57
59
|
});
|
package/346.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 346.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_interaction_external_grab=this.webpackChunk_tsparticles_interaction_external_grab||[]).push([[346],{346(t,n,e){e.d(n,{Grabber:()=>a});var i=e(303),o=e(456);function r(t,n,e,o,r){t.canvas.draw((a=>{const s=n.getPosition();!function(t,n,e,o,r,a,s=!1){(0,i.drawLine)(t,e,o),t.strokeStyle=(0,i.getStyleFromRgb)(r,s,a),t.lineWidth=n,t.stroke()}(a,n.retina.linksWidth??0,s,r,e,o,t.hdr)}))}class a extends i.ExternalInteractorBase{constructor(t,n){super(t),this._engine=n}clear(){}init(){const t=this.container,n=t.actualOptions.interactivity.modes.grab;n&&(t.retina.grabModeDistance=n.distance*t.retina.pixelRatio)}interact(){const t=this.container,n=t.actualOptions.interactivity;if(!n.modes.grab||!n.events.onHover.enable||t.interactivity.status!==i.mouseMoveEvent)return;const e=t.interactivity.mouse.position;if(!e)return;const o=t.retina.grabModeDistance;if(!o||o<0)return;const a=t.particles.quadTree.queryCircle(e,o,(t=>this.isEnabled(t)));for(const s of a){const a=s.getPosition(),c=(0,i.getDistance)(a,e);if(c>o)continue;const l=n.modes.grab.links,b=l.opacity,g=b-c*b/o;if(g<=0)continue;const d=l.color??s.options.links?.color;if(!t.particles.grabLineColor&&d){const e=n.modes.grab.links;t.particles.grabLineColor=(0,i.getLinkRandomColor)(this._engine,d,e.blink,e.consent)}const u=(0,i.getLinkColor)(s,void 0,t.particles.grabLineColor);u&&r(t,s,u,g,e)}}isEnabled(t){const n=this.container,e=n.interactivity.mouse,o=(t?.interactivity??n.actualOptions.interactivity).events;return o.onHover.enable&&!!e.position&&(0,i.isInArray)("grab",o.onHover.mode)}loadModeOptions(t,...n){t.grab??=new o.f;for(const e of n)t.grab.load(e?.grab)}reset(){}}}}]);
|
package/346.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Grab External Interaction v4.0.0-alpha.3 by Matteo Bruni */
|