@tsparticles/interaction-external-repulse 3.0.3 → 3.2.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.
@@ -4,7 +4,15 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v3.0.3
7
+ * v3.2.0
8
+ */
9
+ /*
10
+ * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
11
+ * This devtool is neither made for production nor for readable output files.
12
+ * It uses "eval()" calls to create a separate source file in the browser devtools.
13
+ * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
14
+ * or disable the default devtool with "devtool: false".
15
+ * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
8
16
  */
9
17
  (function webpackUniversalModuleDefinition(root, factory) {
10
18
  if(typeof exports === 'object' && typeof module === 'object')
@@ -15,15 +23,58 @@
15
23
  var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
16
24
  for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
17
25
  }
18
- })(this, (__WEBPACK_EXTERNAL_MODULE__533__) => {
26
+ })(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__) => {
19
27
  return /******/ (() => { // webpackBootstrap
20
28
  /******/ "use strict";
21
29
  /******/ var __webpack_modules__ = ({
22
30
 
23
- /***/ 533:
31
+ /***/ "./dist/browser/Options/Classes/Repulse.js":
32
+ /*!*************************************************!*\
33
+ !*** ./dist/browser/Options/Classes/Repulse.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 */ Repulse: () => (/* binding */ Repulse)\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 _RepulseBase_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RepulseBase.js */ \"./dist/browser/Options/Classes/RepulseBase.js\");\n/* harmony import */ var _RepulseDiv_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./RepulseDiv.js */ \"./dist/browser/Options/Classes/RepulseDiv.js\");\n\n\n\nclass Repulse extends _RepulseBase_js__WEBPACK_IMPORTED_MODULE_1__.RepulseBase {\n load(data) {\n super.load(data);\n if (!data) {\n return;\n }\n this.divs = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(data.divs, div => {\n const tmp = new _RepulseDiv_js__WEBPACK_IMPORTED_MODULE_2__.RepulseDiv();\n tmp.load(div);\n return tmp;\n });\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-repulse/./dist/browser/Options/Classes/Repulse.js?");
38
+
39
+ /***/ }),
40
+
41
+ /***/ "./dist/browser/Options/Classes/RepulseBase.js":
42
+ /*!*****************************************************!*\
43
+ !*** ./dist/browser/Options/Classes/RepulseBase.js ***!
44
+ \*****************************************************/
45
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
46
+
47
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RepulseBase: () => (/* binding */ RepulseBase)\n/* harmony export */ });\nclass RepulseBase {\n constructor() {\n this.distance = 200;\n this.duration = 0.4;\n this.factor = 100;\n this.speed = 1;\n this.maxSpeed = 50;\n this.easing = \"ease-out-quad\";\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.distance !== undefined) {\n this.distance = data.distance;\n }\n if (data.duration !== undefined) {\n this.duration = data.duration;\n }\n if (data.easing !== undefined) {\n this.easing = data.easing;\n }\n if (data.factor !== undefined) {\n this.factor = data.factor;\n }\n if (data.speed !== undefined) {\n this.speed = data.speed;\n }\n if (data.maxSpeed !== undefined) {\n this.maxSpeed = data.maxSpeed;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-repulse/./dist/browser/Options/Classes/RepulseBase.js?");
48
+
49
+ /***/ }),
50
+
51
+ /***/ "./dist/browser/Options/Classes/RepulseDiv.js":
52
+ /*!****************************************************!*\
53
+ !*** ./dist/browser/Options/Classes/RepulseDiv.js ***!
54
+ \****************************************************/
55
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
56
+
57
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RepulseDiv: () => (/* binding */ RepulseDiv)\n/* harmony export */ });\n/* harmony import */ var _RepulseBase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./RepulseBase.js */ \"./dist/browser/Options/Classes/RepulseBase.js\");\n\nclass RepulseDiv extends _RepulseBase_js__WEBPACK_IMPORTED_MODULE_0__.RepulseBase {\n constructor() {\n super();\n this.selectors = [];\n }\n load(data) {\n super.load(data);\n if (!data) {\n return;\n }\n if (data.selectors !== undefined) {\n this.selectors = data.selectors;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-repulse/./dist/browser/Options/Classes/RepulseDiv.js?");
58
+
59
+ /***/ }),
60
+
61
+ /***/ "./dist/browser/index.js":
62
+ /*!*******************************!*\
63
+ !*** ./dist/browser/index.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 */ Repulse: () => (/* reexport safe */ _Options_Classes_Repulse_js__WEBPACK_IMPORTED_MODULE_2__.Repulse),\n/* harmony export */ RepulseBase: () => (/* reexport safe */ _Options_Classes_RepulseBase_js__WEBPACK_IMPORTED_MODULE_0__.RepulseBase),\n/* harmony export */ RepulseDiv: () => (/* reexport safe */ _Options_Classes_RepulseDiv_js__WEBPACK_IMPORTED_MODULE_1__.RepulseDiv),\n/* harmony export */ loadExternalRepulseInteraction: () => (/* binding */ loadExternalRepulseInteraction)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_RepulseBase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/RepulseBase.js */ \"./dist/browser/Options/Classes/RepulseBase.js\");\n/* harmony import */ var _Options_Classes_RepulseDiv_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/RepulseDiv.js */ \"./dist/browser/Options/Classes/RepulseDiv.js\");\n/* harmony import */ var _Options_Classes_Repulse_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Repulse.js */ \"./dist/browser/Options/Classes/Repulse.js\");\nasync function loadExternalRepulseInteraction(engine, refresh = true) {\n await engine.addInteractor(\"externalRepulse\", async container => {\n const {\n Repulser\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_Repulser_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./Repulser.js */ \"./dist/browser/Repulser.js\"));\n return new Repulser(engine, container);\n }, refresh);\n}\n\n\n\n\n\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-repulse/./dist/browser/index.js?");
68
+
69
+ /***/ }),
70
+
71
+ /***/ "@tsparticles/engine":
72
+ /*!*********************************************************************************************************************************!*\
73
+ !*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
74
+ \*********************************************************************************************************************************/
24
75
  /***/ ((module) => {
25
76
 
26
- module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
77
+ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
27
78
 
28
79
  /***/ })
