@tsparticles/interaction-external-grab 3.9.0 → 4.0.0-alpha.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.
- package/346.min.js +2 -0
- package/346.min.js.LICENSE.txt +1 -0
- package/browser/Grabber.js +1 -3
- package/browser/Utils.js +3 -3
- package/browser/index.js +8 -8
- package/cjs/Grabber.js +11 -17
- package/cjs/Options/Classes/Grab.js +5 -9
- package/cjs/Options/Classes/GrabLinks.js +4 -8
- package/cjs/Options/Classes/GrabOptions.js +1 -2
- package/cjs/Options/Interfaces/IGrab.js +1 -2
- package/cjs/Options/Interfaces/IGrabLinks.js +1 -2
- package/cjs/Types.js +1 -2
- package/cjs/Utils.js +6 -10
- package/cjs/index.js +10 -27
- package/dist_browser_Grabber_js.js +40 -0
- package/esm/Grabber.js +1 -3
- package/esm/Utils.js +3 -3
- package/esm/index.js +8 -8
- package/package.json +4 -3
- package/report.html +5 -4
- package/tsparticles.interaction.external.grab.js +217 -48
- package/tsparticles.interaction.external.grab.min.js +1 -1
- package/tsparticles.interaction.external.grab.min.js.LICENSE.txt +1 -1
- package/types/Utils.d.ts +1 -1
- package/types/index.d.ts +3 -3
- package/umd/Grabber.js +1 -3
- package/umd/Utils.js +3 -3
- package/umd/index.js +32 -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
|
-
*
|
|
7
|
+
* v4.0.0-alpha.0
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -28,65 +28,45 @@ return /******/ (() => { // webpackBootstrap
|
|
|
28
28
|
/******/ "use strict";
|
|
29
29
|
/******/ var __webpack_modules__ = ({
|
|
30
30
|
|
|
31
|
-
/***/ "./dist/browser/
|
|
32
|
-
/*!*********************************!*\
|
|
33
|
-
!*** ./dist/browser/Grabber.js ***!
|
|
34
|
-
\*********************************/
|
|
35
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
36
|
-
|
|
37
|
-
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_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Options_Classes_Grab_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Grab.js */ \"./dist/browser/Options/Classes/Grab.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\nconst grabMode = \"grab\",\n minDistance = 0,\n minOpacity = 0;\nclass Grabber extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.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() {\n const container = this.container,\n options = container.actualOptions,\n interactivity = options.interactivity;\n if (!interactivity.modes.grab || !interactivity.events.onHover.enable || container.interactivity.status !== _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseMoveEvent) {\n return;\n }\n const mousePos = container.interactivity.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(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_2__.drawGrab)(container, particle, colorLine, opacityLine, mousePos);\n }\n }\n isEnabled(particle) {\n const container = this.container,\n mouse = container.interactivity.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 if (!options.grab) {\n options.grab = new _Options_Classes_Grab_js__WEBPACK_IMPORTED_MODULE_1__.Grab();\n }\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}");
|
|
38
|
-
|
|
39
|
-
/***/ }),
|
|
40
|
-
|
|
41
|
-
/***/ "./dist/browser/Options/Classes/Grab.js":
|
|
31
|
+
/***/ "./dist/browser/Options/Classes/Grab.js"
|
|
42
32
|
/*!**********************************************!*\
|
|
43
33
|
!*** ./dist/browser/Options/Classes/Grab.js ***!
|
|
44
34
|
\**********************************************/
|
|
45
|
-
|
|
35
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
46
36
|
|
|
47
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Grab: () => (/* binding */ Grab)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var
|
|
37
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Grab: () => (/* binding */ Grab)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _GrabLinks_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GrabLinks.js */ \"./dist/browser/Options/Classes/GrabLinks.js\");\n\n\nclass Grab {\n constructor() {\n this.distance = 100;\n this.links = new _GrabLinks_js__WEBPACK_IMPORTED_MODULE_1__.GrabLinks();\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.distance !== undefined) {\n this.distance = data.distance;\n }\n this.links.load(data.links);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-grab/./dist/browser/Options/Classes/Grab.js?\n}");
|
|
48
38
|
|
|
49
|
-
/***/ }
|
|
39
|
+
/***/ },
|
|
50
40
|
|
|
51
|
-
/***/ "./dist/browser/Options/Classes/GrabLinks.js"
|
|
41
|
+
/***/ "./dist/browser/Options/Classes/GrabLinks.js"
|
|
52
42
|
/*!***************************************************!*\
|
|
53
43
|
!*** ./dist/browser/Options/Classes/GrabLinks.js ***!
|
|
54
44
|
\***************************************************/
|
|
55
|
-
|
|
45
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
56
46
|
|
|
57
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ GrabLinks: () => (/* binding */ GrabLinks)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n
|
|
47
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ GrabLinks: () => (/* binding */ GrabLinks)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass GrabLinks {\n constructor() {\n this.blink = false;\n this.consent = false;\n this.opacity = 1;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.blink !== undefined) {\n this.blink = data.blink;\n }\n if (data.color !== undefined) {\n this.color = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OptionsColor.create(this.color, data.color);\n }\n if (data.consent !== undefined) {\n this.consent = data.consent;\n }\n if (data.opacity !== undefined) {\n this.opacity = data.opacity;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-grab/./dist/browser/Options/Classes/GrabLinks.js?\n}");
|
|
58
48
|
|
|
59
|
-
/***/ }
|
|
49
|
+
/***/ },
|
|
60
50
|
|
|
61
|
-
/***/ "./dist/browser/
|
|
62
|
-
/*!*******************************!*\
|
|
63
|
-
!*** ./dist/browser/Utils.js ***!
|
|
64
|
-
\*******************************/
|
|
65
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
66
|
-
|
|
67
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawGrab: () => (/* binding */ drawGrab),\n/* harmony export */ drawGrabLine: () => (/* binding */ drawGrabLine)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nconst defaultWidth = 0;\nfunction drawGrabLine(context, width, begin, end, colorLine, opacity) {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.drawLine)(context, begin, end);\n context.strokeStyle = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)(colorLine, opacity);\n context.lineWidth = width;\n context.stroke();\n}\nfunction drawGrab(container, particle, lineColor, opacity, mousePos) {\n container.canvas.draw(ctx => {\n const beginPos = particle.getPosition();\n drawGrabLine(ctx, particle.retina.linksWidth ?? defaultWidth, beginPos, mousePos, lineColor, opacity);\n });\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-grab/./dist/browser/Utils.js?\n}");
|
|
68
|
-
|
|
69
|
-
/***/ }),
|
|
70
|
-
|
|
71
|
-
/***/ "./dist/browser/index.js":
|
|
51
|
+
/***/ "./dist/browser/index.js"
|
|
72
52
|
/*!*******************************!*\
|
|
73
53
|
!*** ./dist/browser/index.js ***!
|
|
74
54
|
\*******************************/
|
|
75
|
-
|
|
55
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
76
56
|
|
|
77
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Grab: () => (/* reexport safe */
|
|
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.0\");\n engine.register(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}");
|
|
78
58
|
|
|
79
|
-
/***/ }
|
|
59
|
+
/***/ },
|
|
80
60
|
|
|
81
|
-
/***/ "@tsparticles/engine"
|
|
61
|
+
/***/ "@tsparticles/engine"
|
|
82
62
|
/*!*********************************************************************************************************************************!*\
|
|
83
63
|
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
|
|
84
64
|
\*********************************************************************************************************************************/
|
|
85
|
-
|
|
65
|
+
(module) {
|
|
86
66
|
|
|
87
67
|
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
88
68
|
|
|
89
|
-
/***/ }
|
|
69
|
+
/***/ }
|
|
90
70
|
|
|
91
71
|
/******/ });
|
|
92
72
|
/************************************************************************/
|
|
@@ -100,6 +80,12 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
100
80
|
/******/ if (cachedModule !== undefined) {
|
|
101
81
|
/******/ return cachedModule.exports;
|
|
102
82
|
/******/ }
|
|
83
|
+
/******/ // Check if module exists (development only)
|
|
84
|
+
/******/ if (__webpack_modules__[moduleId] === undefined) {
|
|
85
|
+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
86
|
+
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
87
|
+
/******/ throw e;
|
|
88
|
+
/******/ }
|
|
103
89
|
/******/ // Create a new module (and put it into the cache)
|
|
104
90
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
105
91
|
/******/ // no module.id needed
|
|
@@ -114,19 +100,10 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
114
100
|
/******/ return module.exports;
|
|
115
101
|
/******/ }
|
|
116
102
|
/******/
|
|
117
|
-
|
|
118
|
-
/******/
|
|
119
|
-
/******/ (() => {
|
|
120
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
121
|
-
/******/ __webpack_require__.n = (module) => {
|
|
122
|
-
/******/ var getter = module && module.__esModule ?
|
|
123
|
-
/******/ () => (module['default']) :
|
|
124
|
-
/******/ () => (module);
|
|
125
|
-
/******/ __webpack_require__.d(getter, { a: getter });
|
|
126
|
-
/******/ return getter;
|
|
127
|
-
/******/ };
|
|
128
|
-
/******/ })();
|
|
103
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
104
|
+
/******/ __webpack_require__.m = __webpack_modules__;
|
|
129
105
|
/******/
|
|
106
|
+
/************************************************************************/
|
|
130
107
|
/******/ /* webpack/runtime/define property getters */
|
|
131
108
|
/******/ (() => {
|
|
132
109
|
/******/ // define getter functions for harmony exports
|
|
@@ -139,11 +116,90 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
139
116
|
/******/ };
|
|
140
117
|
/******/ })();
|
|
141
118
|
/******/
|
|
119
|
+
/******/ /* webpack/runtime/ensure chunk */
|
|
120
|
+
/******/ (() => {
|
|
121
|
+
/******/ __webpack_require__.f = {};
|
|
122
|
+
/******/ // This file contains only the entry chunk.
|
|
123
|
+
/******/ // The chunk loading function for additional chunks
|
|
124
|
+
/******/ __webpack_require__.e = (chunkId) => {
|
|
125
|
+
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
|
|
126
|
+
/******/ __webpack_require__.f[key](chunkId, promises);
|
|
127
|
+
/******/ return promises;
|
|
128
|
+
/******/ }, []));
|
|
129
|
+
/******/ };
|
|
130
|
+
/******/ })();
|
|
131
|
+
/******/
|
|
132
|
+
/******/ /* webpack/runtime/get javascript chunk filename */
|
|
133
|
+
/******/ (() => {
|
|
134
|
+
/******/ // This function allow to reference async chunks
|
|
135
|
+
/******/ __webpack_require__.u = (chunkId) => {
|
|
136
|
+
/******/ // return url for filenames based on template
|
|
137
|
+
/******/ return "" + chunkId + ".js";
|
|
138
|
+
/******/ };
|
|
139
|
+
/******/ })();
|
|
140
|
+
/******/
|
|
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
|
+
/******/
|
|
142
153
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
143
154
|
/******/ (() => {
|
|
144
155
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
145
156
|
/******/ })();
|
|
146
157
|
/******/
|
|
158
|
+
/******/ /* webpack/runtime/load script */
|
|
159
|
+
/******/ (() => {
|
|
160
|
+
/******/ var inProgress = {};
|
|
161
|
+
/******/ var dataWebpackPrefix = "@tsparticles/interaction-external-grab:";
|
|
162
|
+
/******/ // loadScript function to load a script via script tag
|
|
163
|
+
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
|
|
164
|
+
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
|
|
165
|
+
/******/ var script, needAttach;
|
|
166
|
+
/******/ if(key !== undefined) {
|
|
167
|
+
/******/ var scripts = document.getElementsByTagName("script");
|
|
168
|
+
/******/ for(var i = 0; i < scripts.length; i++) {
|
|
169
|
+
/******/ var s = scripts[i];
|
|
170
|
+
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
|
|
171
|
+
/******/ }
|
|
172
|
+
/******/ }
|
|
173
|
+
/******/ if(!script) {
|
|
174
|
+
/******/ needAttach = true;
|
|
175
|
+
/******/ script = document.createElement('script');
|
|
176
|
+
/******/
|
|
177
|
+
/******/ script.charset = 'utf-8';
|
|
178
|
+
/******/ if (__webpack_require__.nc) {
|
|
179
|
+
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
|
180
|
+
/******/ }
|
|
181
|
+
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
|
182
|
+
/******/
|
|
183
|
+
/******/ script.src = url;
|
|
184
|
+
/******/ }
|
|
185
|
+
/******/ inProgress[url] = [done];
|
|
186
|
+
/******/ var onScriptComplete = (prev, event) => {
|
|
187
|
+
/******/ // avoid mem leaks in IE.
|
|
188
|
+
/******/ script.onerror = script.onload = null;
|
|
189
|
+
/******/ clearTimeout(timeout);
|
|
190
|
+
/******/ var doneFns = inProgress[url];
|
|
191
|
+
/******/ delete inProgress[url];
|
|
192
|
+
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
193
|
+
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
|
194
|
+
/******/ if(prev) return prev(event);
|
|
195
|
+
/******/ }
|
|
196
|
+
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
197
|
+
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
198
|
+
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
199
|
+
/******/ needAttach && document.head.appendChild(script);
|
|
200
|
+
/******/ };
|
|
201
|
+
/******/ })();
|
|
202
|
+
/******/
|
|
147
203
|
/******/ /* webpack/runtime/make namespace object */
|
|
148
204
|
/******/ (() => {
|
|
149
205
|
/******/ // define __esModule on exports
|
|
@@ -155,6 +211,119 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
155
211
|
/******/ };
|
|
156
212
|
/******/ })();
|
|
157
213
|
/******/
|
|
214
|
+
/******/ /* webpack/runtime/publicPath */
|
|
215
|
+
/******/ (() => {
|
|
216
|
+
/******/ var scriptUrl;
|
|
217
|
+
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
218
|
+
/******/ var document = __webpack_require__.g.document;
|
|
219
|
+
/******/ if (!scriptUrl && document) {
|
|
220
|
+
/******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
|
|
221
|
+
/******/ scriptUrl = document.currentScript.src;
|
|
222
|
+
/******/ if (!scriptUrl) {
|
|
223
|
+
/******/ var scripts = document.getElementsByTagName("script");
|
|
224
|
+
/******/ if(scripts.length) {
|
|
225
|
+
/******/ var i = scripts.length - 1;
|
|
226
|
+
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
|
|
227
|
+
/******/ }
|
|
228
|
+
/******/ }
|
|
229
|
+
/******/ }
|
|
230
|
+
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
|
|
231
|
+
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
|
|
232
|
+
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
|
|
233
|
+
/******/ scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
234
|
+
/******/ __webpack_require__.p = scriptUrl;
|
|
235
|
+
/******/ })();
|
|
236
|
+
/******/
|
|
237
|
+
/******/ /* webpack/runtime/jsonp chunk loading */
|
|
238
|
+
/******/ (() => {
|
|
239
|
+
/******/ // no baseURI
|
|
240
|
+
/******/
|
|
241
|
+
/******/ // object to store loaded and loading chunks
|
|
242
|
+
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
243
|
+
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
|
244
|
+
/******/ var installedChunks = {
|
|
245
|
+
/******/ "tsparticles.interaction.external.grab": 0
|
|
246
|
+
/******/ };
|
|
247
|
+
/******/
|
|
248
|
+
/******/ __webpack_require__.f.j = (chunkId, promises) => {
|
|
249
|
+
/******/ // JSONP chunk loading for javascript
|
|
250
|
+
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
|
|
251
|
+
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
|
|
252
|
+
/******/
|
|
253
|
+
/******/ // a Promise means "currently loading".
|
|
254
|
+
/******/ if(installedChunkData) {
|
|
255
|
+
/******/ promises.push(installedChunkData[2]);
|
|
256
|
+
/******/ } else {
|
|
257
|
+
/******/ if(true) { // all chunks have JS
|
|
258
|
+
/******/ // setup Promise in chunk cache
|
|
259
|
+
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
|
|
260
|
+
/******/ promises.push(installedChunkData[2] = promise);
|
|
261
|
+
/******/
|
|
262
|
+
/******/ // start chunk loading
|
|
263
|
+
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
|
|
264
|
+
/******/ // create error before stack unwound to get useful stacktrace later
|
|
265
|
+
/******/ var error = new Error();
|
|
266
|
+
/******/ var loadingEnded = (event) => {
|
|
267
|
+
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
|
|
268
|
+
/******/ installedChunkData = installedChunks[chunkId];
|
|
269
|
+
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
|
|
270
|
+
/******/ if(installedChunkData) {
|
|
271
|
+
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
|
272
|
+
/******/ var realSrc = event && event.target && event.target.src;
|
|
273
|
+
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
|
274
|
+
/******/ error.name = 'ChunkLoadError';
|
|
275
|
+
/******/ error.type = errorType;
|
|
276
|
+
/******/ error.request = realSrc;
|
|
277
|
+
/******/ installedChunkData[1](error);
|
|
278
|
+
/******/ }
|
|
279
|
+
/******/ }
|
|
280
|
+
/******/ };
|
|
281
|
+
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
|
|
282
|
+
/******/ }
|
|
283
|
+
/******/ }
|
|
284
|
+
/******/ }
|
|
285
|
+
/******/ };
|
|
286
|
+
/******/
|
|
287
|
+
/******/ // no prefetching
|
|
288
|
+
/******/
|
|
289
|
+
/******/ // no preloaded
|
|
290
|
+
/******/
|
|
291
|
+
/******/ // no HMR
|
|
292
|
+
/******/
|
|
293
|
+
/******/ // no HMR manifest
|
|
294
|
+
/******/
|
|
295
|
+
/******/ // no on chunks loaded
|
|
296
|
+
/******/
|
|
297
|
+
/******/ // install a JSONP callback for chunk loading
|
|
298
|
+
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
|
299
|
+
/******/ var [chunkIds, moreModules, runtime] = data;
|
|
300
|
+
/******/ // add "moreModules" to the modules object,
|
|
301
|
+
/******/ // then flag all "chunkIds" as loaded and fire callback
|
|
302
|
+
/******/ var moduleId, chunkId, i = 0;
|
|
303
|
+
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
|
|
304
|
+
/******/ for(moduleId in moreModules) {
|
|
305
|
+
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
|
306
|
+
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
|
|
307
|
+
/******/ }
|
|
308
|
+
/******/ }
|
|
309
|
+
/******/ if(runtime) var result = runtime(__webpack_require__);
|
|
310
|
+
/******/ }
|
|
311
|
+
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
|
|
312
|
+
/******/ for(;i < chunkIds.length; i++) {
|
|
313
|
+
/******/ chunkId = chunkIds[i];
|
|
314
|
+
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
|
315
|
+
/******/ installedChunks[chunkId][0]();
|
|
316
|
+
/******/ }
|
|
317
|
+
/******/ installedChunks[chunkId] = 0;
|
|
318
|
+
/******/ }
|
|
319
|
+
/******/
|
|
320
|
+
/******/ }
|
|
321
|
+
/******/
|
|
322
|
+
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_interaction_external_grab"] = this["webpackChunk_tsparticles_interaction_external_grab"] || [];
|
|
323
|
+
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
|
324
|
+
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
|
325
|
+
/******/ })();
|
|
326
|
+
/******/
|
|
158
327
|
/************************************************************************/
|
|
159
328
|
/******/
|
|
160
329
|
/******/ // startup
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.interaction.external.grab.min.js.LICENSE.txt */
|
|
2
|
-
!function(t
|
|
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 o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(e=>(()=>{var t,r,o={303(t){t.exports=e},456(e,t,r){r.d(t,{f:()=>i});var o=r(303),n=r(491);class i{constructor(){this.distance=100,this.links=new n.q}load(e){(0,o.isNull)(e)||(void 0!==e.distance&&(this.distance=e.distance),this.links.load(e.links))}}},491(e,t,r){r.d(t,{q:()=>n});var o=r(303);class n{constructor(){this.blink=!1,this.consent=!1,this.opacity=1}load(e){(0,o.isNull)(e)||(void 0!==e.blink&&(this.blink=e.blink),void 0!==e.color&&(this.color=o.OptionsColor.create(this.color,e.color)),void 0!==e.consent&&(this.consent=e.consent),void 0!==e.opacity&&(this.opacity=e.opacity))}}}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return o[e](r,r.exports,i),r.exports}i.m=o,i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((t,r)=>(i.f[r](e,t),t)),[])),i.u=e=>e+".min.js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/interaction-external-grab:",i.l=(e,o,n,a)=>{if(t[e])t[e].push(o);else{var s,c;if(void 0!==n)for(var l=document.getElementsByTagName("script"),p=0;p<l.length;p++){var d=l[p];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==r+n){s=d;break}}s||(c=!0,(s=document.createElement("script")).charset="utf-8",i.nc&&s.setAttribute("nonce",i.nc),s.setAttribute("data-webpack",r+n),s.src=e),t[e]=[o];var u=(r,o)=>{s.onerror=s.onload=null,clearTimeout(f);var n=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),n&&n.forEach((e=>e(o))),r)return r(o)},f=setTimeout(u.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=u.bind(null,s.onerror),s.onload=u.bind(null,s.onload),c&&document.head.appendChild(s)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+"");var t=i.g.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 o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),(()=>{var e={800:0};i.f.j=(t,r)=>{var o=i.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise(((r,n)=>o=e[t]=[r,n]));r.push(o[2]=n);var a=i.p+i.u(t),s=new Error;i.l(a,(r=>{if(i.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+n+": "+a+")",s.name="ChunkLoadError",s.type=n,s.request=a,o[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var o,n,[a,s,c]=r,l=0;if(a.some((t=>0!==e[t]))){for(o in s)i.o(s,o)&&(i.m[o]=s[o]);if(c)c(i)}for(t&&t(r);l<a.length;l++)n=a[l],i.o(e,n)&&e[n]&&e[n][0](),e[n]=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 a={};i.r(a),i.d(a,{Grab:()=>s.f,GrabLinks:()=>c.q,loadExternalGrabInteraction:()=>l});var s=i(456),c=i(491);function l(e){e.checkVersion("4.0.0-alpha.0"),e.register((t=>{t.addInteractor("externalGrab",(async t=>{const{Grabber:r}=await i.e(346).then(i.bind(i,346));return new r(t,e)}))}))}return a})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Grab External Interaction
|
|
1
|
+
/*! tsParticles Grab External Interaction v4.0.0-alpha.0 by Matteo Bruni */
|
package/types/Utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { GrabContainer, LinkParticle } from "./Types.js";
|
|
2
2
|
import { type ICoordinates, type IRgb } from "@tsparticles/engine";
|
|
3
|
-
export declare function drawGrabLine(context: CanvasRenderingContext2D, width: number, begin: ICoordinates, end: ICoordinates, colorLine: IRgb, opacity: number): void;
|
|
3
|
+
export declare function drawGrabLine(context: CanvasRenderingContext2D, width: number, begin: ICoordinates, end: ICoordinates, colorLine: IRgb, opacity: number, hdr?: boolean): void;
|
|
4
4
|
export declare function drawGrab(container: GrabContainer, particle: LinkParticle, lineColor: IRgb, opacity: number, mousePos: ICoordinates): void;
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Engine } from "@tsparticles/engine";
|
|
2
|
-
export declare function loadExternalGrabInteraction(engine: Engine
|
|
2
|
+
export declare function loadExternalGrabInteraction(engine: Engine): void;
|
|
3
3
|
export * from "./Options/Classes/Grab.js";
|
|
4
4
|
export * from "./Options/Classes/GrabLinks.js";
|
|
5
|
-
export * from "./Options/Interfaces/IGrab.js";
|
|
6
|
-
export * from "./Options/Interfaces/IGrabLinks.js";
|
|
5
|
+
export type * from "./Options/Interfaces/IGrab.js";
|
|
6
|
+
export type * from "./Options/Interfaces/IGrabLinks.js";
|
package/umd/Grabber.js
CHANGED
|
@@ -70,9 +70,7 @@
|
|
|
70
70
|
return events.onHover.enable && !!mouse.position && (0, engine_1.isInArray)(grabMode, events.onHover.mode);
|
|
71
71
|
}
|
|
72
72
|
loadModeOptions(options, ...sources) {
|
|
73
|
-
|
|
74
|
-
options.grab = new Grab_js_1.Grab();
|
|
75
|
-
}
|
|
73
|
+
options.grab ??= new Grab_js_1.Grab();
|
|
76
74
|
for (const source of sources) {
|
|
77
75
|
options.grab.load(source?.grab);
|
|
78
76
|
}
|
package/umd/Utils.js
CHANGED
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
exports.drawGrab = drawGrab;
|
|
14
14
|
const engine_1 = require("@tsparticles/engine");
|
|
15
15
|
const defaultWidth = 0;
|
|
16
|
-
function drawGrabLine(context, width, begin, end, colorLine, opacity) {
|
|
16
|
+
function drawGrabLine(context, width, begin, end, colorLine, opacity, hdr = false) {
|
|
17
17
|
(0, engine_1.drawLine)(context, begin, end);
|
|
18
|
-
context.strokeStyle = (0, engine_1.getStyleFromRgb)(colorLine, opacity);
|
|
18
|
+
context.strokeStyle = (0, engine_1.getStyleFromRgb)(colorLine, hdr, opacity);
|
|
19
19
|
context.lineWidth = width;
|
|
20
20
|
context.stroke();
|
|
21
21
|
}
|
|
22
22
|
function drawGrab(container, particle, lineColor, opacity, mousePos) {
|
|
23
23
|
container.canvas.draw(ctx => {
|
|
24
24
|
const beginPos = particle.getPosition();
|
|
25
|
-
drawGrabLine(ctx, particle.retina.linksWidth ?? defaultWidth, beginPos, mousePos, lineColor, opacity);
|
|
25
|
+
drawGrabLine(ctx, particle.retina.linksWidth ?? defaultWidth, beginPos, mousePos, lineColor, opacity, container.hdr);
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
});
|
package/umd/index.js
CHANGED
|
@@ -9,6 +9,28 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
9
9
|
if (k2 === undefined) k2 = k;
|
|
10
10
|
o[k2] = m[k];
|
|
11
11
|
}));
|
|
12
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
13
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14
|
+
}) : function(o, v) {
|
|
15
|
+
o["default"] = v;
|
|
16
|
+
});
|
|
17
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
18
|
+
var ownKeys = function(o) {
|
|
19
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
20
|
+
var ar = [];
|
|
21
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
22
|
+
return ar;
|
|
23
|
+
};
|
|
24
|
+
return ownKeys(o);
|
|
25
|
+
};
|
|
26
|
+
return function (mod) {
|
|
27
|
+
if (mod && mod.__esModule) return mod;
|
|
28
|
+
var result = {};
|
|
29
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
30
|
+
__setModuleDefault(result, mod);
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
})();
|
|
12
34
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
13
35
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
14
36
|
};
|
|
@@ -18,21 +40,22 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
18
40
|
if (v !== undefined) module.exports = v;
|
|
19
41
|
}
|
|
20
42
|
else if (typeof define === "function" && define.amd) {
|
|
21
|
-
define(["require", "exports", "./
|
|
43
|
+
define(["require", "exports", "./Options/Classes/Grab.js", "./Options/Classes/GrabLinks.js"], factory);
|
|
22
44
|
}
|
|
23
45
|
})(function (require, exports) {
|
|
24
46
|
"use strict";
|
|
47
|
+
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
25
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
49
|
exports.loadExternalGrabInteraction = loadExternalGrabInteraction;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
engine.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
50
|
+
function loadExternalGrabInteraction(engine) {
|
|
51
|
+
engine.checkVersion("4.0.0-alpha.0");
|
|
52
|
+
engine.register(e => {
|
|
53
|
+
e.addInteractor("externalGrab", async (container) => {
|
|
54
|
+
const { Grabber } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./Grabber.js"))) : new Promise((resolve_1, reject_1) => { require(["./Grabber.js"], resolve_1, reject_1); }).then(__importStar));
|
|
55
|
+
return new Grabber(container, engine);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
33
58
|
}
|
|
34
59
|
__exportStar(require("./Options/Classes/Grab.js"), exports);
|
|
35
60
|
__exportStar(require("./Options/Classes/GrabLinks.js"), exports);
|
|
36
|
-
__exportStar(require("./Options/Interfaces/IGrab.js"), exports);
|
|
37
|
-
__exportStar(require("./Options/Interfaces/IGrabLinks.js"), exports);
|
|
38
61
|
});
|