29
80
 
@@ -53,7 +104,22 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
53
104
  /******/ return module.exports;
54
105
  /******/ }
55
106
  /******/
107
+ /******/ // expose the modules object (__webpack_modules__)
108
+ /******/ __webpack_require__.m = __webpack_modules__;
109
+ /******/
56
110
  /************************************************************************/
111
+ /******/ /* webpack/runtime/compat get default export */
112
+ /******/ (() => {
113
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
114
+ /******/ __webpack_require__.n = (module) => {
115
+ /******/ var getter = module && module.__esModule ?
116
+ /******/ () => (module['default']) :
117
+ /******/ () => (module);
118
+ /******/ __webpack_require__.d(getter, { a: getter });
119
+ /******/ return getter;
120
+ /******/ };
121
+ /******/ })();
122
+ /******/
57
123
  /******/ /* webpack/runtime/define property getters */
58
124
  /******/ (() => {
59
125
  /******/ // define getter functions for harmony exports
@@ -66,11 +132,91 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
66
132
  /******/ };
67
133
  /******/ })();
68
134
  /******/
135
+ /******/ /* webpack/runtime/ensure chunk */
136
+ /******/ (() => {
137
+ /******/ __webpack_require__.f = {};
138
+ /******/ // This file contains only the entry chunk.
139
+ /******/ // The chunk loading function for additional chunks
140
+ /******/ __webpack_require__.e = (chunkId) => {
141
+ /******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
142
+ /******/ __webpack_require__.f[key](chunkId, promises);
143
+ /******/ return promises;
144
+ /******/ }, []));
145
+ /******/ };
146
+ /******/ })();
147
+ /******/
148
+ /******/ /* webpack/runtime/get javascript chunk filename */
149
+ /******/ (() => {
150
+ /******/ // This function allow to reference async chunks
151
+ /******/ __webpack_require__.u = (chunkId) => {
152
+ /******/ // return url for filenames based on template
153
+ /******/ return "" + chunkId + ".js";
154
+ /******/ };
155
+ /******/ })();
156
+ /******/
157
+ /******/ /* webpack/runtime/global */
158
+ /******/ (() => {
159
+ /******/ __webpack_require__.g = (function() {
160
+ /******/ if (typeof globalThis === 'object') return globalThis;
161
+ /******/ try {
162
+ /******/ return this || new Function('return this')();
163
+ /******/ } catch (e) {
164
+ /******/ if (typeof window === 'object') return window;
165
+ /******/ }
166
+ /******/ })();
167
+ /******/ })();
168
+ /******/
69
169
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
70
170
  /******/ (() => {
71
171
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
72
172
  /******/ })();
73
173
  /******/
174
+ /******/ /* webpack/runtime/load script */
175
+ /******/ (() => {
176
+ /******/ var inProgress = {};
177
+ /******/ var dataWebpackPrefix = "@tsparticles/interaction-external-repulse:";
178
+ /******/ // loadScript function to load a script via script tag
179
+ /******/ __webpack_require__.l = (url, done, key, chunkId) => {
180
+ /******/ if(inProgress[url]) { inProgress[url].push(done); return; }
181
+ /******/ var script, needAttach;
182
+ /******/ if(key !== undefined) {
183
+ /******/ var scripts = document.getElementsByTagName("script");
184
+ /******/ for(var i = 0; i < scripts.length; i++) {
185
+ /******/ var s = scripts[i];
186
+ /******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
187
+ /******/ }
188
+ /******/ }
189
+ /******/ if(!script) {
190
+ /******/ needAttach = true;
191
+ /******/ script = document.createElement('script');
192
+ /******/
193
+ /******/ script.charset = 'utf-8';
194
+ /******/ script.timeout = 120;
195
+ /******/ if (__webpack_require__.nc) {
196
+ /******/ script.setAttribute("nonce", __webpack_require__.nc);
197
+ /******/ }
198
+ /******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
199
+ /******/
200
+ /******/ script.src = url;
201
+ /******/ }
202
+ /******/ inProgress[url] = [done];
203
+ /******/ var onScriptComplete = (prev, event) => {
204
+ /******/ // avoid mem leaks in IE.
205
+ /******/ script.onerror = script.onload = null;
206
+ /******/ clearTimeout(timeout);
207
+ /******/ var doneFns = inProgress[url];
208
+ /******/ delete inProgress[url];
209
+ /******/ script.parentNode && script.parentNode.removeChild(script);
210
+ /******/ doneFns && doneFns.forEach((fn) => (fn(event)));
211
+ /******/ if(prev) return prev(event);
212
+ /******/ }
213
+ /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
214
+ /******/ script.onerror = onScriptComplete.bind(null, script.onerror);
215
+ /******/ script.onload = onScriptComplete.bind(null, script.onload);
216
+ /******/ needAttach && document.head.appendChild(script);
217
+ /******/ };
218
+ /******/ })();
219
+ /******/
74
220
  /******/ /* webpack/runtime/make namespace object */
75
221
  /******/ (() => {
76
222
  /******/ // define __esModule on exports
@@ -82,314 +228,128 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
82
228
  /******/ };
83
229
  /******/ })();
84
230
  /******/
231
+ /******/ /* webpack/runtime/publicPath */
232
+ /******/ (() => {
233
+ /******/ var scriptUrl;
234
+ /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
235
+ /******/ var document = __webpack_require__.g.document;
236
+ /******/ if (!scriptUrl && document) {
237
+ /******/ if (document.currentScript)
238
+ /******/ scriptUrl = document.currentScript.src;
239
+ /******/ if (!scriptUrl) {
240
+ /******/ var scripts = document.getElementsByTagName("script");
241
+ /******/ if(scripts.length) {
242
+ /******/ var i = scripts.length - 1;
243
+ /******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
244
+ /******/ }
245
+ /******/ }
246
+ /******/ }
247
+ /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
248
+ /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
249
+ /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
250
+ /******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
251
+ /******/ __webpack_require__.p = scriptUrl;
252
+ /******/ })();
253
+ /******/
254
+ /******/ /* webpack/runtime/jsonp chunk loading */
255
+ /******/ (() => {
256
+ /******/ // no baseURI
257
+ /******/
258
+ /******/ // object to store loaded and loading chunks
259
+ /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
260
+ /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
261
+ /******/ var installedChunks = {
262
+ /******/ "tsparticles.interaction.external.repulse": 0
263
+ /******/ };
264
+ /******/
265
+ /******/ __webpack_require__.f.j = (chunkId, promises) => {
266
+ /******/ // JSONP chunk loading for javascript
267
+ /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
268
+ /******/ if(installedChunkData !== 0) { // 0 means "already installed".
269
+ /******/
270
+ /******/ // a Promise means "currently loading".
271
+ /******/ if(installedChunkData) {
272
+ /******/ promises.push(installedChunkData[2]);
273
+ /******/ } else {
274
+ /******/ if(true) { // all chunks have JS
275
+ /******/ // setup Promise in chunk cache
276
+ /******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
277
+ /******/ promises.push(installedChunkData[2] = promise);
278
+ /******/
279
+ /******/ // start chunk loading
280
+ /******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
281
+ /******/ // create error before stack unwound to get useful stacktrace later
282
+ /******/ var error = new Error();
283
+ /******/ var loadingEnded = (event) => {
284
+ /******/ if(__webpack_require__.o(installedChunks, chunkId)) {
285
+ /******/ installedChunkData = installedChunks[chunkId];
286
+ /******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
287
+ /******/ if(installedChunkData) {
288
+ /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
289
+ /******/ var realSrc = event && event.target && event.target.src;
290
+ /******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
291
+ /******/ error.name = 'ChunkLoadError';
292
+ /******/ error.type = errorType;
293
+ /******/ error.request = realSrc;
294
+ /******/ installedChunkData[1](error);
295
+ /******/ }
296
+ /******/ }
297
+ /******/ };
298
+ /******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
299
+ /******/ }
300
+ /******/ }
301
+ /******/ }
302
+ /******/ };
303
+ /******/
304
+ /******/ // no prefetching
305
+ /******/
306
+ /******/ // no preloaded
307
+ /******/
308
+ /******/ // no HMR
309
+ /******/
310
+ /******/ // no HMR manifest
311
+ /******/
312
+ /******/ // no on chunks loaded
313
+ /******/
314
+ /******/ // install a JSONP callback for chunk loading
315
+ /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
316
+ /******/ var chunkIds = data[0];
317
+ /******/ var moreModules = data[1];
318
+ /******/ var runtime = data[2];
319
+ /******/ // add "moreModules" to the modules object,
320
+ /******/ // then flag all "chunkIds" as loaded and fire callback
321
+ /******/ var moduleId, chunkId, i = 0;
322
+ /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
323
+ /******/ for(moduleId in moreModules) {
324
+ /******/ if(__webpack_require__.o(moreModules, moduleId)) {
325
+ /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
326
+ /******/ }
327
+ /******/ }
328
+ /******/ if(runtime) var result = runtime(__webpack_require__);
329
+ /******/ }
330
+ /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
331
+ /******/ for(;i < chunkIds.length; i++) {
332
+ /******/ chunkId = chunkIds[i];
333
+ /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
334
+ /******/ installedChunks[chunkId][0]();
335
+ /******/ }
336
+ /******/ installedChunks[chunkId] = 0;
337
+ /******/ }
338
+ /******/
339
+ /******/ }
340
+ /******/
341
+ /******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_interaction_external_repulse"] = this["webpackChunk_tsparticles_interaction_external_repulse"] || [];
342
+ /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
343
+ /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
344
+ /******/ })();
345
+ /******/
85
346
  /************************************************************************/
86
- var __webpack_exports__ = {};
87
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
88
- (() => {
89
- // ESM COMPAT FLAG
90
- __webpack_require__.r(__webpack_exports__);
91
-
92
- // EXPORTS
93
- __webpack_require__.d(__webpack_exports__, {
94
- Repulse: () => (/* reexport */ Repulse),
95
- RepulseBase: () => (/* reexport */ RepulseBase),
96
- RepulseDiv: () => (/* reexport */ RepulseDiv),
97
- loadExternalRepulseInteraction: () => (/* binding */ loadExternalRepulseInteraction)
98
- });
99
-
100
- // EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
101
- var engine_root_window_ = __webpack_require__(533);
102
- ;// CONCATENATED MODULE: ./dist/browser/Options/Classes/RepulseBase.js
103
- class RepulseBase {
104
- constructor() {
105
- this.distance = 200;
106
- this.duration = 0.4;
107
- this.factor = 100;
108
- this.speed = 1;
109
- this.maxSpeed = 50;
110
- this.easing = "ease-out-quad";
111
- }
112
- load(data) {
113
- if (!data) {
114
- return;
115
- }
116
- if (data.distance !== undefined) {
117
- this.distance = data.distance;
118
- }
119
- if (data.duration !== undefined) {
120
- this.duration = data.duration;
121
- }
122
- if (data.easing !== undefined) {
123
- this.easing = data.easing;
124
- }
125
- if (data.factor !== undefined) {
126
- this.factor = data.factor;
127
- }
128
- if (data.speed !== undefined) {
129
- this.speed = data.speed;
130
- }
131
- if (data.maxSpeed !== undefined) {
132
- this.maxSpeed = data.maxSpeed;
133
- }
134
- }
135
- }
136
- ;// CONCATENATED MODULE: ./dist/browser/Options/Classes/RepulseDiv.js
137
-
138
- class RepulseDiv extends RepulseBase {
139
- constructor() {
140
- super();
141
- this.selectors = [];
142
- }
143
- load(data) {
144
- super.load(data);
145
- if (!data) {
146
- return;
147
- }
148
- if (data.selectors !== undefined) {
149
- this.selectors = data.selectors;
150
- }
151
- }
152
- }
153
- ;// CONCATENATED MODULE: ./dist/browser/Options/Classes/Repulse.js
154
-
155
-
156
-
157
- class Repulse extends RepulseBase {
158
- load(data) {
159
- super.load(data);
160
- if (!data) {
161
- return;
162
- }
163
- this.divs = (0,engine_root_window_.executeOnSingleOrMultiple)(data.divs, div => {
164
- const tmp = new RepulseDiv();
165
- tmp.load(div);
166
- return tmp;
167
- });
168
- }
169
- }
170
- ;// CONCATENATED MODULE: ./dist/browser/Repulser.js
171
-
172
-
173
- const repulseMode = "repulse";
174
- class Repulser extends engine_root_window_.ExternalInteractorBase {
175
- constructor(engine, container) {
176
- super(container);
177
- this._clickRepulse = () => {
178
- const container = this.container,
179
- repulseOptions = container.actualOptions.interactivity.modes.repulse;
180
- if (!repulseOptions) {
181
- return;
182
- }
183
- const repulse = container.repulse || {
184
- particles: []
185
- };
186
- if (!repulse.finish) {
187
- if (!repulse.count) {
188
- repulse.count = 0;
189
- }
190
- repulse.count++;
191
- if (repulse.count === container.particles.count) {
192
- repulse.finish = true;
193
- }
194
- }
195
- if (repulse.clicking) {
196
- const repulseDistance = container.retina.repulseModeDistance;
197
- if (!repulseDistance || repulseDistance < 0) {
198
- return;
199
- }
200
- const repulseRadius = Math.pow(repulseDistance / 6, 3),
201
- mouseClickPos = container.interactivity.mouse.clickPosition;
202
- if (mouseClickPos === undefined) {
203
- return;
204
- }
205
- const range = new engine_root_window_.Circle(mouseClickPos.x, mouseClickPos.y, repulseRadius),
206
- query = container.particles.quadTree.query(range, p => this.isEnabled(p));
207
- for (const particle of query) {
208
- const {
209
- dx,
210
- dy,
211
- distance
212
- } = (0,engine_root_window_.getDistances)(mouseClickPos, particle.position),
213
- d = distance ** 2,
214
- velocity = repulseOptions.speed,
215
- force = -repulseRadius * velocity / d;
216
- if (d <= repulseRadius) {
217
- repulse.particles.push(particle);
218
- const vect = engine_root_window_.Vector.create(dx, dy);
219
- vect.length = force;
220
- particle.velocity.setTo(vect);
221
- }
222
- }
223
- } else if (repulse.clicking === false) {
224
- for (const particle of repulse.particles) {
225
- particle.velocity.setTo(particle.initialVelocity);
226
- }
227
- repulse.particles = [];
228
- }
229
- };
230
- this._hoverRepulse = () => {
231
- const container = this.container,
232
- mousePos = container.interactivity.mouse.position,
233
- repulseRadius = container.retina.repulseModeDistance;
234
- if (!repulseRadius || repulseRadius < 0 || !mousePos) {
235
- return;
236
- }
237
- this._processRepulse(mousePos, repulseRadius, new engine_root_window_.Circle(mousePos.x, mousePos.y, repulseRadius));
238
- };
239
- this._processRepulse = (position, repulseRadius, area, divRepulse) => {
240
- const container = this.container,
241
- query = container.particles.quadTree.query(area, p => this.isEnabled(p)),
242
- repulseOptions = container.actualOptions.interactivity.modes.repulse;
243
- if (!repulseOptions) {
244
- return;
245
- }
246
- const {
247
- easing,
248
- speed,
249
- factor,
250
- maxSpeed
251
- } = repulseOptions,
252
- easingFunc = (0,engine_root_window_.getEasing)(easing),
253
- velocity = (divRepulse?.speed ?? speed) * factor;
254
- for (const particle of query) {
255
- const {
256
- dx,
257
- dy,
258
- distance
259
- } = (0,engine_root_window_.getDistances)(particle.position, position),
260
- repulseFactor = (0,engine_root_window_.clamp)(easingFunc(1 - distance / repulseRadius) * velocity, 0, maxSpeed),
261
- normVec = engine_root_window_.Vector.create(distance === 0 ? velocity : dx / distance * repulseFactor, distance === 0 ? velocity : dy / distance * repulseFactor);
262
- particle.position.addTo(normVec);
263
- }
264
- };
265
- this._singleSelectorRepulse = (selector, div) => {
266
- const container = this.container,
267
- repulse = container.actualOptions.interactivity.modes.repulse;
268
- if (!repulse) {
269
- return;
270
- }
271
- const query = document.querySelectorAll(selector);
272
- if (!query.length) {
273
- return;
274
- }
275
- query.forEach(item => {
276
- const elem = item,
277
- pxRatio = container.retina.pixelRatio,
278
- pos = {
279
- x: (elem.offsetLeft + elem.offsetWidth / 2) * pxRatio,
280
- y: (elem.offsetTop + elem.offsetHeight / 2) * pxRatio
281
- },
282
- repulseRadius = elem.offsetWidth / 2 * pxRatio,
283
- area = div.type === "circle" ? new engine_root_window_.Circle(pos.x, pos.y, repulseRadius) : new engine_root_window_.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio),
284
- divs = repulse.divs,
285
- divRepulse = (0,engine_root_window_.divMode)(divs, elem);
286
- this._processRepulse(pos, repulseRadius, area, divRepulse);
287
- });
288
- };
289
- this._engine = engine;
290
- if (!container.repulse) {
291
- container.repulse = {
292
- particles: []
293
- };
294
- }
295
- this.handleClickMode = mode => {
296
- const options = this.container.actualOptions,
297
- repulseOpts = options.interactivity.modes.repulse;
298
- if (!repulseOpts || mode !== repulseMode) {
299
- return;
300
- }
301
- if (!container.repulse) {
302
- container.repulse = {
303
- particles: []
304
- };
305
- }
306
- const repulse = container.repulse;
307
- repulse.clicking = true;
308
- repulse.count = 0;
309
- for (const particle of container.repulse.particles) {
310
- if (!this.isEnabled(particle)) {
311
- continue;
312
- }
313
- particle.velocity.setTo(particle.initialVelocity);
314
- }
315
- repulse.particles = [];
316
- repulse.finish = false;
317
- setTimeout(() => {
318
- if (container.destroyed) {
319
- return;
320
- }
321
- repulse.clicking = false;
322
- }, repulseOpts.duration * 1000);
323
- };
324
- }
325
- clear() {}
326
- init() {
327
- const container = this.container,
328
- repulse = container.actualOptions.interactivity.modes.repulse;
329
- if (!repulse) {
330
- return;
331
- }
332
- container.retina.repulseModeDistance = repulse.distance * container.retina.pixelRatio;
333
- }
334
- async interact() {
335
- const container = this.container,
336
- options = container.actualOptions,
337
- mouseMoveStatus = container.interactivity.status === engine_root_window_.mouseMoveEvent,
338
- events = options.interactivity.events,
339
- hover = events.onHover,
340
- hoverEnabled = hover.enable,
341
- hoverMode = hover.mode,
342
- click = events.onClick,
343
- clickEnabled = click.enable,
344
- clickMode = click.mode,
345
- divs = events.onDiv;
346
- if (mouseMoveStatus && hoverEnabled && (0,engine_root_window_.isInArray)(repulseMode, hoverMode)) {
347
- this._hoverRepulse();
348
- } else if (clickEnabled && (0,engine_root_window_.isInArray)(repulseMode, clickMode)) {
349
- this._clickRepulse();
350
- } else {
351
- (0,engine_root_window_.divModeExecute)(repulseMode, divs, (selector, div) => this._singleSelectorRepulse(selector, div));
352
- }
353
- }
354
- isEnabled(particle) {
355
- const container = this.container,
356
- options = container.actualOptions,
357
- mouse = container.interactivity.mouse,
358
- events = (particle?.interactivity ?? options.interactivity).events,
359
- divs = events.onDiv,
360
- hover = events.onHover,
361
- click = events.onClick,
362
- divRepulse = (0,engine_root_window_.isDivModeEnabled)(repulseMode, divs);
363
- if (!(divRepulse || hover.enable && mouse.position || click.enable && mouse.clickPosition)) {
364
- return false;
365
- }
366
- const hoverMode = hover.mode,
367
- clickMode = click.mode;
368
- return (0,engine_root_window_.isInArray)(repulseMode, hoverMode) || (0,engine_root_window_.isInArray)(repulseMode, clickMode) || divRepulse;
369
- }
370
- loadModeOptions(options, ...sources) {
371
- if (!options.repulse) {
372
- options.repulse = new Repulse();
373
- }
374
- for (const source of sources) {
375
- options.repulse.load(source?.repulse);
376
- }
377
- }
378
- reset() {}
379
- }
380
- ;// CONCATENATED MODULE: ./dist/browser/index.js
381
-
382
- async function loadExternalRepulseInteraction(engine, refresh = true) {
383
- await engine.addInteractor("externalRepulse", container => new Repulser(engine, container), refresh);
384
- }
385
-
386
-
387
-
388
-
389
-
390
-
391
- })();
392
-
347
+ /******/
348
+ /******/ // startup
349
+ /******/ // Load entry module and return exports
350
+ /******/ // This entry module can't be inlined because the eval devtool is used.
351
+ /******/ var __webpack_exports__ = __webpack_require__("./dist/browser/index.js");
352
+ /******/
393
353
  /******/ return __webpack_exports__;
394
354
  /******/ })()
395
355
  ;